nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 113 lines 2.7 kB view raw
1{ 2 _cuda, 3 backendStdenv, 4 cuda_cudart, 5 cuda_nvcc, 6 cudaMajorMinorVersion, 7 cudaNamePrefix, 8 fetchFromGitHub, 9 flags, 10 lib, 11 # passthru.updateScript 12 gitUpdater, 13}: 14let 15 inherit (_cuda.lib) _mkMetaBadPlatforms; 16 inherit (lib) licenses maintainers teams; 17in 18backendStdenv.mkDerivation (finalAttrs: { 19 __structuredAttrs = true; 20 strictDeps = true; 21 22 # NOTE: Depends on the CUDA package set, so use cudaNamePrefix. 23 name = "${cudaNamePrefix}-${finalAttrs.pname}-${finalAttrs.version}"; 24 pname = "gdrcopy"; 25 version = "2.5.1"; 26 27 src = fetchFromGitHub { 28 owner = "NVIDIA"; 29 repo = "gdrcopy"; 30 tag = "v${finalAttrs.version}"; 31 hash = "sha256-2cDsDc1lGW9rNF1q3EhjmiJhNaIwuFYlNdooPe7/R2I="; 32 }; 33 34 outputs = [ "out" ]; 35 36 nativeBuildInputs = [ 37 cuda_nvcc 38 ]; 39 40 postPatch = '' 41 nixLog "patching shebang in $PWD/config_arch" 42 patchShebangs "$PWD/config_arch" 43 44 nixLog "patching awk expression in $PWD/Makefile" 45 substituteInPlace "$PWD/Makefile" \ 46 --replace-fail \ 47 "/\#" \ 48 "/#" \ 49 --replace-fail \ 50 'lib64' \ 51 'lib' 52 53 nixLog "patching $PWD/src/Makefile" 54 substituteInPlace "$PWD/src/Makefile" \ 55 --replace-fail \ 56 "/\#" \ 57 "/#" 58 59 nixLog "patching $PWD/tests/Makefile" 60 substituteInPlace "$PWD/tests/Makefile" \ 61 --replace-fail \ 62 'CUDA_VERSION := $(shell $(GET_CUDA_VERSION) $(NVCC))' \ 63 'CUDA_VERSION := ${cudaMajorMinorVersion}' \ 64 --replace-fail \ 65 'NVCCFLAGS ?= $(shell $(GET_CUDA_GENCODE) $(NVCC)) $(NVCC_STD)' \ 66 'NVCCFLAGS ?= ${flags.gencodeString} $(NVCC_STD)' \ 67 --replace-fail \ 68 'lib64' \ 69 'lib' 70 ''; 71 72 enableParallelBuilding = true; 73 74 buildInputs = [ 75 cuda_cudart 76 ]; 77 78 buildFlags = [ 79 # Makefile variables which must be set explicitly 80 "CUDA=${lib.getLib cuda_cudart}" 81 "NVCC=${lib.getExe cuda_nvcc}" # TODO: shoud be using cuda_nvcc from pkgsBuildHost 82 83 # Make targets 84 # NOTE: We cannot use `all` because it includes the driver, which needs the driver source code. 85 "lib" 86 "exes" 87 ]; 88 89 # Tests require gdrdrv be installed (don't know how to communicate dependency on the driver). 90 doCheck = false; 91 92 installFlags = [ 93 "DESTDIR=${placeholder "out"}" 94 "prefix=/" 95 ]; 96 97 passthru.updateScript = gitUpdater { 98 inherit (finalAttrs) pname version; 99 rev-prefix = "v"; 100 }; 101 102 meta = { 103 description = "Fast GPU memory copy library based on NVIDIA GPUDirect RDMA technology"; 104 homepage = "https://github.com/NVIDIA/gdrcopy"; 105 license = licenses.mit; 106 platforms = [ 107 "aarch64-linux" 108 "x86_64-linux" 109 ]; 110 maintainers = [ maintainers.connorbaker ]; 111 teams = [ teams.cuda ]; 112 }; 113})