cuda.bindings.nvml.device_get_samples#
- cuda.bindings.nvml.device_get_samples(
- intptr_t device,
- int type,
- unsigned long long last_seen_time_stamp,
Gets recent samples for the GPU.
For Kepler ™️ or newer fully supported devices. Based on type, this method can be used to fetch the power, utilization or clock samples maintained in the buffer by the driver. Power, Utilization and Clock samples are returned as type “unsigned int” for the union
nvmlValue_t. To get the size of samples that user needs to allocate, the method is invoked with samples set to NULL. The returned samplesCount will provide the number of samples that can be queried. The user needs to allocate the buffer with size as samplesCount * sizeof(nvmlSample_t). last_seen_time_stamp represents CPU timestamp in microseconds. Set it to 0 to fetch all the samples maintained by the underlying buffer. Set last_seen_time_stamp to one of the timeStamps retrieved from the date of the previous query to get more recent samples. This method fetches the number of entries which can be accommodated in the provided samples array, and the reference samplesCount is updated to indicate how many samples were actually retrieved. The advantage of using this method for samples in contrast to polling via existing methods is to get get higher frequency data at lower polling cost.- Parameters:
device (intptr_t) – The identifier for the target device.
type (SamplingType) – Type of sampling event.
last_seen_time_stamp (unsigned long long) – Return only samples with timestamp greater than last_seen_time_stamp.
- Returns:
- int: Output parameter to represent the type of sample value as
described in nvmlSampleVal_t.
nvmlSample_t: Reference in which samples are returned.
- Return type:
A 2-tuple containing
Note
On MIG-enabled GPUs, querying the following sample types, NVML_GPU_UTILIZATION_SAMPLES, NVML_MEMORY_UTILIZATION_SAMPLES NVML_ENC_UTILIZATION_SAMPLES and NVML_DEC_UTILIZATION_SAMPLES, is not currently supported.
See also
nvmlDeviceGetSamples