Unverified Commit 837379a9 authored by Daniel Hiltgen's avatar Daniel Hiltgen Committed by GitHub
Browse files

discovery: fix cudart driver version (#11614)

We prefer the nvcuda library, which reports driver versions. When we
dropped cuda v11, we added a safety check for too-old drivers.  What
we missed was the cudart fallback discovery logic didn't have driver
version wired up.  This fixes cudart discovery to expose the driver
version as well so we no longer reject all GPUs if nvcuda didn't work.
parent a24f9060
...@@ -263,6 +263,8 @@ func GetGPUInfo() GpuInfoList { ...@@ -263,6 +263,8 @@ func GetGPUInfo() GpuInfoList {
var driverMinor int var driverMinor int
if cHandles.cudart != nil { if cHandles.cudart != nil {
C.cudart_bootstrap(*cHandles.cudart, C.int(i), &memInfo) C.cudart_bootstrap(*cHandles.cudart, C.int(i), &memInfo)
driverMajor = int(cHandles.cudart.driver_major)
driverMinor = int(cHandles.cudart.driver_minor)
} else { } else {
C.nvcuda_bootstrap(*cHandles.nvcuda, C.int(i), &memInfo) C.nvcuda_bootstrap(*cHandles.nvcuda, C.int(i), &memInfo)
driverMajor = int(cHandles.nvcuda.driver_major) driverMajor = int(cHandles.nvcuda.driver_major)
......
...@@ -69,18 +69,15 @@ void cudart_init(char *cudart_lib_path, cudart_init_resp_t *resp) { ...@@ -69,18 +69,15 @@ void cudart_init(char *cudart_lib_path, cudart_init_resp_t *resp) {
} }
int version = 0; int version = 0;
cudartDriverVersion_t driverVersion;
driverVersion.major = 0;
driverVersion.minor = 0;
// Report driver version if we're in verbose mode, ignore errors // Report driver version if we're in verbose mode, ignore errors
ret = (*resp->ch.cudaDriverGetVersion)(&version); ret = (*resp->ch.cudaDriverGetVersion)(&version);
if (ret != CUDART_SUCCESS) { if (ret != CUDART_SUCCESS) {
LOG(resp->ch.verbose, "cudaDriverGetVersion failed: %d\n", ret); LOG(resp->ch.verbose, "cudaDriverGetVersion failed: %d\n", ret);
} else { } else {
driverVersion.major = version / 1000; resp->ch.driver_major = version / 1000;
driverVersion.minor = (version - (driverVersion.major * 1000)) / 10; resp->ch.driver_minor = (version - (resp->ch.driver_major * 1000)) / 10;
LOG(resp->ch.verbose, "CUDA driver version: %d-%d\n", driverVersion.major, driverVersion.minor); LOG(resp->ch.verbose, "CUDA driver version: %d-%d\n", resp->ch.driver_major, resp->ch.driver_minor);
} }
ret = (*resp->ch.cudaGetDeviceCount)(&resp->num_devices); ret = (*resp->ch.cudaGetDeviceCount)(&resp->num_devices);
......
...@@ -29,11 +29,6 @@ typedef struct cudartMemory_st { ...@@ -29,11 +29,6 @@ typedef struct cudartMemory_st {
size_t used; size_t used;
} cudartMemory_t; } cudartMemory_t;
typedef struct cudartDriverVersion {
int major;
int minor;
} cudartDriverVersion_t;
typedef struct cudaUUID { typedef struct cudaUUID {
unsigned char bytes[16]; unsigned char bytes[16];
} cudaUUID_t; } cudaUUID_t;
...@@ -123,6 +118,8 @@ typedef struct cudaDeviceProp { ...@@ -123,6 +118,8 @@ typedef struct cudaDeviceProp {
typedef struct cudart_handle { typedef struct cudart_handle {
void *handle; void *handle;
uint16_t verbose; uint16_t verbose;
int driver_major;
int driver_minor;
cudartReturn_t (*cudaSetDevice)(int device); cudartReturn_t (*cudaSetDevice)(int device);
cudartReturn_t (*cudaDeviceSynchronize)(void); cudartReturn_t (*cudaDeviceSynchronize)(void);
cudartReturn_t (*cudaDeviceReset)(void); cudartReturn_t (*cudaDeviceReset)(void);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment