I am trying to set up nvcc for compiling CUDA code on NixOS, but seem to be hitting known incompatibilities between specific pairs of nvcc and gcc versions when compiling .cu C++ code.
For nvcc 12.4, this specific version listing:
nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Tue_Feb_27_16:19:38_PST_2024
Cuda compilation tools, release 12.4, V12.4.99
Build cuda_12.4.r12.4/compiler.33961263_
I have tried various gcc 13.x releases (through the devbox tool), only to find various x64 intrinsics, expected to exist, to not exist:
- gcc 13.1.0 and gcc 13.2.0: __builtin_ia32_cmpccxadd, __builtin_ia32_cmpccxadd64
- gcc 13.3.0: same as before, and additionally __builtin_ia32_ldtilecfg and __builtin_ia32_sttilecfg
- gcc 14.2.0: (with flag -allow-unsupported-compiler) many many more, not expected to work as nvcc 12.4 does not support gcc past version 13
To be specific, the compilation errors look like this:
/nix/store/4krab2h0hd4wvxxmscxrw21pl77j4i7j-gcc-13.3.0/lib/gcc/x86_64-unknown-linux-gnu/13.3.0/include/amxtileintrin.h(49): error: identifier "__builtin_ia32_sttilecfg" is undefined
__builtin_ia32_sttilecfg (__config);
As the cudaPackages_12.4.cudatoolkit-provided nvcc is not able to find its own headers, I explicitly include (-I flag) its own headers in cudart-dev. Paths so you can verify I did not mess up this step:
nvcc binary:
/nix/store/1vrn7wj5hscv90xx0diinq8xc7z9c0zk-cuda_nvcc-12.4.99/bin/nvcc
corresponding include directories:
/nix/store/58vlmd39635x86y2x387si8b27sjlvjv-cuda_cudart-12.4.99-dev/include
I have tried the same for cuda 11, with gcc versions 9 through 12
Anyone aware how to set up a sane cuda development environment on nix?
Additionally, why does nvcc seem to depend on AVX512/AMX headers? I certainly don’t need to generate such code.
Thanks!