14 if config.cudaSupport then
16 else if config.rocmSupport then
23 assert builtins.elem gpuBackend [
29 stdenv.mkDerivation rec {
33 src = fetchFromGitHub {
37 hash = "sha256-hZdB/QcjL8rjvR1YZS+CHe5U5zxedpfDq6msMih4Elc=";
43 ] ++ lib.optional (gpuBackend == "cuda") cudaPackages.cuda_nvcc;
50 ++ lib.optionals (gpuBackend == "cuda") [
52 cudaPackages.cuda_cudart
54 ++ lib.optionals (gpuBackend == "rocm") [
59 ++ lib.optional stdenv.hostPlatform.isDarwin llvmPackages.openmp;
65 "-DSPFFT_SINGLE_PRECISION=OFF"
67 # Required due to broken CMake files
68 "-DCMAKE_INSTALL_LIBDIR=lib"
69 "-DCMAKE_INSTALL_INCLUDEDIR=include"
71 ++ lib.optional (gpuBackend == "cuda") "-DSPFFT_GPU_BACKEND=CUDA"
72 ++ lib.optionals (gpuBackend == "rocm") [
73 "-DSPFFT_GPU_BACKEND=ROCM"
74 "-DHIP_ROOT_DIR=${rocmPackages.clr}"
78 description = "Sparse 3D FFT library with MPI, OpenMP, CUDA and ROCm support";
79 homepage = "https://github.com/eth-cscs/SpFFT";
80 license = licenses.bsd3;
81 maintainers = [ maintainers.sheepforce ];
82 platforms = platforms.linux;