Describe the bug
Unlike torch, torchvision does not explicitly set the C/C++ compiler when building with CUDA. This is problematic because we can end up linking libraries built by different versions of the compiler built with different language standards. Additionally, we can potentially end up using a compiler which isn't supported by the version of NVCC being used.
torch does this in the preConfigure phase:
|
preConfigure = lib.optionalString cudaSupport '' |
|
export TORCH_CUDA_ARCH_LIST="${cudaFlags.cudaCapabilitiesSemiColonString}" |
|
export CC=${cudatoolkit.cc}/bin/gcc CXX=${cudatoolkit.cc}/bin/g++ |
|
'' + lib.optionalString (cudaSupport && cudnn != null) '' |
torchvision can do it in the same place or in preBuild:
|
preBuild = lib.optionalString cudaSupport '' |
|
export TORCH_CUDA_ARCH_LIST="${cudaFlags.cudaCapabilitiesSemiColonString}" |
|
export FORCE_CUDA=1 |
|
''; |
Notify maintainers
@ericsagnes
cc @NixOS/cuda-maintainers
Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.
[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
- system: `"x86_64-linux"`
- host os: `Linux 6.1.12-200.fc37.x86_64, Fedora Linux, 37 (Workstation Edition), nobuild`
- multi-user?: `no`
- sandbox: `no`
- version: `nix-env (Nix) 2.14.0pre20230208_ec78896`
- channels(connorbaker): `"nixpkgs"`
- nixpkgs: `/home/connorbaker/.nix-defexpr/channels/nixpkgs`
Describe the bug
Unlike
torch,torchvisiondoes not explicitly set the C/C++ compiler when building with CUDA. This is problematic because we can end up linking libraries built by different versions of the compiler built with different language standards. Additionally, we can potentially end up using a compiler which isn't supported by the version of NVCC being used.torchdoes this in thepreConfigurephase:nixpkgs/pkgs/development/python-modules/torch/default.nix
Lines 148 to 151 in e5bde65
torchvisioncan do it in the same place or inpreBuild:nixpkgs/pkgs/development/python-modules/torchvision/default.nix
Lines 47 to 50 in e5bde65
Notify maintainers
@ericsagnes
cc @NixOS/cuda-maintainers
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"and paste the result.