Multi Instance GPU Management#

This chapter describes NVML operations that are associated with Multi Instance GPU management.

Macros#

NVML_COMPUTE_INSTANCE_ENGINE_PROFILE_COUNT

Number of engine profiles.

NVML_COMPUTE_INSTANCE_ENGINE_PROFILE_SHARED

All the engines except multiprocessors would be shared.

NVML_COMPUTE_INSTANCE_PROFILE_1_SLICE

Compute instance profiles.

NVML_COMPUTE_INSTANCE_PROFILE_1_SLICE_REV1

1_SLICE compute instance profile (rev1).

NVML_COMPUTE_INSTANCE_PROFILE_2_SLICE

2_SLICE compute instance profile.

NVML_COMPUTE_INSTANCE_PROFILE_3_SLICE

3_SLICE compute instance profile.

NVML_COMPUTE_INSTANCE_PROFILE_4_SLICE

4_SLICE compute instance profile.

NVML_COMPUTE_INSTANCE_PROFILE_6_SLICE

6_SLICE compute instance profile.

NVML_COMPUTE_INSTANCE_PROFILE_7_SLICE

7_SLICE compute instance profile (perf optimized for host work scheduling).

NVML_COMPUTE_INSTANCE_PROFILE_7_SLICE_NVL

7_SLICE compute instance profile (perf optimized for multi-GPU use).

NVML_COMPUTE_INSTANCE_PROFILE_8_SLICE

8_SLICE compute instance profile.

NVML_COMPUTE_INSTANCE_PROFILE_CAPS_GFX

MIG compute instance profile capability.

NVML_COMPUTE_INSTANCE_PROFILE_COUNT

Number of compute instance profiles.

NVML_DEVICE_MIG_DISABLE

Disable Multi Instance GPU mode.

NVML_DEVICE_MIG_ENABLE

Enable Multi Instance GPU mode.

NVML_GPU_INSTANCE_PROFILE_1_SLICE

GPU instance profiles.

NVML_GPU_INSTANCE_PROFILE_1_SLICE_ALL_ME

1_SLICE profile with all of GPU Decode, Encoder, JPEG, OFA engines.

NVML_GPU_INSTANCE_PROFILE_1_SLICE_GFX

1_SLICE gfx capable profile.

NVML_GPU_INSTANCE_PROFILE_1_SLICE_NO_ME

1_SLICE profile with none of Decode, Encoder, JPEG, OFA engines.

NVML_GPU_INSTANCE_PROFILE_1_SLICE_REV1

1_SLICE GPU instance profile (rev1).

NVML_GPU_INSTANCE_PROFILE_1_SLICE_REV2

1_SLICE GPU instance profile (rev2).

NVML_GPU_INSTANCE_PROFILE_2_SLICE

2_SLICE GPU instance profile.

NVML_GPU_INSTANCE_PROFILE_2_SLICE_ALL_ME

NVML_GPU_INSTANCE_PROFILE_2_SLICE_GFX

2_SLICE gfx capable profile.

NVML_GPU_INSTANCE_PROFILE_2_SLICE_NO_ME

2_SLICE profile with none of Decode, Encoder, JPEG, OFA engines.

NVML_GPU_INSTANCE_PROFILE_2_SLICE_REV1

2_SLICE GPU instance profile (rev1).

NVML_GPU_INSTANCE_PROFILE_3_SLICE

3_SLICE GPU instance profile.

NVML_GPU_INSTANCE_PROFILE_3_SLICE_GFX

3_SLICE gfx + media capable profile.

NVML_GPU_INSTANCE_PROFILE_4_SLICE

4_SLICE GPU instance profile.

NVML_GPU_INSTANCE_PROFILE_4_SLICE_GFX

4_SLICE gfx capable profile.

NVML_GPU_INSTANCE_PROFILE_6_SLICE

6_SLICE GPU instance profile.

NVML_GPU_INSTANCE_PROFILE_7_SLICE

7_SLICE GPU instance profile.

NVML_GPU_INSTANCE_PROFILE_8_SLICE

8_SLICE GPU instance profile.

NVML_GPU_INSTANCE_PROFILE_CAPS_GFX

GFX support.

NVML_GPU_INSTANCE_PROFILE_CAPS_P2P

MIG GPU instance profile capability.

NVML_GPU_INSTANCE_PROFILE_COUNT

Total number of GPU instance profiles.

NVML_GPU_INTSTANCE_PROFILE_CAPS_P2P

Deprecated, do not use.

nvmlComputeInstanceProfileInfo_v2

Version identifier value for nvmlComputeInstanceProfileInfo_v2_t::version .

nvmlComputeInstanceProfileInfo_v3

Version identifier value for nvmlComputeInstanceProfileInfo_v3_t::version .

nvmlGpuInstanceProfileInfo_v2

Version identifier value for nvmlGpuInstanceProfileInfo_v2_t::version .

nvmlGpuInstanceProfileInfo_v3

Version identifier value for nvmlGpuInstanceProfileInfo_v3_t::version .

Functions#

nvmlReturn_t nvmlComputeInstanceDestroy(nvmlComputeInstance_t computeInstance)

Destroy compute instance.

nvmlReturn_t nvmlComputeInstanceGetInfo_v2(nvmlComputeInstance_t computeInstance, nvmlComputeInstanceInfo_t *info)

Get compute instance information.

nvmlReturn_t nvmlDeviceCreateGpuInstance(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstance_t *gpuInstance)

Create GPU instance.

nvmlReturn_t nvmlDeviceCreateGpuInstanceWithPlacement(nvmlDevice_t device, unsigned int profileId, const nvmlGpuInstancePlacement_t *placement, nvmlGpuInstance_t *gpuInstance)

Create GPU instance with the specified placement.

nvmlReturn_t nvmlDeviceGetComputeInstanceId(nvmlDevice_t device, unsigned int *id)

Get compute instance ID for the given MIG device handle.

nvmlReturn_t nvmlDeviceGetDeviceHandleFromMigDeviceHandle(nvmlDevice_t migDevice, nvmlDevice_t *device)

Get parent device handle from a MIG device handle.

nvmlReturn_t nvmlDeviceGetGpuInstanceById(nvmlDevice_t device, unsigned int id, nvmlGpuInstance_t *gpuInstance)

Get GPU instances for given instance ID.

nvmlReturn_t nvmlDeviceGetGpuInstanceId(nvmlDevice_t device, unsigned int *id)

Get GPU instance ID for the given MIG device handle.

nvmlReturn_t nvmlDeviceGetGpuInstancePossiblePlacements_v2(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstancePlacement_t *placements, unsigned int *count)

Get GPU instance placements.

nvmlReturn_t nvmlDeviceGetGpuInstanceProfileInfo(nvmlDevice_t device, unsigned int profile, nvmlGpuInstanceProfileInfo_t *info)

Get GPU instance profile information.

nvmlReturn_t nvmlDeviceGetGpuInstanceProfileInfoByIdV(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstanceProfileInfo_v2_t *info)

GPU instance profile query function that accepts profile ID, instead of profile name.

nvmlReturn_t nvmlDeviceGetGpuInstanceProfileInfoV(nvmlDevice_t device, unsigned int profile, nvmlGpuInstanceProfileInfo_v2_t *info)

Versioned wrapper around nvmlDeviceGetGpuInstanceProfileInfo that accepts a versioned nvmlGpuInstanceProfileInfo_v2_t or later output structure.

nvmlReturn_t nvmlDeviceGetGpuInstanceRemainingCapacity(nvmlDevice_t device, unsigned int profileId, unsigned int *count)

Get GPU instance profile capacity.

nvmlReturn_t nvmlDeviceGetGpuInstances(nvmlDevice_t device, unsigned int profileId, nvmlGpuInstance_t *gpuInstances, unsigned int *count)

Get GPU instances for given profile ID.

nvmlReturn_t nvmlDeviceGetMaxMigDeviceCount(nvmlDevice_t device, unsigned int *count)

Get the maximum number of MIG devices that can exist under a given parent NVML device.

nvmlReturn_t nvmlDeviceGetMigDeviceHandleByIndex(nvmlDevice_t device, unsigned int index, nvmlDevice_t *migDevice)

Get MIG device handle for the given index under its parent NVML device.

nvmlReturn_t nvmlDeviceGetMigMode(nvmlDevice_t device, unsigned int *currentMode, unsigned int *pendingMode)

Get MIG mode for the device.

nvmlReturn_t nvmlDeviceIsMigDeviceHandle(nvmlDevice_t device, unsigned int *isMigDevice)

Test if the given handle refers to a MIG device.

nvmlReturn_t nvmlDeviceSetMigMode(nvmlDevice_t device, unsigned int mode, nvmlReturn_t *activationStatus)

Set MIG mode for the device.

nvmlReturn_t nvmlGpuInstanceCreateComputeInstance(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstance_t *computeInstance)

Create compute instance.

nvmlReturn_t nvmlGpuInstanceCreateComputeInstanceWithPlacement(nvmlGpuInstance_t gpuInstance, unsigned int profileId, const nvmlComputeInstancePlacement_t *placement, nvmlComputeInstance_t *computeInstance)

Create compute instance with the specified placement.

nvmlReturn_t nvmlGpuInstanceDestroy(nvmlGpuInstance_t gpuInstance)

Destroy GPU instance.

nvmlReturn_t nvmlGpuInstanceGetComputeInstanceById(nvmlGpuInstance_t gpuInstance, unsigned int id, nvmlComputeInstance_t *computeInstance)

Get compute instance for given instance ID.

nvmlReturn_t nvmlGpuInstanceGetComputeInstancePossiblePlacements(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstancePlacement_t *placements, unsigned int *count)

Get compute instance placements.

nvmlReturn_t nvmlGpuInstanceGetComputeInstanceProfileInfo(nvmlGpuInstance_t gpuInstance, unsigned int profile, unsigned int engProfile, nvmlComputeInstanceProfileInfo_t *info)

Get compute instance profile information.

nvmlReturn_t nvmlGpuInstanceGetComputeInstanceProfileInfoV(nvmlGpuInstance_t gpuInstance, unsigned int profile, unsigned int engProfile, nvmlComputeInstanceProfileInfo_v2_t *info)

Versioned wrapper around nvmlGpuInstanceGetComputeInstanceProfileInfo that accepts a versioned nvmlComputeInstanceProfileInfo_v2_t or later output structure.

nvmlReturn_t nvmlGpuInstanceGetComputeInstanceRemainingCapacity(nvmlGpuInstance_t gpuInstance, unsigned int profileId, unsigned int *count)

Get compute instance profile capacity.

nvmlReturn_t nvmlGpuInstanceGetComputeInstances(nvmlGpuInstance_t gpuInstance, unsigned int profileId, nvmlComputeInstance_t *computeInstances, unsigned int *count)

Get compute instances for given profile ID.

nvmlReturn_t nvmlGpuInstanceGetInfo(nvmlGpuInstance_t gpuInstance, nvmlGpuInstanceInfo_t *info)

Get GPU instance information.

Structs#

nvmlComputeInstanceInfo_t

nvmlComputeInstancePlacement_t

nvmlComputeInstanceProfileInfo_t

Compute instance profile information.

nvmlComputeInstanceProfileInfo_v2_t

Compute instance profile information (v2).

nvmlComputeInstanceProfileInfo_v3_t

Compute instance profile information (v3).

nvmlGpuInstanceInfo_t

nvmlGpuInstancePlacement_t

nvmlGpuInstanceProfileInfo_t

GPU instance profile information.

nvmlGpuInstanceProfileInfo_v2_t

GPU instance profile information (v2).

nvmlGpuInstanceProfileInfo_v3_t

GPU instance profile information (v3).

Typedefs#

Macros#

NVML_COMPUTE_INSTANCE_ENGINE_PROFILE_COUNT#

Number of engine profiles.

NVML_COMPUTE_INSTANCE_ENGINE_PROFILE_SHARED#

All the engines except multiprocessors would be shared.

NVML_COMPUTE_INSTANCE_PROFILE_1_SLICE#

Compute instance profiles.

These macros should be passed to nvmlGpuInstanceGetComputeInstanceProfileInfo to retrieve the detailed information about a compute instance such as profile ID, engine counts 1_SLICE compute instance profile.

NVML_COMPUTE_INSTANCE_PROFILE_1_SLICE_REV1#

1_SLICE compute instance profile (rev1).

NVML_COMPUTE_INSTANCE_PROFILE_2_SLICE#

2_SLICE compute instance profile.

NVML_COMPUTE_INSTANCE_PROFILE_3_SLICE#

3_SLICE compute instance profile.

NVML_COMPUTE_INSTANCE_PROFILE_4_SLICE#

4_SLICE compute instance profile.

NVML_COMPUTE_INSTANCE_PROFILE_6_SLICE#

6_SLICE compute instance profile.

NVML_COMPUTE_INSTANCE_PROFILE_7_SLICE#

7_SLICE compute instance profile (perf optimized for host work scheduling).

NVML_COMPUTE_INSTANCE_PROFILE_7_SLICE_NVL#

7_SLICE compute instance profile (perf optimized for multi-GPU use).

NVML_COMPUTE_INSTANCE_PROFILE_8_SLICE#

8_SLICE compute instance profile.

NVML_COMPUTE_INSTANCE_PROFILE_CAPS_GFX#

MIG compute instance profile capability.

Bit field values representing MIG profile capabilities nvmlComputeInstanceProfileInfo_v3_t::capabilities

NVML_COMPUTE_INSTANCE_PROFILE_COUNT#

Number of compute instance profiles.

NVML_DEVICE_MIG_DISABLE#

Disable Multi Instance GPU mode.

Disable Multi Instance GPU mode.

NVML_DEVICE_MIG_ENABLE#

Enable Multi Instance GPU mode.

Enable Multi Instance GPU mode.

NVML_GPU_INSTANCE_PROFILE_1_SLICE#

GPU instance profiles.

These macros should be passed to nvmlDeviceGetGpuInstanceProfileInfo to retrieve the detailed information about a GPU instance such as profile ID, engine counts. 1_SLICE GPU instance profile.

NVML_GPU_INSTANCE_PROFILE_1_SLICE_ALL_ME#

1_SLICE profile with all of GPU Decode, Encoder, JPEG, OFA engines.

NVML_GPU_INSTANCE_PROFILE_1_SLICE_GFX#

1_SLICE gfx capable profile.

NVML_GPU_INSTANCE_PROFILE_1_SLICE_NO_ME#

1_SLICE profile with none of Decode, Encoder, JPEG, OFA engines.

NVML_GPU_INSTANCE_PROFILE_1_SLICE_REV1#

1_SLICE GPU instance profile (rev1).

NVML_GPU_INSTANCE_PROFILE_1_SLICE_REV2#

1_SLICE GPU instance profile (rev2).

NVML_GPU_INSTANCE_PROFILE_2_SLICE#

2_SLICE GPU instance profile.

NVML_GPU_INSTANCE_PROFILE_2_SLICE_ALL_ME#
NVML_GPU_INSTANCE_PROFILE_2_SLICE_GFX#

2_SLICE gfx capable profile.

NVML_GPU_INSTANCE_PROFILE_2_SLICE_NO_ME#

2_SLICE profile with none of Decode, Encoder, JPEG, OFA engines.

NVML_GPU_INSTANCE_PROFILE_2_SLICE_REV1#

2_SLICE GPU instance profile (rev1).

NVML_GPU_INSTANCE_PROFILE_3_SLICE#

3_SLICE GPU instance profile.

NVML_GPU_INSTANCE_PROFILE_3_SLICE_GFX#

3_SLICE gfx + media capable profile.

NVML_GPU_INSTANCE_PROFILE_4_SLICE#

4_SLICE GPU instance profile.

NVML_GPU_INSTANCE_PROFILE_4_SLICE_GFX#

4_SLICE gfx capable profile.

NVML_GPU_INSTANCE_PROFILE_6_SLICE#

6_SLICE GPU instance profile.

NVML_GPU_INSTANCE_PROFILE_7_SLICE#

7_SLICE GPU instance profile.

NVML_GPU_INSTANCE_PROFILE_8_SLICE#

8_SLICE GPU instance profile.

NVML_GPU_INSTANCE_PROFILE_CAPS_GFX#

GFX support.

NVML_GPU_INSTANCE_PROFILE_CAPS_P2P#

MIG GPU instance profile capability.

Bit field values representing MIG profile capabilities nvmlGpuInstanceProfileInfo_v3_t::capabilities Peer-to-Peer support.

NVML_GPU_INSTANCE_PROFILE_COUNT#

Total number of GPU instance profiles.

NVML_GPU_INTSTANCE_PROFILE_CAPS_P2P#

Deprecated, do not use.

nvmlComputeInstanceProfileInfo_v2#

Version identifier value for nvmlComputeInstanceProfileInfo_v2_t::version.

nvmlComputeInstanceProfileInfo_v3#

Version identifier value for nvmlComputeInstanceProfileInfo_v3_t::version.

nvmlGpuInstanceProfileInfo_v2#

Version identifier value for nvmlGpuInstanceProfileInfo_v2_t::version.

nvmlGpuInstanceProfileInfo_v3#

Version identifier value for nvmlGpuInstanceProfileInfo_v3_t::version.

Functions#

nvmlReturn_t nvmlComputeInstanceDestroy(
nvmlComputeInstance_t computeInstance,
)#

Destroy compute instance.

For Ampere or newer fully supported devices. Supported on Linux only. Requires privileged user.

Parameters:

computeInstance – The compute instance handle

Returns:

nvmlReturn_t nvmlComputeInstanceGetInfo_v2(
nvmlComputeInstance_t computeInstance,
nvmlComputeInstanceInfo_t *info,
)#

Get compute instance information.

For Ampere or newer fully supported devices. Supported on Linux only.

Parameters:
  • computeInstance – The compute instance handle

  • info – Return compute instance information

Returns:

nvmlReturn_t nvmlDeviceCreateGpuInstance(
nvmlDevice_t device,
unsigned int profileId,
nvmlGpuInstance_t *gpuInstance,
)#

Create GPU instance.

For Ampere or newer fully supported devices. Supported on Linux only. Requires privileged user.

If the parent device is unbound, reset or the GPU instance is destroyed explicitly, the GPU instance handle would become invalid. The GPU instance must be recreated to acquire a valid handle.

Parameters:
  • device – The identifier of the target device

  • profileId – The GPU instance profile ID. See nvmlDeviceGetGpuInstanceProfileInfo

  • gpuInstance – Returns the GPU instance handle

Returns:

nvmlReturn_t nvmlDeviceCreateGpuInstanceWithPlacement(
nvmlDevice_t device,
unsigned int profileId,
const nvmlGpuInstancePlacement_t *placement,
nvmlGpuInstance_t *gpuInstance,
)#

Create GPU instance with the specified placement.

For Ampere or newer fully supported devices. Supported on Linux only. Requires privileged user.

If the parent device is unbound, reset or the GPU instance is destroyed explicitly, the GPU instance handle would become invalid. The GPU instance must be recreated to acquire a valid handle.

Parameters:
Returns:

nvmlReturn_t nvmlDeviceGetComputeInstanceId(
nvmlDevice_t device,
unsigned int *id,
)#

Get compute instance ID for the given MIG device handle.

Compute instance IDs are unique per GPU instance and remain valid until the compute instance is destroyed.

For Ampere or newer fully supported devices. Supported on Linux only.

Parameters:
  • device – Target MIG device handle

  • id – Compute instance ID

Returns:

nvmlReturn_t nvmlDeviceGetDeviceHandleFromMigDeviceHandle(
nvmlDevice_t migDevice,
nvmlDevice_t *device,
)#

Get parent device handle from a MIG device handle.

For Ampere or newer fully supported devices. Supported on Linux only.

Parameters:
  • migDevice – MIG device handle

  • device – Device handle

Returns:

nvmlReturn_t nvmlDeviceGetGpuInstanceById(
nvmlDevice_t device,
unsigned int id,
nvmlGpuInstance_t *gpuInstance,
)#

Get GPU instances for given instance ID.

For Ampere or newer fully supported devices. Supported on Linux only. Requires privileged user.

Parameters:
  • device – The identifier of the target device

  • id – The GPU instance ID

  • gpuInstance – Returns GPU instance

Returns:

nvmlReturn_t nvmlDeviceGetGpuInstanceId(
nvmlDevice_t device,
unsigned int *id,
)#

Get GPU instance ID for the given MIG device handle.

GPU instance IDs are unique per device and remain valid until the GPU instance is destroyed.

For Ampere or newer fully supported devices. Supported on Linux only.

Parameters:
  • device – Target MIG device handle

  • id – GPU instance ID

Returns:

nvmlReturn_t nvmlDeviceGetGpuInstancePossiblePlacements_v2(
nvmlDevice_t device,
unsigned int profileId,
nvmlGpuInstancePlacement_t *placements,
unsigned int *count,
)#

Get GPU instance placements.

A placement represents the location of a GPU instance within a device. This API only returns all the possible placements for the given profile regardless of whether MIG is enabled or not. A created GPU instance occupies memory slices described by its placement. Creation of new GPU instance will fail if there is overlap with the already occupied memory slices.

For Ampere or newer fully supported devices. Supported on Linux only. Requires privileged user.

Parameters:
  • device – The identifier of the target device

  • profileId – The GPU instance profile ID. See nvmlDeviceGetGpuInstanceProfileInfo

  • placements – Returns placements allowed for the profile. Can be NULL to discover number of allowed placements for this profile. If non-NULL must be large enough to accommodate the placements supported by the profile.

  • count – Returns number of allowed placemenets for the profile.

Returns:

nvmlReturn_t nvmlDeviceGetGpuInstanceProfileInfo(
nvmlDevice_t device,
unsigned int profile,
nvmlGpuInstanceProfileInfo_t *info,
)#

Get GPU instance profile information.

Information provided by this API is immutable throughout the lifetime of a MIG mode.

For Ampere or newer fully supported devices. Supported on Linux only.

Note

This API can be used to enumerate all MIG profiles supported by NVML in a forward compatible way by invoking it on profile values starting from 0, until the API returns NVML_ERROR_INVALID_ARGUMENT.

Parameters:
  • device – The identifier of the target device

  • profile – One of the NVML_GPU_INSTANCE_PROFILE_*

  • info – Returns detailed profile information

Returns:

nvmlReturn_t nvmlDeviceGetGpuInstanceProfileInfoByIdV(
nvmlDevice_t device,
unsigned int profileId,
nvmlGpuInstanceProfileInfo_v2_t *info,
)#

GPU instance profile query function that accepts profile ID, instead of profile name.

It accepts a versioned nvmlGpuInstanceProfileInfo_v2_t or later output structure.

For Ampere or newer fully supported devices. Supported on Linux only.

Note

The caller must set the nvmlGpuInstanceProfileInfo_v2_t::version field to the appropriate version prior to calling this function. For example:

nvmlGpuInstanceProfileInfo_v2_t profileInfo =
    { .version = nvmlGpuInstanceProfileInfo_v2 };
nvmlReturn_t result = nvmlDeviceGetGpuInstanceProfileInfoV(device,
                                                           profile,
                                                           &profileInfo);

Parameters:
  • device – The identifier of the target device

  • profileId – One of the profile IDs.

  • info – Returns detailed profile information

Returns:

nvmlReturn_t nvmlDeviceGetGpuInstanceProfileInfoV(
nvmlDevice_t device,
unsigned int profile,
nvmlGpuInstanceProfileInfo_v2_t *info,
)#

Versioned wrapper around nvmlDeviceGetGpuInstanceProfileInfo that accepts a versioned nvmlGpuInstanceProfileInfo_v2_t or later output structure.

For Ampere or newer fully supported devices. Supported on Linux only.

Note

The caller must set the nvmlGpuInstanceProfileInfo_v2_t::version field to the appropriate version prior to calling this function. For example:

nvmlGpuInstanceProfileInfo_v2_t profileInfo =
    { .version = nvmlGpuInstanceProfileInfo_v2 };
nvmlReturn_t result = nvmlDeviceGetGpuInstanceProfileInfoV(device,
                                                           profile,
                                                           &profileInfo);

Parameters:
  • device – The identifier of the target device

  • profile – One of the NVML_GPU_INSTANCE_PROFILE_*

  • info – Returns detailed profile information

Returns:

nvmlReturn_t nvmlDeviceGetGpuInstanceRemainingCapacity(
nvmlDevice_t device,
unsigned int profileId,
unsigned int *count,
)#

Get GPU instance profile capacity.

For Ampere or newer fully supported devices. Supported on Linux only. Requires privileged user.

Parameters:
  • device – The identifier of the target device

  • profileId – The GPU instance profile ID. See nvmlDeviceGetGpuInstanceProfileInfo

  • count – Returns remaining instance count for the profile ID

Returns:

nvmlReturn_t nvmlDeviceGetGpuInstances(
nvmlDevice_t device,
unsigned int profileId,
nvmlGpuInstance_t *gpuInstances,
unsigned int *count,
)#

Get GPU instances for given profile ID.

For Ampere or newer fully supported devices. Supported on Linux only. Requires privileged user.

Parameters:
  • device – The identifier of the target device

  • profileId – The GPU instance profile ID. See nvmlDeviceGetGpuInstanceProfileInfo

  • gpuInstances – Returns pre-exiting GPU instances, the buffer must be large enough to accommodate the instances supported by the profile. See nvmlDeviceGetGpuInstanceProfileInfo

  • count – The count of returned GPU instances

Returns:

nvmlReturn_t nvmlDeviceGetMaxMigDeviceCount(
nvmlDevice_t device,
unsigned int *count,
)#

Get the maximum number of MIG devices that can exist under a given parent NVML device.

Returns zero if MIG is not supported or enabled.

For Ampere or newer fully supported devices. Supported on Linux only.

Parameters:
  • device – Target device handle

  • count – Count of MIG devices

Returns:

nvmlReturn_t nvmlDeviceGetMigDeviceHandleByIndex(
nvmlDevice_t device,
unsigned int index,
nvmlDevice_t *migDevice,
)#

Get MIG device handle for the given index under its parent NVML device.

If the compute instance is destroyed either explicitly or by destroying, resetting or unbinding the parent GPU instance or the GPU device itself the MIG device handle would remain invalid and must be requested again using this API. Handles may be reused and their properties can change in the process.

For Ampere or newer fully supported devices. Supported on Linux only.

Parameters:
  • device – Reference to the parent GPU device handle

  • index – Index of the MIG device

  • migDevice – Reference to the MIG device handle

Returns:

nvmlReturn_t nvmlDeviceGetMigMode(
nvmlDevice_t device,
unsigned int *currentMode,
unsigned int *pendingMode,
)#

Get MIG mode for the device.

For Ampere or newer fully supported devices.

Changing MIG modes may require device unbind or reset. The “pending” MIG mode refers to the target mode following the next activation trigger.

Parameters:
Returns:

nvmlReturn_t nvmlDeviceIsMigDeviceHandle(
nvmlDevice_t device,
unsigned int *isMigDevice,
)#

Test if the given handle refers to a MIG device.

A MIG device handle is an NVML abstraction which maps to a MIG compute instance. These overloaded references can be used (with some restrictions) interchangeably with a GPU device handle to execute queries at a per-compute instance granularity.

For Ampere or newer fully supported devices. Supported on Linux only.

Parameters:
  • device – NVML handle to test

  • isMigDevice – True when handle refers to a MIG device

Returns:

nvmlReturn_t nvmlDeviceSetMigMode(
nvmlDevice_t device,
unsigned int mode,
nvmlReturn_t *activationStatus,
)#

Set MIG mode for the device.

For Ampere or newer fully supported devices. Requires root user.

This mode determines whether a GPU instance can be created.

This API may unbind or reset the device to activate the requested mode. Thus, the attributes associated with the device, such as minor number, might change. The caller of this API is expected to query such attributes again.

On certain platforms like pass-through virtualization, where reset functionality may not be exposed directly, VM reboot is required. activationStatus would return NVML_ERROR_RESET_REQUIRED for such cases.

activationStatus would return the appropriate error code upon unsuccessful activation. For example, if device unbind fails because the device isn’t idle, NVML_ERROR_IN_USE would be returned. The caller of this API is expected to idle the device and retry setting the mode.

Note

On Windows, only disabling MIG mode is supported. activationStatus would return NVML_ERROR_NOT_SUPPORTED as GPU reset is not supported on Windows through this API.

Parameters:
Returns:

nvmlReturn_t nvmlGpuInstanceCreateComputeInstance(
nvmlGpuInstance_t gpuInstance,
unsigned int profileId,
nvmlComputeInstance_t *computeInstance,
)#

Create compute instance.

For Ampere or newer fully supported devices. Supported on Linux only. Requires privileged user.

If the parent device is unbound, reset or the parent GPU instance is destroyed or the compute instance is destroyed explicitly, the compute instance handle would become invalid. The compute instance must be recreated to acquire a valid handle.

Parameters:
Returns:

nvmlReturn_t nvmlGpuInstanceCreateComputeInstanceWithPlacement(
nvmlGpuInstance_t gpuInstance,
unsigned int profileId,
const nvmlComputeInstancePlacement_t *placement,
nvmlComputeInstance_t *computeInstance,
)#

Create compute instance with the specified placement.

For Ampere or newer fully supported devices. Supported on Linux only. Requires privileged user.

If the parent device is unbound, reset or the parent GPU instance is destroyed or the compute instance is destroyed explicitly, the compute instance handle would become invalid. The compute instance must be recreated to acquire a valid handle.

Parameters:
Returns:

nvmlReturn_t nvmlGpuInstanceDestroy(nvmlGpuInstance_t gpuInstance)#

Destroy GPU instance.

For Ampere or newer fully supported devices. Supported on Linux only. Requires privileged user.

Parameters:

gpuInstance – The GPU instance handle

Returns:

nvmlReturn_t nvmlGpuInstanceGetComputeInstanceById(
nvmlGpuInstance_t gpuInstance,
unsigned int id,
nvmlComputeInstance_t *computeInstance,
)#

Get compute instance for given instance ID.

For Ampere or newer fully supported devices. Supported on Linux only. Requires privileged user.

Parameters:
  • gpuInstance – The identifier of the target GPU instance

  • id – The compute instance ID

  • computeInstance – Returns compute instance

Returns:

nvmlReturn_t nvmlGpuInstanceGetComputeInstancePossiblePlacements(
nvmlGpuInstance_t gpuInstance,
unsigned int profileId,
nvmlComputeInstancePlacement_t *placements,
unsigned int *count,
)#

Get compute instance placements.

For Ampere or newer fully supported devices. Supported on Linux only. Requires privileged user.

A placement represents the location of a compute instance within a GPU instance. This API only returns all the possible placements for the given profile. A created compute instance occupies compute slices described by its placement. Creation of new compute instance will fail if there is overlap with the already occupied compute slices.

Parameters:
  • gpuInstance – The identifier of the target GPU instance

  • profileId – The compute instance profile ID. See nvmlGpuInstanceGetComputeInstanceProfileInfo

  • placements – Returns placements allowed for the profile. Can be NULL to discover number of allowed placements for this profile. If non-NULL must be large enough to accommodate the placements supported by the profile.

  • count – Returns number of allowed placemenets for the profile.

Returns:

nvmlReturn_t nvmlGpuInstanceGetComputeInstanceProfileInfo(
nvmlGpuInstance_t gpuInstance,
unsigned int profile,
unsigned int engProfile,
nvmlComputeInstanceProfileInfo_t *info,
)#

Get compute instance profile information.

Information provided by this API is immutable throughout the lifetime of a MIG mode.

For Ampere or newer fully supported devices. Supported on Linux only.

Note

This API can be used to enumerate all MIG profiles supported by NVML in a forward compatible way by invoking it on profile values starting from 0, until the API returns NVML_ERROR_INVALID_ARGUMENT.

Parameters:
  • gpuInstance – The identifier of the target GPU instance

  • profile – One of the NVML_COMPUTE_INSTANCE_PROFILE_*

  • engProfile – One of the NVML_COMPUTE_INSTANCE_ENGINE_PROFILE_*

  • info – Returns detailed profile information

Returns:

nvmlReturn_t nvmlGpuInstanceGetComputeInstanceProfileInfoV(
nvmlGpuInstance_t gpuInstance,
unsigned int profile,
unsigned int engProfile,
nvmlComputeInstanceProfileInfo_v2_t *info,
)#

Versioned wrapper around nvmlGpuInstanceGetComputeInstanceProfileInfo that accepts a versioned nvmlComputeInstanceProfileInfo_v2_t or later output structure.

For Ampere or newer fully supported devices. Supported on Linux only.

Note

The caller must set the nvmlGpuInstanceProfileInfo_v2_t::version field to the appropriate version prior to calling this function. For example:

nvmlComputeInstanceProfileInfo_v2_t profileInfo =
    { .version = nvmlComputeInstanceProfileInfo_v2 };
nvmlReturn_t result = nvmlGpuInstanceGetComputeInstanceProfileInfoV(gpuInstance,
                                                                    profile,
                                                                    engProfile,
                                                                    &profileInfo);

Parameters:
  • gpuInstance – The identifier of the target GPU instance

  • profile – One of the NVML_COMPUTE_INSTANCE_PROFILE_*

  • engProfile – One of the NVML_COMPUTE_INSTANCE_ENGINE_PROFILE_*

  • info – Returns detailed profile information

Returns:

nvmlReturn_t nvmlGpuInstanceGetComputeInstanceRemainingCapacity(
nvmlGpuInstance_t gpuInstance,
unsigned int profileId,
unsigned int *count,
)#

Get compute instance profile capacity.

For Ampere or newer fully supported devices. Supported on Linux only. Requires privileged user.

Parameters:
Returns:

nvmlReturn_t nvmlGpuInstanceGetComputeInstances(
nvmlGpuInstance_t gpuInstance,
unsigned int profileId,
nvmlComputeInstance_t *computeInstances,
unsigned int *count,
)#

Get compute instances for given profile ID.

For Ampere or newer fully supported devices. Supported on Linux only. Requires privileged user.

Parameters:
Returns:

nvmlReturn_t nvmlGpuInstanceGetInfo(
nvmlGpuInstance_t gpuInstance,
nvmlGpuInstanceInfo_t *info,
)#

Get GPU instance information.

For Ampere or newer fully supported devices. Supported on Linux only.

Parameters:
  • gpuInstance – The GPU instance handle

  • info – Return GPU instance information

Returns:

Typedefs#

typedef struct nvmlComputeInstance_st *nvmlComputeInstance_t#