1 { lib, stdenv, fetchurl, autoreconfHook, mpiCheckPhaseHook
2 , gfortran, perl, mpi, blas, lapack, scalapack, openssh
4 , avxSupport ? stdenv.hostPlatform.avxSupport
5 , avx2Support ? stdenv.hostPlatform.avx2Support
6 , avx512Support ? stdenv.hostPlatform.avx512Support
8 # Enable NIVIA GPU support
9 # Note, that this needs to be built on a system with a GPU
10 # present for the tests to succeed.
11 , enableCuda ? config.cudaSupport
12 # type of GPU architecture
13 , nvidiaArch ? "sm_60"
17 assert blas.isILP64 == lapack.isILP64;
18 assert blas.isILP64 == scalapack.isILP64;
20 stdenv.mkDerivation rec {
22 version = "2023.05.001";
24 passthru = { inherit (blas) isILP64; };
27 url = "https://elpa.mpcdf.mpg.de/software/tarball-archive/Releases/${version}/elpa-${version}.tar.gz";
28 sha256 = "sha256-7GS+XWUigQ1gGjuOajFyDjw+tK8zpDTYpkVw125kYrY=";
32 # Use a plain name for the pkg-config file
37 patchShebangs ./fdep/fortran_dependencies.pl
38 patchShebangs ./test-driver
40 # Fix the test script generator
41 substituteInPlace Makefile.am --replace '#!/bin/bash' '#!${stdenv.shell}'
44 outputs = [ "out" "doc" "man" "dev" ];
46 nativeBuildInputs = [ autoreconfHook perl ];
48 buildInputs = [ mpi blas lapack scalapack ]
49 ++ lib.optional enableCuda cudatoolkit;
57 # These need to be set for configure to succeed
58 export FCFLAGS="${lib.optionalString stdenv.hostPlatform.isx86_64 "-msse3 "
59 + lib.optionalString avxSupport "-mavx "
60 + lib.optionalString avx2Support "-mavx2 -mfma "
61 + lib.optionalString avx512Support "-mavx512"}"
63 export CFLAGS=$FCFLAGS
69 "--without-threading-support-check-during-build"
70 ] ++ lib.optional blas.isILP64 "--enable-64bit-integer-math-support"
71 ++ lib.optional (!avxSupport) "--disable-avx"
72 ++ lib.optional (!avx2Support) "--disable-avx2"
73 ++ lib.optional (!avx512Support) "--disable-avx512"
74 ++ lib.optional (!stdenv.hostPlatform.isx86_64) "--disable-sse"
75 ++ lib.optional (!stdenv.hostPlatform.isx86_64) "--disable-sse-assembly"
76 ++ lib.optional stdenv.hostPlatform.isx86_64 "--enable-sse-assembly"
77 ++ lib.optionals enableCuda [ "--enable-nvidia-gpu" "--with-NVIDIA-GPU-compute-capability=${nvidiaArch}" ];
79 enableParallelBuilding = true;
81 doCheck = !enableCuda;
83 nativeCheckInputs = [ mpiCheckPhaseHook openssh ];
88 export OMP_NUM_THREADS=2
90 # Reduce test problem sizes
91 export TEST_FLAGS="1500 50 16"
95 description = "Eigenvalue Solvers for Petaflop-Applications";
96 homepage = "https://elpa.mpcdf.mpg.de/";
97 license = licenses.lgpl3Only;
98 platforms = platforms.linux;
99 maintainers = [ maintainers.markuskowa ];