Loading pkgs/development/cuda-modules/packages/cuda-samples.nix +28 −5 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ _cuda, cmake, cuda_cccl, cuda_culibos, cuda_cudart, cuda_nvcc, cuda_nvrtc, Loading @@ -29,7 +30,7 @@ backendStdenv.mkDerivation (finalAttrs: { name = "${cudaNamePrefix}-${finalAttrs.pname}-${finalAttrs.version}"; pname = "cuda-samples"; version = "12.8"; version = if cudaAtLeast "13" then "13.0" else "12.8"; # We should be able to use samples from the latest version of CUDA # on most of the CUDA package sets we have. Loading @@ -38,10 +39,17 @@ backendStdenv.mkDerivation (finalAttrs: { owner = "NVIDIA"; repo = "cuda-samples"; tag = "v${finalAttrs.version}"; hash = "sha256-Ba0Fi0v/sQ+1iJ4mslgyIAE+oK5KO0lMoTQCC91vpiA="; hash = lib.getAttr finalAttrs.version { "13.0" = "sha256-bOcAE/OzOI6MWTh+bFZfq1en6Yawu+HI8W+xK+XaCqg="; "12.8" = "sha256-Ba0Fi0v/sQ+1iJ4mslgyIAE+oK5KO0lMoTQCC91vpiA="; }; }; prePatch = let samplesAtLeast = lib.versionAtLeast finalAttrs.version; samplesOlder = lib.versionOlder finalAttrs.version; in # https://github.com/NVIDIA/cuda-samples/issues/333 '' nixLog "removing sample 0_Introduction/UnifiedMemoryStreams which requires OpenMP support for CUDA" Loading @@ -52,7 +60,7 @@ backendStdenv.mkDerivation (finalAttrs: { '# add_subdirectory(UnifiedMemoryStreams)' '' # This sample tries to use a relative path, which doesn't work for our splayed installation. + '' + lib.optionalString (samplesOlder "13") '' nixLog "patching sample 0_Introduction/matrixMul_nvrtc" substituteInPlace \ "$NIX_BUILD_TOP/$sourceRoot/Samples/0_Introduction/matrixMul_nvrtc/CMakeLists.txt" \ Loading @@ -66,6 +74,20 @@ backendStdenv.mkDerivation (finalAttrs: { "\''${CUDAToolkit_BIN_DIR}/../include/cuda" \ "${lib.getOutput "include" cuda_cccl}/include/cuda" '' + lib.optionalString (samplesAtLeast "13") '' nixLog "patching sample 0_Introduction/matrixMul_nvrtc" substituteInPlace \ "$NIX_BUILD_TOP/$sourceRoot/Samples/0_Introduction/matrixMul_nvrtc/CMakeLists.txt" \ --replace-fail \ "\''${CUDA_INCLUDE_DIR}/cooperative_groups" \ "${lib.getOutput "include" cuda_cudart}/include/cooperative_groups" \ --replace-fail \ "\''${CUDA_INCLUDE_DIR}/cccl/nv" \ "${lib.getOutput "include" cuda_cccl}/include/nv" \ --replace-fail \ "\''${CUDA_INCLUDE_DIR}/cccl/cuda" \ "${lib.getOutput "include" cuda_cccl}/include/cuda" '' # These three samples give undefined references, like # nvlink error : Undefined reference to '__cudaCDP2Free' in 'CMakeFiles/cdpBezierTessellation.dir/BezierLineCDP.cu.o' # nvlink error : Undefined reference to '__cudaCDP2Malloc' in 'CMakeFiles/cdpBezierTessellation.dir/BezierLineCDP.cu.o' Loading Loading @@ -108,7 +130,7 @@ backendStdenv.mkDerivation (finalAttrs: { "add_subdirectory(jitLto)" \ "# add_subdirectory(jitLto)" '' + lib.optionalString (cudaAtLeast "12.4") '' + lib.optionalString (samplesOlder "13") '' nixLog "patching sample 4_CUDA_Libraries/jitLto to use correct path to libnvJitLink.so" substituteInPlace \ "$NIX_BUILD_TOP/$sourceRoot/Samples/4_CUDA_Libraries/jitLto/CMakeLists.txt" \ Loading Loading @@ -172,7 +194,8 @@ backendStdenv.mkDerivation (finalAttrs: { libnpp libnvjitlink libnvjpeg ]; ] ++ lib.optionals (cudaAtLeast "13") [ cuda_culibos ]; cmakeFlags = [ (lib.cmakeFeature "CMAKE_CUDA_ARCHITECTURES" flags.cmakeCudaArchitecturesString) Loading Loading
pkgs/development/cuda-modules/packages/cuda-samples.nix +28 −5 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ _cuda, cmake, cuda_cccl, cuda_culibos, cuda_cudart, cuda_nvcc, cuda_nvrtc, Loading @@ -29,7 +30,7 @@ backendStdenv.mkDerivation (finalAttrs: { name = "${cudaNamePrefix}-${finalAttrs.pname}-${finalAttrs.version}"; pname = "cuda-samples"; version = "12.8"; version = if cudaAtLeast "13" then "13.0" else "12.8"; # We should be able to use samples from the latest version of CUDA # on most of the CUDA package sets we have. Loading @@ -38,10 +39,17 @@ backendStdenv.mkDerivation (finalAttrs: { owner = "NVIDIA"; repo = "cuda-samples"; tag = "v${finalAttrs.version}"; hash = "sha256-Ba0Fi0v/sQ+1iJ4mslgyIAE+oK5KO0lMoTQCC91vpiA="; hash = lib.getAttr finalAttrs.version { "13.0" = "sha256-bOcAE/OzOI6MWTh+bFZfq1en6Yawu+HI8W+xK+XaCqg="; "12.8" = "sha256-Ba0Fi0v/sQ+1iJ4mslgyIAE+oK5KO0lMoTQCC91vpiA="; }; }; prePatch = let samplesAtLeast = lib.versionAtLeast finalAttrs.version; samplesOlder = lib.versionOlder finalAttrs.version; in # https://github.com/NVIDIA/cuda-samples/issues/333 '' nixLog "removing sample 0_Introduction/UnifiedMemoryStreams which requires OpenMP support for CUDA" Loading @@ -52,7 +60,7 @@ backendStdenv.mkDerivation (finalAttrs: { '# add_subdirectory(UnifiedMemoryStreams)' '' # This sample tries to use a relative path, which doesn't work for our splayed installation. + '' + lib.optionalString (samplesOlder "13") '' nixLog "patching sample 0_Introduction/matrixMul_nvrtc" substituteInPlace \ "$NIX_BUILD_TOP/$sourceRoot/Samples/0_Introduction/matrixMul_nvrtc/CMakeLists.txt" \ Loading @@ -66,6 +74,20 @@ backendStdenv.mkDerivation (finalAttrs: { "\''${CUDAToolkit_BIN_DIR}/../include/cuda" \ "${lib.getOutput "include" cuda_cccl}/include/cuda" '' + lib.optionalString (samplesAtLeast "13") '' nixLog "patching sample 0_Introduction/matrixMul_nvrtc" substituteInPlace \ "$NIX_BUILD_TOP/$sourceRoot/Samples/0_Introduction/matrixMul_nvrtc/CMakeLists.txt" \ --replace-fail \ "\''${CUDA_INCLUDE_DIR}/cooperative_groups" \ "${lib.getOutput "include" cuda_cudart}/include/cooperative_groups" \ --replace-fail \ "\''${CUDA_INCLUDE_DIR}/cccl/nv" \ "${lib.getOutput "include" cuda_cccl}/include/nv" \ --replace-fail \ "\''${CUDA_INCLUDE_DIR}/cccl/cuda" \ "${lib.getOutput "include" cuda_cccl}/include/cuda" '' # These three samples give undefined references, like # nvlink error : Undefined reference to '__cudaCDP2Free' in 'CMakeFiles/cdpBezierTessellation.dir/BezierLineCDP.cu.o' # nvlink error : Undefined reference to '__cudaCDP2Malloc' in 'CMakeFiles/cdpBezierTessellation.dir/BezierLineCDP.cu.o' Loading Loading @@ -108,7 +130,7 @@ backendStdenv.mkDerivation (finalAttrs: { "add_subdirectory(jitLto)" \ "# add_subdirectory(jitLto)" '' + lib.optionalString (cudaAtLeast "12.4") '' + lib.optionalString (samplesOlder "13") '' nixLog "patching sample 4_CUDA_Libraries/jitLto to use correct path to libnvJitLink.so" substituteInPlace \ "$NIX_BUILD_TOP/$sourceRoot/Samples/4_CUDA_Libraries/jitLto/CMakeLists.txt" \ Loading Loading @@ -172,7 +194,8 @@ backendStdenv.mkDerivation (finalAttrs: { libnpp libnvjitlink libnvjpeg ]; ] ++ lib.optionals (cudaAtLeast "13") [ cuda_culibos ]; cmakeFlags = [ (lib.cmakeFeature "CMAKE_CUDA_ARCHITECTURES" flags.cmakeCudaArchitecturesString) Loading