Quick Start#
For an in-depth guide on MPS usage, refer to Appendix: Common Tasks.
For an in-depth guide on commands, environment variables, and more, refer to Appendix: Tools and Interface Reference.
Starting the MPS controller#
To start the MPS controller as a daemon (recommended):
nvidia-cuda-mps-control -d
Launching an application under MPS#
When the MPS controller is active, CUDA applications will use MPS:
./cuda_application
This can be verified with the ps command while the application is running:
echo ps | nvidia-cuda-mps-control
This can also be verified by using nvidia-smi after the application is launched to verify the existence of the nvidia-cuda-mps-server process. While the application is running, it will also appear in nvidia-smi with the M+C type specified.
Quitting MPS#
To quit the MPS controller and any associated MPS servers:
echo quit | nvidia-cuda-mps-control
Explicitly starting an MPS server#
To explicitly start an MPS server for user $UID:
echo start_server -uid $UID | nvidia-cuda-mps-control
Note that servers are started implicitly when a CUDA application is launched while the MPS controller is active.
Starting multiple control/server pairs#
To start multiple MPS servers for the same user, you can use different CUDA MPS directories to start different controllers.
export CUDA_MPS_PIPE_DIRECTORY=/tmp/nvidia-mps-0 # Select a location that's accessible to the given $UID
export CUDA_MPS_LOG_DIRECTORY=/tmp/nvidia-log-0 # Select a location that's accessible to the given $UID
nvidia-cuda-mps-control -d # Start an MPS controller on pipe 0
export CUDA_MPS_PIPE_DIRECTORY=/tmp/nvidia-mps-1 # Select a location that's accessible to the given $UID
export CUDA_MPS_LOG_DIRECTORY=/tmp/nvidia-log-1 # Select a location that's accessible to the given $UID
nvidia-cuda-mps-control -d # Start an MPS controller on pipe 1
To start an application under one of the controllers, the same CUDA_MPS_PIPE_DIRECTORY must be set for the controller and the application.
CUDA_MPS_PIPE_DIRECTORY=/tmp/nvidia-mps-0 CUDA_MPS_LOG_DIRECTORY=/tmp/nvidia-log-0 ./cuda_application # This will use the MPS controller on pipe 0
CUDA_MPS_PIPE_DIRECTORY=/tmp/nvidia-mps-1 CUDA_MPS_LOG_DIRECTORY=/tmp/nvidia-log-1 ./cuda_application # This will use the MPS controller on pipe 1
Starting an MPS server with MLOPart#
To start a server configured to use MLOPart on supported devices for user $UID:
echo start_server -uid $UID -mlopart | nvidia-cuda-mps-control
For more information, refer to Memory Locality Optimized Partitions.
Enabling static SM partitioning#
Static SM partitioning must be enabled at MPS controller start time:
nvidia-cuda-mps-control -d -S
For more information, refer to Static SM Partitioning.