MPS v3 Interface#

MPS v3 is a new, opt-in control daemon interface that replaces the interactive shell of Legacy MPS v2 with a scriptable module verb command syntax, named servers and namespaces, and file-based configuration. All existing Legacy MPS v2 functionality continues to work unchanged; MPS v3 is selected explicitly per the instructions below.

Enabling MPS v3#

MPS v3 is selected by protocol version. Version 2 is Legacy MPS and remains the default; version 3 selects MPS v3.

  • -p 3 or --protocol 3 on the nvidia-cuda-mps-control command line.

  • The CUDA_MPS_PROTOCOL_VERSION environment variable, set to 3. If both the flag and the environment variable are set, the environment variable takes precedence.

nvidia-cuda-mps-control -d -p 3
export CUDA_MPS_PROTOCOL_VERSION=3
nvidia-cuda-mps-control -d

If an MPS control daemon is already running, any new nvidia-cuda-mps-control invocation automatically follows that daemon’s protocol version, regardless of its own -p flag or environment variable.

Control Daemon Options#

The control daemon accepts the following top-level options:

  • -h, --help – Print this message.

  • -d, --daemon – Setup the daemon in the background.

  • -f, --foreground – Setup the daemon in the foreground.

  • -m, --multiuser – Enable multiuser mode.

  • -a, --apply <file> – Apply configuration from a TOML file. Refer to MPS v3 Configuration File.

  • -p, --protocol <2|3> – Protocol 2 (legacy, default) or 3.

  • -q, --quit – Quit and stop the control daemon and all running servers.

  • -v, --version – Print the version.

CLI Command Structure#

MPS v3 commands follow a common module verb [arguments] syntax:

nvidia-cuda-mps-control <module> <verb> [positional-args] [--key=value ...] [--flag ...]
  • Modules: server, namespace, client, device, sm-partition, compute-policy, feature, memacct, context-share.

  • Arguments may be positional (up to 3), or given as --key=value / key=value, or as valueless flags (--force, --all).

  • Memory limit values use unit suffixes: 4G, 512M, 1024K.

  • Client priority values are 0 (normal) or 1 (below normal).

  • Server and namespace names must be lowercase letters, digits, and underscores only, up to 64 characters.

  • <module> help or <module> <verb> help prints detailed usage for that module or verb.

Server#

A server is a named, independently managed MPS server process. Unlike Legacy MPS v2, where exactly one server can be active per UID, MPS v3 supports multiple concurrently running named servers.

nvidia-cuda-mps-control server create <name> [--uid=<n>] [--allowed-devices=<devices>]
                                              [--locality-domains=<true|false>]
nvidia-cuda-mps-control server delete <name> [--force]
nvidia-cuda-mps-control server list [<name>] [--format=<table|csv>[,noheader]]
nvidia-cuda-mps-control server set <name> [--uid=<n>] [--pinned-memory-limit=<limit>]
                                           [--active-thread-percentage=<pct>]
                                           [--locality-domains=<true|false>]
                                           [--client-priority=<priority>]
                                           [--timeslice-pct=<pct>]
                                           [--sm-partition=<name|none> --device=<device>]
nvidia-cuda-mps-control server get <name> <field>
  • create – Creates a named server. Either <name> or --uid=<n> must be provided; if --uid is omitted, the server is owned by the connecting user. In multiuser mode, only --uid=0 is allowed and --uid otherwise defaults to the connecting user.

    • --allowed-devices=<devices> – Restrict the server to specific GPUs (default: all). Comma-separated GPU IDs or ordinals, for example GPU-abc123 or 0,1.

    • --locality-domains=<true|false> – Enable or disable locality domains (see Locality Domains).

    • --uid=<n> – Owner UID. Required without <name>; optional with <name>.

  • delete – Deletes a server by name. Without --force, refuses if active clients remain. With --force, terminates active clients first.

  • list – Lists all servers, or a specific server if <name> is given. Output columns: name, uid, pid, status, pipe-directory, allowed-devices, context-ids, timeslice-pct.

  • set – Sets server properties. Memory limits, active thread percentage, client priority, and SM partition assignments apply to the server’s default namespace. Locality domains and timeslice percentage apply to the whole server. At least one option flag is required.

    • --pinned-memory-limit=<limit> – Pinned memory limit.

    • --active-thread-percentage=<pct> – Active thread percentage, 1-100.

    • --locality-domains=<true|false> – Enable or disable locality domains.

    • --client-priority=<priority> – Client priority.

    • --timeslice-pct=<pct> – Timeslice percentage, 0-100 (0 means unset). See Weighted Timeslicing for the base duration and update restrictions.

    • --sm-partition=<name|none> – Assign an SM partition to the default namespace on --device=<device>. The device may be an ordinal or GPU/MIG UUID. none clears the assignment. See SM Partition Assignments.

  • get – Gets a single, unformatted field value from a server. Fields: name, uid, pid, status, pipe-directory, allowed-devices, timeslice-pct. An unset timeslice percentage is reported as unset.

$ nvidia-cuda-mps-control server create training --allowed-devices=GPU-abcd-1234,GPU-efgh-5678 --uid=1000
$ nvidia-cuda-mps-control server set training --pinned-memory-limit=8G
$ nvidia-cuda-mps-control server list --format=csv,noheader
training,1000,48201,Ready,/run/nvidia-mps/training,GPU-abcd-1234,-,unset
$ nvidia-cuda-mps-control server get training pipe-directory
/run/nvidia-mps/training
$ nvidia-cuda-mps-control server delete training --force

Namespace#

A namespace subdivides a server’s resources for a group of clients. Every server has an implicit default namespace. Refer to MPS v3 Namespaces for more about what namespaces are for.

nvidia-cuda-mps-control namespace create <name> --server=<s>
                                            [--cgroup=<path|none>] [--cgroup-depth=<n>]
nvidia-cuda-mps-control namespace delete <name> --server=<s> [--force]
nvidia-cuda-mps-control namespace list [<name>] [--server=<s>]
                                        [--format=<table|csv>[,noheader]]
nvidia-cuda-mps-control namespace set <name> --server=<s> [--pinned-memory-limit=<limit>]
                                              [--active-thread-percentage=<pct>]
                                              [--client-priority=<priority>]
                                              [--sm-partition=<name|none> --device=<device>]
nvidia-cuda-mps-control namespace get <name> <server> <field>
  • create – Creates a namespace under the given server.

    • --cgroup=<path|none> – Associate a cgroup v2 subtree with a custom namespace on a named server. Omitted or none means no mapping.

    • --cgroup-depth=<n> – Maximum descendant depth, 0-64. Requires a cgroup path; omitted means unbounded. See Cgroup Matching for matching and fallback.

  • delete – Deletes a namespace. --force allows deletion even with active clients.

  • list – Lists namespaces. Output columns: name, server, server-status, pinned-memory-limit, active-thread-percentage, client-priority, cgroup, cgroup-depth, pipe-directory, device, sm-partition. Device assignments are shown per device; CSV output repeats the namespace fields for each device row.

  • set – Sets namespace limits or an SM partition assignment. At least one option flag is required. --sm-partition=<name|none> requires --device=<device> (an ordinal or GPU/MIG UUID); none clears the assignment. The target namespace must have no attached clients when changing an assignment. See SM Partition Assignments for precedence and clearing behavior.

  • get – Gets a single field value from a namespace. Fields: name, server, server-status, pipe-directory, pinned-memory-limit, active-thread-percentage, client-priority, cgroup, cgroup-depth, sm-partitions. Unmapped cgroup fields are reported as -; an unlimited depth is reported as unbounded. sm-partitions prints one deviceUuid:partitionName per line, or an empty value if no assignments exist.

$ nvidia-cuda-mps-control namespace create high_priority --server=training
$ nvidia-cuda-mps-control namespace set high_priority --server=training --pinned-memory-limit=4G
$ nvidia-cuda-mps-control namespace get high_priority training pinned-memory-limit
4G
$ nvidia-cuda-mps-control namespace delete high_priority --server=training

Client#

nvidia-cuda-mps-control client list [--server=<s>] [--all] [--format=<table|csv>[,noheader]]
nvidia-cuda-mps-control client get <pid> <field>
nvidia-cuda-mps-control client terminate <pid>
  • list – Lists active clients connected to servers, along with namespace and device information. --all includes clients from all servers; --server=<s> filters to one server.

  • get – Gets a single field value for a client. Fields: pid, server, device, pci-id, linux-ns, maws-ns, cmd.

  • terminate – Terminates a client by PID.

$ nvidia-cuda-mps-control client list --server=training --format=csv,noheader
51023,training,0,default,python train.py
51087,training,0,high_priority,python eval.py
$ nvidia-cuda-mps-control client terminate 51023

Device#

list#

nvidia-cuda-mps-control device list [--server=<s>] [--format=<table|csv>[,noheader]]

Enumerates devices. --server=<s> scopes the view to one server’s device enumeration (default: all servers). Output columns: Ordinal, Server, PCI ID, Device UUID, Name, Total SMs, Total Chunks, Attributes.

SM Partitions#

Static SM partitioning in MPS v3 works the same way conceptually as Legacy MPS v2 static SM partitioning, using the sm-partition module instead of the interactive sm_partition command.

Note

The partition ID (the CUDA_MPS_SM_PARTITION value) is encoded differently in MPS v3 than in Legacy MPS v2, so a partition ID generated by one is not valid in the other. Always use the ID reported by the version of MPS you are running.

nvidia-cuda-mps-control sm-partition create <name> --server=<s> --device=<device>
                                             --chunks=<n> [--include-remainder=<true|false>]
                                             [--shareable=<true|false>]
                                             [--max-chunks=<n|unlimited>]
nvidia-cuda-mps-control sm-partition delete <name> --server=<s> --device=<device>
nvidia-cuda-mps-control sm-partition list [--server=<s>] [--device=<device>] [--all]
                                           [--format=<table|csv>[,noheader]]
  • create – Creates an SM partition. --device accepts either a device ordinal or a GPU/MIG UUID. --chunks must be a positive integer. --include-remainder defaults to false. If the target server is not yet running, the partition is recorded and applied the next time the server starts. If the server is already running, the partition is created immediately and its assigned ID is printed. The --shareable and --max-chunks options enable load balancing; see SM Partition Load Balancing.

  • delete – Deletes an SM partition. Deletion is rejected while a namespace references the partition, including the default namespace. Clear those assignments before deleting it.

  • list – Lists SM partitions. Output columns: server, device, name, chunks, sm-count, include-remainder, shareable, max-chunks, status, visible-uuid. The default view omits include-remainder and the load balancing columns; --all shows every column. A partition’s status is configured if it has been recorded but not yet applied to a running server, or created once it has been carved on the live GPU. Devices with unclaimed capacity also show a synthetic row with status unallocated.

$ nvidia-cuda-mps-control sm-partition create large --server=training --device=GPU-74d43ed3-cdf7-e667-3644-bf5b4f46ed65 --chunks=4
SM partition 'large' created on device GPU-74d43ed3-cdf7-e667-3644-bf5b4f46ed65 (sm-count=34)
CUDA_MPS_SM_PARTITION=GPU-74d43ed3-cdf7-e667-3644-bf5b4f46ed65/Kp8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
$ nvidia-cuda-mps-control sm-partition list --server=training --all
SERVER    DEVICE                                  NAME     CHUNKS  SM-COUNT  INCLUDE-REMAINDER  STATUS   VISIBLE-UUID
training  GPU-74d43ed3-cdf7-e667-3644-bf5b4f46ed65  large    4       34        false              created  Kp8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
training  GPU-74d43ed3-cdf7-e667-3644-bf5b4f46ed65  -        1       8         -                  unallocated  -
$ nvidia-cuda-mps-control sm-partition delete large --server=training --device=GPU-74d43ed3-cdf7-e667-3644-bf5b4f46ed65
SM partition 'large' deleted from device GPU-74d43ed3-cdf7-e667-3644-bf5b4f46ed65

Static partitioning is rejected if the target device already has active clients, if locality domains are enabled on the server (the two features are mutually exclusive), or if the device does not have enough free chunks remaining.

Assign a partition to a group of clients through a namespace, as described in SM Partition Assignments. Clients without a namespace assignment for a device can select a partition using CUDA_MPS_SM_PARTITION.

SM Partition Load Balancing#

By default a static partition is exclusive: its SMs are reserved for the clients assigned to it, even while idle. Load balancing lets partitions on the same device borrow idle capacity: SMs not assigned to any partition, and the SMs of shareable partitions that have no clients attached. A partition’s capacity is counted in chunks. Two options on sm-partition create control it:

  • --shareable=<true|false> – Allows this partition to lend its SMs to partitions that are borrowing while it has no clients attached. Default: false.

  • --max-chunks=<n|unlimited> – The maximum total number of chunks this partition may grow to by borrowing from the pool of lendable capacity. 0 (the default) disables borrowing. unlimited removes the cap. A numeric value must be at least the partition’s --chunks.

Partitions never share SMs at the same time, so error isolation is preserved.

$ nvidia-cuda-mps-control sm-partition create lender --server=training \
    --device=GPU-74d43ed3-cdf7-e667-3644-bf5b4f46ed65 --chunks=2 --shareable=true
$ nvidia-cuda-mps-control sm-partition create burst --server=training \
    --device=GPU-74d43ed3-cdf7-e667-3644-bf5b4f46ed65 --chunks=2 \
    --max-chunks=4

Load balancing options can also be set in the configuration file (shareable, max_chunks); see MPS v3 Configuration File. Both options are per partition, so a partition can lend, borrow, both, or neither.

Note

Load balancing relaxes the strict exclusivity described in Static SM Partitioning. Leave the options at their defaults for workloads that need SMs reserved exclusively for a partition.

Locality Domains#

Locality domains are the MPS v3 name for the feature formerly called MLOPart in Legacy MPS v2. Refer to Locality Domains for a conceptual overview. Enable them per-server, either at creation time or on an existing server:

nvidia-cuda-mps-control server create <name> --locality-domains=<true|false>
nvidia-cuda-mps-control server set <name> --locality-domains=<true|false>

Locality domains are mutually exclusive with static SM partitions on the same server.

Weighted Timeslicing#

Starting with driver version r620, MPS v3 supports weighted timeslicing, including timeslice-yield-level.

Weighted timeslicing adjusts the compute timeslice used by each server on its devices. The daemon-wide compute-policy selects the base duration and yield behavior, while each server’s timeslice-pct scales that duration. The percentage controls timeslice length; it does not guarantee a percentage of GPU utilization.

nvidia-cuda-mps-control compute-policy set [--timeslice=<default|short|medium|long>]
                                         [--timeslice-yield-level=<1|2>]
nvidia-cuda-mps-control compute-policy get <timeslice|timeslice-yield-level>
nvidia-cuda-mps-control compute-policy describe [--format=<table|csv>[,noheader]]
nvidia-cuda-mps-control server set <name> --timeslice-pct=<pct>
nvidia-cuda-mps-control server get <name> timeslice-pct

compute-policy set requires at least one option. Omitted options retain their current values. get returns the configured value; describe reports name, timeslice, and timeslice-yield-level.

Timeslice Duration#

timeslice selects the base duration for every server:

  • default – Use each device’s default compute timeslice (the initial setting).

  • short – 10 ms.

  • medium – 20 ms.

  • long – 50 ms.

timeslice-pct accepts an integer from 0 to 100. Values 1-100 scale the base duration by that percentage, on each device owned by the server. For example, long with timeslice-pct=50 gives a 25 ms timeslice. A value of 0 is the initial setting and means unset: use the full base duration. Resetting the percentage to 0 preserves the daemon’s selected timeslice level. Values that resolve below the minimum supported timeslice are rejected.

Timeslice Yield Level#

timeslice-yield-level controls how aggressively the GPU switches between workloads:

  • 1 – Normal switching behavior.

  • 2 – More aggressive switching.

Initially the yield level is unset, preserving the driver’s existing behavior. Explicit settings accept only 1 or 2; unset is a reported state, not a value accepted by set. Yield behavior is independent of duration: selecting short, medium, or long does not select a yield level.

Changing Settings#

Set compute-policy before creating any servers. Both properties are fixed while any server entry exists, including a configured server that has not started and a UID-routed server. Delete all server entries before changing either property.

A server’s timeslice-pct can be configured before it starts or changed while it has no attached clients. A running server applies the percentage across its devices; updates are rejected while clients are attached to any of its namespaces.

For a newly started daemon with no servers:

$ nvidia-cuda-mps-control compute-policy set --timeslice=long --timeslice-yield-level=2
$ nvidia-cuda-mps-control server create training
$ nvidia-cuda-mps-control server set training --timeslice-pct=50
$ nvidia-cuda-mps-control compute-policy describe
$ nvidia-cuda-mps-control server get training timeslice-pct

This configures a 25 ms timeslice with more aggressive switching. The equivalent startup TOML settings are shown in MPS v3 Configuration File.

Features#

Optional server-side behaviors are exposed as toggleable features through the feature module. Feature names are given positionally.

nvidia-cuda-mps-control feature enable <memacct|context-share>
nvidia-cuda-mps-control feature disable <memacct|context-share>
nvidia-cuda-mps-control feature describe [memacct|context-share] [--format=<table|csv>[,noheader]]

feature describe prints, for one or all registered features: FEATURE, STATE (enabled/disabled, with (default) appended when it matches the built-in default), MODULE, and COVERS.

$ nvidia-cuda-mps-control feature describe
FEATURE           STATE                 MODULE            COVERS
memacct           enabled (default)     memacct           -
context-share     enabled (default)     context-share     -

memacct#

The memacct feature governs automatic memory accounting and audit logging.

nvidia-cuda-mps-control memacct set audit_log=<true|false>
nvidia-cuda-mps-control memacct set force_polling=<true|false>
nvidia-cuda-mps-control memacct describe [--format=<table|csv>[,noheader]]

Supported keys:

  • audit_log – Logs high-frequency accounting and intermediate eviction decisions to the daemon log. Disabled by default.

  • force_polling – Disables event-driven over-limit detection and makes MPS read each cgroup’s current usage and limits directly instead. Disabled by default. See Detection Modes and Polling.

memacct set records the new values; force_polling is read when memacct starts, so set it in the configuration file or before the feature is enabled. memacct describe reports the current value of both keys in its options column. See MPS v3 Memory Partitioning for how memacct selects and evicts clients.

context-share#

The context-share feature controls MPS’s underlying context-sharing behavior, including whether the default (UID-routed) socket auto-spawns backward-compatible servers.

nvidia-cuda-mps-control context-share set default_socket=<on|off>
nvidia-cuda-mps-control context-share describe [--format=<table|csv>[,noheader]]

default_socket is enabled by default. Disabling context-share itself, or changing it while any server exists, is rejected – with the exception of default_socket, which may be changed at any time. Disabling context-share entirely lets CUDA applications run without MPS-style context sharing.

Configuration File#

MPS v3 can load its full startup configuration from a TOML file with -a/--apply, covering servers, namespaces, devices, SM partitions, compute policy, and features in a single file. Refer to MPS v3 Configuration File for the full schema and an example.

nvidia-cuda-mps-control -d -p 3 -a /path/to/config.toml

Directories and Environment Variables#

MPS v3 clients and servers use the same Appendix: Environment Variables as Legacy MPS v2, including CUDA_VISIBLE_DEVICES, CUDA_MPS_PIPE_DIRECTORY, CUDA_MPS_LOG_DIRECTORY, and CUDA_DEVICE_MAX_CONNECTIONS. CUDA_MPS_ACTIVE_THREAD_PERCENTAGE, CUDA_MPS_PINNED_DEVICE_MEM_LIMIT, and CUDA_MPS_CLIENT_PRIORITY also work the same on the client side, but interact with MPS v3 namespace-level settings differently than with Legacy MPS v2’s daemon-wide settings; see the notes under each variable’s entry there.

MPS v3 uses the same pipe directory and log directory defaults as Legacy MPS v2:

  • CUDA_MPS_PIPE_DIRECTORY – If set, used directly. Otherwise defaults to /run/nvidia-mps when the daemon runs as root, or /tmp/nvidia-mps otherwise. Each server and namespace gets its own subdirectory under the pipe directory containing its control socket; each server’s subdirectory also contains its log pipe.

  • CUDA_MPS_LOG_DIRECTORY – Defaults to /var/log/nvidia-mps. The daemon log is control.log; each server logs to <server-name>/server.log.

At startup, the daemon prints the pipe directory clients should connect through:

To connect CUDA applications to this daemon, set CUDA_MPS_PIPE_DIRECTORY=/run/nvidia-mps