Skip to content

Commit 3ffe48b

Browse files
againullKornevNikita
authored andcommitted
[UR][CUDA] Use different throttle reasons API based on CUDA version (#17719)
Our pre-commit CI uses CUDA 12.6 but nightly uses CUDA 12.1, it turns out nvml which is part of CUDA 12.6 has nvmlDeviceGetCurrentClocksEventReasons API, but nvml which is part of CUDA 12.1 doesn't have it, but only supports older deprecated nvmlDeviceGetCurrentClocksThrottleReasons. NVML doesn't provide a version macro to check the support for that API, so use new API nvmlDeviceGetCurrentClocksEventReasons based on cuda version.
1 parent 04be150 commit 3ffe48b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

unified-runtime/source/adapters/cuda/device.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,8 +1089,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
10891089
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
10901090
case UR_DEVICE_INFO_CURRENT_CLOCK_THROTTLE_REASONS: {
10911091
unsigned long long ClocksEventReasons;
1092+
#if (CUDA_VERSION >= 12060)
10921093
UR_CHECK_ERROR(nvmlDeviceGetCurrentClocksEventReasons(hDevice->getNVML(),
10931094
&ClocksEventReasons));
1095+
#else
1096+
UR_CHECK_ERROR(nvmlDeviceGetCurrentClocksThrottleReasons(
1097+
hDevice->getNVML(), &ClocksEventReasons));
1098+
#endif
10941099
ur_device_throttle_reasons_flags_t ThrottleReasons = 0;
10951100
constexpr unsigned long long NVMLThrottleFlags[] = {
10961101
nvmlClocksThrottleReasonSwPowerCap,

0 commit comments

Comments
 (0)