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()
...
Asked
Active
Viewed 397 times
2

einpoklum
- 118,144
- 57
- 340
- 684
-
Dare one ask why? – talonmies Dec 10 '21 at 09:34
-
@talonmies: Mulling over whether or not to use it in some error messages in my API wrappers library. – einpoklum Dec 10 '21 at 09:36
-
But again, why? Different platforms have different version numbering conventions and don’t correlate for a given level of driver or runtime API support. So it is pretty meaningless – talonmies Dec 10 '21 at 09:40
-
It [looks like](https://www.nvidia.com/Download/index.aspx?lang=en-us) the driver numbering scheme is pretty uniform... or am I missing something? – einpoklum Dec 10 '21 at 09:43
-
Linux and windows numbering are different. Check the release notes for each CUDA version if you don’t believe me – talonmies Dec 10 '21 at 09:48
-
@talonmies: Ah, I see what you mean. That doesn't actually bother me. That is, on Windows, you might get a message saying "driver version X.Y.Z (compatible with CUDA A.B) doesn't support doing foo". But I'm not sure it's worth the trouble anyway. By the way, you never have said what you think about my whole API-wrapping initiative, irrespective of some minor specific point like this one. – einpoklum Dec 10 '21 at 10:09
-
@talonmies: FYI, I decided not to have my wrappers depend on NVML, so I gave up the idea of having this error message for the time being. – einpoklum May 19 '22 at 21:22
1 Answers
3
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

einpoklum
- 118,144
- 57
- 340
- 684