A Linux daemon utility, nvidia-persistenced, addresses an undesirable side effect of the NVIDIA kernel driver behavior in certain computing environments. Whenever the NVIDIA device resources are no longer in use, the NVIDIA kernel driver will tear down the device state. Normally, this is the intended behavior of the device driver, but for some applications, the latencies incurred by repetitive device initialization can significantly impact performance.
To avoid this behavior, nvidia-persistenced provides a configuration option called "persistence mode" that can be set by NVIDIA management software, such as nvidia-smi. When persistence mode is enabled, the daemon holds the NVIDIA character device files open, preventing the NVIDIA kernel driver from tearing down device state when no other process is using the device. This utility does not actually use any device resources itself - it will simply sleep while maintaining a reference to the NVIDIA device state.
nvidia-persistenced is included with the NVIDIA Linux GPU driver. After installing the driver, this utility may be installed to run on system startup or manually with the command:
in a terminal window. Note that the daemon may require root privileges to create its runtime data directory, /var/run/nvidia-persistenced/, or it may otherwise need to be run as a user that has access to that directory.
Detailed help and usage information is available primarily via the nvidia-persistenced man page, as well as the --help command line option.
The source code to nvidia-persistenced is released under the MIT license and is available at: ftp://download.nvidia.com/XFree86/nvidia-persistenced/.
If you have difficulty getting nvidia-persistenced to work as expected, the best way to gather information as to what is happening is to run the daemon with the --verbose option.
nvidia-persistenced detaches from its parent process very early on, and as such only invalid command line argument errors will be printed in the terminal window. All other output, including verbose informational messages, are sent to the syslog interface instead. Consult your distribution's documentation for accessing syslog output.
The daemon utility nvidia-persistenced is installed by the NVIDIA Linux GPU driver installer, but it is not installed to run on system startup. Due to the wide variety of init systems used by the various Linux distributions that the NVIDIA Linux GPU driver supports, we request that package maintainers for those distributions provide the packaging necessary to integrate well with their platform.
NVIDIA provides sample init scripts for some common init systems in /usr/share/doc/NVIDIA_GLX-1.0/sample/nvidia-persistenced-init.tar.bz2 to aid in installation of the utility.
nvidia-persistenced is intended to be run as a daemon from system initialization, and is generally designed as a tool for compute-only platforms where the NVIDIA device is not used to display a graphical user interface. As such, depending on how your package is typically used, it may not be necessary to install the daemon to run on system initialization.
If nvidia-persistenced is packaged to run on system initialization, the package installation, init script or system management utility that runs the daemon should provide the following:
It is strongly recommended, though not required, that the daemon be run as a non-root user for security purposes.
The daemon may either be started with root privileges and the --user option, or it may be run directly as the non-root user.
The daemon must be able to create its socket and PID file in this directory.
If the daemon is run as root, it will create this directory itself and remove it when it shuts down cleanly.
If the daemon is run as a non-root user, this directory must already exist, and the daemon will not attempt to remove it when it shuts down cleanly.
If the daemon is started as root, but provided a non-root user to run as via the --user option, the daemon will create this directory itself, chown it to the provided user, and setuid to the provided user to drop root privileges. The daemon may be unable to remove this directory when it shuts down cleanly, depending on the privileges of the provided user.