cuda.bindings.nvml.device_get_process_utilization#
- cuda.bindings.nvml.device_get_process_utilization(
- intptr_t device,
- unsigned long long last_seen_time_stamp,
Retrieves the current utilization and process ID.
For Maxwell ™️ or newer fully supported devices. Reads recent utilization of GPU SM (3D/Compute), framebuffer, video encoder, and video decoder for processes running. Utilization values are returned as an array of utilization sample structures in the caller-supplied buffer pointed at by
utilization. One utilization sample structure is returned per process running, that had some non-zero utilization during the last sample period. It includes the CPU timestamp at which the samples were recorded. Individual utilization values are returned as “unsigned int” values. If no valid sample entries are found since the last_seen_time_stamp, NVML_ERROR_NOT_FOUND is returned. To read utilization values, first determine the size of buffer required to hold the samples by invoking the function withutilizationset to NULL. The caller should allocate a buffer of size process_samples_count * sizeof(nvmlProcessUtilizationSample_t). Invoke the function again with the allocated buffer passed inutilization, andprocess_samples_countset to the number of entries the buffer is sized for. On successful return, the function updatesprocess_samples_countwith the number of process utilization sample structures that were actually written. This may differ from a previously read value as instances are created or destroyed. last_seen_time_stamp represents the CPU timestamp in microseconds at which utilization samples were last read. Set it to 0 to read utilization based on all the samples maintained by the driver’s internal sample buffer. Set last_seen_time_stamp to a timeStamp retrieved from a previous query to read utilization since the previous query.- Parameters:
device (intptr_t) – The identifier of the target device.
last_seen_time_stamp (unsigned long long) – Return only samples with timestamp greater than last_seen_time_stamp.
- Returns:
- Pointer to caller-supplied buffer
in which guest process utilization samples are returned.
- Return type:
nvmlProcessUtilizationSample_t
Note
On MIG-enabled GPUs, querying process utilization is not currently supported.
See also
nvmlDeviceGetProcessUtilization