nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 120 lines 2.6 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 rocmUpdateScript, 6 cmake, 7 rocm-cmake, 8 clr, 9 rocfft, 10 gtest, 11 boost, 12 fftw, 13 fftwFloat, 14 openmp, 15 buildTests ? false, 16 buildBenchmarks ? false, 17 buildSamples ? false, 18 gpuTargets ? clr.localGpuTargets or [ ], 19}: 20 21# Can also use cuFFT 22stdenv.mkDerivation (finalAttrs: { 23 pname = "hipfft"; 24 version = "7.1.1"; 25 26 outputs = [ 27 "out" 28 ] 29 ++ lib.optionals buildTests [ 30 "test" 31 ] 32 ++ lib.optionals buildBenchmarks [ 33 "benchmark" 34 ] 35 ++ lib.optionals buildSamples [ 36 "sample" 37 ]; 38 39 src = fetchFromGitHub { 40 owner = "ROCm"; 41 repo = "hipFFT"; 42 rev = "rocm-${finalAttrs.version}"; 43 hash = "sha256-6FyI9s6H/lHFhm8aUqB9+vvJ0CRIVWCFLNoJprvsI6o="; 44 fetchSubmodules = true; 45 }; 46 47 nativeBuildInputs = [ 48 clr 49 cmake 50 rocm-cmake 51 ]; 52 53 buildInputs = [ 54 rocfft 55 ] 56 ++ lib.optionals (buildTests || buildBenchmarks || buildSamples) [ 57 gtest 58 boost 59 fftw 60 fftwFloat 61 openmp 62 ]; 63 64 cmakeFlags = [ 65 "-DCMAKE_C_COMPILER=hipcc" 66 "-DCMAKE_CXX_COMPILER=hipcc" 67 "-DCMAKE_MODULE_PATH=${clr}/lib/cmake/hip" 68 "-DHIP_ROOT_DIR=${clr}" 69 "-DHIP_PATH=${clr}" 70 # Manually define CMAKE_INSTALL_<DIR> 71 # See: https://github.com/NixOS/nixpkgs/pull/197838 72 "-DCMAKE_INSTALL_BINDIR=bin" 73 "-DCMAKE_INSTALL_LIBDIR=lib" 74 "-DCMAKE_INSTALL_INCLUDEDIR=include" 75 ] 76 ++ lib.optionals (gpuTargets != [ ]) [ 77 "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" 78 ] 79 ++ lib.optionals buildTests [ 80 "-DBUILD_CLIENTS_TESTS=ON" 81 ] 82 ++ lib.optionals buildBenchmarks [ 83 "-DBUILD_CLIENTS_RIDER=ON" 84 ] 85 ++ lib.optionals buildSamples [ 86 "-DBUILD_CLIENTS_SAMPLES=ON" 87 ]; 88 89 postInstall = 90 lib.optionalString buildTests '' 91 mkdir -p $test/bin 92 mv $out/bin/hipfft-test $test/bin 93 '' 94 + lib.optionalString buildBenchmarks '' 95 mkdir -p $benchmark/bin 96 mv $out/bin/hipfft-rider $benchmark/bin 97 '' 98 + lib.optionalString buildSamples '' 99 mkdir -p $sample/bin 100 mv clients/staging/hipfft_* $sample/bin 101 patchelf $sample/bin/hipfft_* --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" 102 '' 103 + lib.optionalString (buildTests || buildBenchmarks) '' 104 rmdir $out/bin 105 ''; 106 107 passthru.updateScript = rocmUpdateScript { 108 name = finalAttrs.pname; 109 inherit (finalAttrs.src) owner; 110 inherit (finalAttrs.src) repo; 111 }; 112 113 meta = { 114 description = "FFT marshalling library"; 115 homepage = "https://github.com/ROCm/hipFFT"; 116 license = with lib.licenses; [ mit ]; 117 teams = [ lib.teams.rocm ]; 118 platforms = lib.platforms.linux; 119 }; 120})