GPM Functions#

Functions#

nvmlReturn_t nvmlGpmMetricsGet(nvmlGpmMetricsGet_t *metricsGet)

Calculate GPM metrics from two samples.

nvmlReturn_t nvmlGpmMigSampleGet(nvmlDevice_t device, unsigned int gpuInstanceId, nvmlGpmSample_t gpmSample)

Read a sample of GPM metrics into the provided gpmSample buffer for a MIG GPU Instance.

nvmlReturn_t nvmlGpmQueryDeviceSupport(nvmlDevice_t device, nvmlGpmSupport_t *gpmSupport)

Indicate whether the supplied device supports GPM.

nvmlReturn_t nvmlGpmQueryIfStreamingEnabled(nvmlDevice_t device, unsigned int *state)

Get GPM stream state.

nvmlReturn_t nvmlGpmSampleAlloc(nvmlGpmSample_t *gpmSample)

Allocate a sample buffer to be used with NVML GPM .

nvmlReturn_t nvmlGpmSampleFree(nvmlGpmSample_t gpmSample)

Free an allocated sample buffer that was allocated with nvmlGpmSampleAlloc()

nvmlReturn_t nvmlGpmSampleGet(nvmlDevice_t device, nvmlGpmSample_t gpmSample)

Read a sample of GPM metrics into the provided gpmSample buffer.

nvmlReturn_t nvmlGpmSetStreamingEnabled(nvmlDevice_t device, unsigned int state)

Set GPM stream state.

Functions#

nvmlReturn_t nvmlGpmMetricsGet(nvmlGpmMetricsGet_t *metricsGet)#

Calculate GPM metrics from two samples.

For Hopper or newer fully supported devices.

To retrieve metrics, the user must first allocate the two sample buffers at metricsGet->sample1 and metricsGet->sample2 by calling nvmlGpmSampleAlloc(). Next, the user should fill in the ID of each metric in metricsGet->metrics[i].metricId and specify the total number of metrics to retrieve in metricsGet->numMetrics, The version should be set to NVML_GPM_METRICS_GET_VERSION in metricsGet->version. The user then calls the nvmlGpmSampleGet() API twice to obtain 2 samples of counters.

Note

The interval between these two nvmlGpmSampleGet() calls should be greater than 100ms due to the internal sample refresh rate. Finally, the user calls nvmlGpmMetricsGet to retrieve the metrics, which will be stored at metricsGet->metrics

Parameters:

metricsGet – IN/OUT: populated nvmlGpmMetricsGet_t struct

Returns:

  • NVML_SUCCESS on success

  • Nonzero NVML_ERROR_? enum on error

nvmlReturn_t nvmlGpmMigSampleGet(
nvmlDevice_t device,
unsigned int gpuInstanceId,
nvmlGpmSample_t gpmSample,
)#

Read a sample of GPM metrics into the provided gpmSample buffer for a MIG GPU Instance.

After two samples are gathered, you can call nvmlGpmMetricGet on those samples to retrive metrics

For Hopper or newer fully supported devices.

Note

The interval between two nvmlGpmMigSampleGet() calls should be greater than 100ms due to the internal sample refresh rate.

Parameters:
  • device – Device to get samples for

  • gpuInstanceId – MIG GPU Instance ID

  • gpmSample – Buffer to read samples into

Returns:

  • NVML_SUCCESS on success

  • Nonzero NVML_ERROR_? enum on error

nvmlReturn_t nvmlGpmQueryDeviceSupport(
nvmlDevice_t device,
nvmlGpmSupport_t *gpmSupport,
)#

Indicate whether the supplied device supports GPM.

For Hopper or newer fully supported devices.

Note

This API supports the device handle and MIG device handle.

Parameters:
  • device – The device handle or MIG device handle to query for

  • gpmSupport – Structure to indicate GPM support nvmlGpmSupport_t. Indicates GPM support per system for the supplied device

Returns:

  • NVML_SUCCESS on success

  • Nonzero NVML_ERROR_? enum if there is an error in processing the query

nvmlReturn_t nvmlGpmQueryIfStreamingEnabled(
nvmlDevice_t device,
unsigned int *state,
)#

Get GPM stream state.

For Hopper or newer fully supported devices. Supported on Linux, Windows TCC.

Parameters:
  • device – The identifier of the target device

  • state – Returns GPM stream state NVML_FEATURE_DISABLED or NVML_FEATURE_ENABLED

Returns:

nvmlReturn_t nvmlGpmSampleAlloc(nvmlGpmSample_t *gpmSample)#

Allocate a sample buffer to be used with NVML GPM .

You will need to allocate at least two of these buffers to use with the NVML GPM feature

For Hopper or newer fully supported devices.

Parameters:

gpmSample – Where the allocated sample will be stored

Returns:

nvmlReturn_t nvmlGpmSampleFree(nvmlGpmSample_t gpmSample)#

Free an allocated sample buffer that was allocated with nvmlGpmSampleAlloc()

For Hopper or newer fully supported devices.

Parameters:

gpmSample – Sample to free

Returns:

nvmlReturn_t nvmlGpmSampleGet(
nvmlDevice_t device,
nvmlGpmSample_t gpmSample,
)#

Read a sample of GPM metrics into the provided gpmSample buffer.

After two samples are gathered, you can call nvmlGpmMetricGet on those samples to retrive metrics

For Hopper or newer fully supported devices.

Note

The interval between two nvmlGpmSampleGet() calls should be greater than 100ms due to the internal sample refresh rate.

Note

This API supports the device handle and MIG device handle.

Parameters:
  • device – The device handle or MIG device handle to get samples for

  • gpmSample – Buffer to read samples into

Returns:

  • NVML_SUCCESS on success

  • Nonzero NVML_ERROR_? enum on error

nvmlReturn_t nvmlGpmSetStreamingEnabled(
nvmlDevice_t device,
unsigned int state,
)#

Set GPM stream state.

For Hopper or newer fully supported devices. Supported on Linux, Windows TCC.

Parameters:
  • device – The identifier of the target device

  • state – GPM stream state, NVML_FEATURE_DISABLED or NVML_FEATURE_ENABLED

Returns: