nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 100 lines 2.1 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 rocmUpdateScript, 6 cmake, 7 rocm-cmake, 8 rocm-docs-core, 9 half, 10 clr, 11 openmp, 12 boost, 13 python3Packages, 14 buildDocs ? false, # Needs internet 15 useOpenCL ? false, 16 useCPU ? false, 17 gpuTargets ? clr.localGpuTargets or [ ], 18}: 19 20stdenv.mkDerivation (finalAttrs: { 21 pname = 22 "rpp-" 23 + ( 24 if (!useOpenCL && !useCPU) then 25 "hip" 26 else if (!useOpenCL && !useCPU) then 27 "opencl" 28 else 29 "cpu" 30 ); 31 32 version = "7.1.1"; 33 34 src = fetchFromGitHub { 35 owner = "ROCm"; 36 repo = "rpp"; 37 rev = "rocm-${finalAttrs.version}"; 38 hash = "sha256-ZlJRV57ybPsczvoWwd5vr2n7EKje0vj2GJYsvVY+qas="; 39 }; 40 41 nativeBuildInputs = [ 42 cmake 43 rocm-cmake 44 clr 45 ] 46 ++ lib.optionals buildDocs [ 47 rocm-docs-core 48 python3Packages.python 49 ]; 50 51 buildInputs = [ 52 half 53 openmp 54 boost 55 ]; 56 57 cmakeFlags = [ 58 "-DROCM_PATH=${clr}" 59 "-DCMAKE_INSTALL_BINDIR=bin" 60 "-DCMAKE_INSTALL_LIBDIR=lib" 61 "-DCMAKE_INSTALL_INCLUDEDIR=include" 62 ] 63 ++ lib.optionals (gpuTargets != [ ]) [ 64 "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" 65 ] 66 ++ lib.optionals (!useOpenCL && !useCPU) [ 67 "-DBACKEND=HIP" 68 ] 69 ++ lib.optionals (useOpenCL && !useCPU) [ 70 "-DBACKEND=OCL" 71 ] 72 ++ lib.optionals useCPU [ 73 "-DBACKEND=CPU" 74 ]; 75 76 postPatch = lib.optionalString (!useOpenCL && !useCPU) '' 77 # Bad path 78 substituteInPlace CMakeLists.txt \ 79 --replace "COMPILER_FOR_HIP \''${ROCM_PATH}/llvm/bin/clang++" "COMPILER_FOR_HIP ${clr}/bin/hipcc" 80 ''; 81 82 postBuild = lib.optionalString buildDocs '' 83 python3 -m sphinx -T -E -b html -d _build/doctrees -D language=en ../docs _build/html 84 ''; 85 86 passthru.updateScript = rocmUpdateScript { 87 name = finalAttrs.pname; 88 inherit (finalAttrs.src) owner; 89 inherit (finalAttrs.src) repo; 90 }; 91 92 meta = { 93 description = "Comprehensive high-performance computer vision library for AMD processors"; 94 homepage = "https://github.com/ROCm/rpp"; 95 license = with lib.licenses; [ mit ]; 96 teams = [ lib.teams.rocm ]; 97 platforms = lib.platforms.linux; 98 broken = useOpenCL; 99 }; 100})