cuda.bindings.nvml.device_get_vgpu_utilization#
- cuda.bindings.nvml.device_get_vgpu_utilization(
- intptr_t device,
- unsigned long long last_seen_time_stamp,
Retrieves current utilization for vGPUs on a physical GPU (device).
For Kepler ™️ or newer fully supported devices. Reads recent utilization of GPU SM (3D/Compute), framebuffer, video encoder, and video decoder for vGPU instances running on a device. Utilization values are returned as an array of utilization sample structures in the caller- supplied buffer pointed at by
utilization_samples. One utilization sample structure is returned per vGPU instance, and includes the CPU timestamp at which the samples were recorded. Individual utilization values are returned as “unsigned int” values innvmlValue_tunions. The function sets the caller- suppliedsample_val_typeto NVML_VALUE_TYPE_UNSIGNED_INT to indicate the returned value type. To read utilization values, first determine the size of buffer required to hold the samples by invoking the function withutilization_samplesset to NULL. The function will return NVML_ERROR_INSUFFICIENT_SIZE, with the current vGPU instance count invgpu_instance_samples_count, or NVML_SUCCESS if the current vGPU instance count is zero. The caller should allocate a buffer of size vgpu_instance_samples_count * sizeof(nvmlVgpuInstanceUtilizationSample_t). Invoke the function again with the allocated buffer passed inutilization_samples, andvgpu_instance_samples_countset to the number of entries the buffer is sized for. On successful return, the function updatesvgpuInstanceSampleCountwith the number of vGPU utilization sample structures that were actually written. This may differ from a previously read value as vGPU 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 for the target device.
last_seen_time_stamp (unsigned long long) – Return only samples with timestamp greater than last_seen_time_stamp.
- Returns:
- int: Pointer to caller-supplied buffer to hold the type of
returned sample values.
- nvmlVgpuInstanceUtilizationSample_t: Pointer to caller-supplied
buffer in which vGPU utilization samples are returned.
- Return type:
A 2-tuple containing
See also
nvmlDeviceGetVgpuUtilization