Background:
Hi I’m trying to develop some cuda kernels on nixos. I already had some working kernels on windows, when i tried it on nix they didn’t work anymore. After some debugging I found out that it’s due to “Error 35: Driver Version Insufficient for Runtime Version”. But the driver version is high enough as checked with nvidia-smi
Minimal reproducible example - get_versions.cu
#include <iostream>
int main()
{
int run_version, driver_version;
std::cout<< "Return Code Runtime Version: ";
std::cout<<cudaRuntimeGetVersion(&run_version);
std::cout<<"\nReturn Code Driver Version: ";
std::cout<<cudaDriverGetVersion(&driver_version);
std::cout << "\nRuntime Version: ";
std::cout << run_version;
std::cout << "\n Driver Version: ";
std::cout << driver_version;
return 0;
}
I compiled it with:
nvcc -o versions_bin get_versions.cu -I /nix/store/lxyjz3j1qbrf9hw0nnsdang3gk2a8wpp-cudatoolkit-11.0.3/include/ -ldir /nix/store/lxyjz3j1qbrf9hw0nnsdang3gk2a8wpp-cudatoolkit-11.0.3/nvvm/libdevice/ -L /nix/store/lxyjz3j1qbrf9hw0nnsdang3gk2a8wpp-cudatoolkit-11.0.3/lib/ -L /nix/store/sdjf499xfbykmr3lsyd7084krjxr3mfx-cudatoolkit-11.0.3-lib/lib/ --dont-use-profile
Output
$ ./versions_bin
Return Code Runtime Version: 35
Return Code Driver Version: 0
Runtime Version: 0
Driver Version: 0
The driver is definitely there as nvidia-smi returns the following.
[user@nixos:]$ nvidia-smi
Sat Dec 5 02:50:20 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 455.38 Driver Version: 455.38 CUDA Version: 11.1 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 GeForce GTX 107... Off | 00000000:2A:00.0 On | N/A |
| 0% 51C P0 34W / 180W | 936MiB / 8116MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 1159 G ...-xorg-server-1.20.8/bin/X 536MiB |
| 0 N/A N/A 1666 G ...nt-system/sw/bin/kwin_x11 235MiB |
| 0 N/A N/A 1704 G ...ce-5.18.5/bin/plasmashell 119MiB |
| 0 N/A N/A 3669 G ...AAAAAAAA== --shared-files 38MiB |
+-----------------------------------------------------------------------------+
So it seems for some reason the cuda program can not see the driver.