biome: 1.9.2 -> 1.9.3
[NixPkgs.git] / pkgs / tools / compression / zfp / default.nix
blob8df75d48eb567d9a0e56818b6734641757cd7eee
1 { cmake, cudatoolkit, fetchFromGitHub, gfortran, lib, llvmPackages, python3Packages, stdenv
2 , config
3 , enableCfp ? true
4 , enableCuda ? config.cudaSupport
5 , enableFortran ? builtins.elem stdenv.hostPlatform.system gfortran.meta.platforms
6 , enableOpenMP ? true
7 , enablePython ? true
8 , enableUtilities ? true }:
10 stdenv.mkDerivation rec {
11   pname = "zfp";
12   version = "1.0.1";
14   src = fetchFromGitHub {
15     owner = "LLNL";
16     repo = "zfp";
17     rev = version;
18     sha256 = "sha256-iZxA4lIviZQgaeHj6tEQzEFSKocfgpUyf4WvUykb9qk=";
19   };
21   nativeBuildInputs = [ cmake ];
23   buildInputs = lib.optional enableCuda cudatoolkit
24     ++ lib.optional enableFortran gfortran
25     ++ lib.optional enableOpenMP llvmPackages.openmp
26     ++ lib.optionals enablePython (with python3Packages; [ cython numpy python ]);
28   # compile CUDA code for all extant GPUs so the binary will work with any GPU
29   # and driver combination. to be ultimately solved upstream:
30   # https://github.com/LLNL/zfp/issues/178
31   # NB: not in cmakeFlags due to https://github.com/NixOS/nixpkgs/issues/114044
32   preConfigure = lib.optionalString enableCuda ''
33     cmakeFlagsArray+=(
34       "-DCMAKE_CUDA_FLAGS=-gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_86,code=sm_86 -gencode=arch=compute_87,code=sm_87 -gencode=arch=compute_86,code=compute_86"
35     )
36   '';
38   cmakeFlags = [
39   ] ++ lib.optional enableCfp "-DBUILD_CFP=ON"
40     ++ lib.optional enableCuda "-DZFP_WITH_CUDA=ON"
41     ++ lib.optional enableFortran "-DBUILD_ZFORP=ON"
42     ++ lib.optional enableOpenMP "-DZFP_WITH_OPENMP=ON"
43     ++ lib.optional enablePython "-DBUILD_ZFPY=ON"
44     ++ ([ "-DBUILD_UTILITIES=${if enableUtilities then "ON" else "OFF"}" ]);
46   doCheck = true;
48   meta = with lib; {
49     homepage = "https://computing.llnl.gov/projects/zfp";
50     description = "Library for random-access compression of floating-point arrays";
51     license = licenses.bsd3;
52     maintainers = [ maintainers.spease ];
53     # 64-bit only
54     platforms = platforms.aarch64 ++ platforms.x86_64;
55     mainProgram = "zfp";
56   };