spfft: init at 1.0.6

spfft: fix openmp on darwin
This commit is contained in:
Phillip Seeber 2023-10-05 17:29:40 +02:00
parent 5b7e0ad096
commit 0365c4b1d0

View file

@ -0,0 +1,67 @@
{ stdenv
, lib
, fetchFromGitHub
, fftw
, cmake
, mpi
, gfortran
, llvmPackages
, gpuBackend ? "none"
, cudaPackages
, hip
, rocfft
, hipfft
}:
assert builtins.elem gpuBackend [ "none" "cuda" "rocm" ];
stdenv.mkDerivation rec {
pname = "SpFFT";
version = "1.0.6";
src = fetchFromGitHub {
owner = "eth-cscs";
repo = pname;
rev = "v${version}";
hash = "sha256-70fPbIYbW50CoMdRS93hZKSbMEIQvZGFNE+eiRvuw0o=";
};
nativeBuildInputs = [
cmake
gfortran
];
buildInputs = [
fftw
]
++ lib.optional (gpuBackend == "cuda") cudaPackages.cudatoolkit
++ lib.optionals (gpuBackend == "rocm") [ hip rocfft hipfft ]
++ lib.optional stdenv.isDarwin llvmPackages.openmp
;
propagatedBuildInputs = [ mpi ];
cmakeFlags = [
"-DSPFFT_OMP=ON"
"-DSPFFT_MPI=ON"
"-DSPFFT_SINGLE_PRECISION=OFF"
"-DSPFFT_FORTRAN=ON"
# Required due to broken CMake files
"-DCMAKE_INSTALL_LIBDIR=lib"
"-DCMAKE_INSTALL_INCLUDEDIR=include"
]
++ lib.optional (gpuBackend == "cuda") "-DSPFFT_GPU_BACKEND=CUDA"
++ lib.optionals (gpuBackend == "rocm") [
"-DSPFFT_GPU_BACKEND=ROCM"
"-DHIP_ROOT_DIR=${hip}"
];
meta = with lib; {
description = "Sparse 3D FFT library with MPI, OpenMP, CUDA and ROCm support";
homepage = "https://github.com/eth-cscs/SpFFT";
license = licenses.bsd3;
maintainers = [ maintainers.sheepforce ];
platforms = platforms.linux;
};
}