cudaversioncuda-driver

How do I obtain the _actual_ CUDA driver version?


How do I programmatically get the actual CUDA driver version (e.g. 470.57.02, not 11.4 like the corresponding CUDA version nor 11040)? We know that it's not cudaDriverGetVersion()...


Solution

  • You can get it as a string using NVML's nvmlSystemGetDriverVersion() function:

    char version_str[NVML_DEVICE_PART_NUMBER_BUFFER_SIZE+1];
    retval = nvmlSystemGetDriverVersion(version_str,
       NVML_DEVICE_PART_NUMBER_BUFFER_SIZE);
    if (retval != NVML_SUCCESS) {
        fprintf(stderr, "%s\n",nvmlErrorString(retval));
        return 1;
    }
    
    printf("Driver version: %s\n", version_str);
    

    This will result in something like:

    Driver version: 470.57.02