1 { lib, stdenv, fetchurl, autoreconfHook, gfortran, perl
2 , mpi, blas, lapack, scalapack, openssh
4 , avxSupport ? stdenv.hostPlatform.avxSupport
5 , avx2Support ? stdenv.hostPlatform.avx2Support
6 , avx512Support ? stdenv.hostPlatform.avx512Support
7 # Enable NIVIA GPU support
8 # Note, that this needs to be built on a system with a GPU
9 # present for the tests to succeed.
11 # type of GPU architecture
12 , nvidiaArch ? "sm_60"
16 assert blas.isILP64 == lapack.isILP64;
17 assert blas.isILP64 == scalapack.isILP64;
19 stdenv.mkDerivation rec {
21 version = "2022.05.001";
23 passthru = { inherit (blas) isILP64; };
26 url = "https://elpa.mpcdf.mpg.de/software/tarball-archive/Releases/${version}/elpa-${version}.tar.gz";
27 sha256 = "sha256-IH5vJtZTL7cDc6/D7z04JVITr2He9lnCXa06MOT8o4s=";
31 # Use a plain name for the pkg-config file
36 patchShebangs ./fdep/fortran_dependencies.pl
37 patchShebangs ./test-driver
39 # Fix the test script generator
40 substituteInPlace Makefile.am --replace '#!/bin/bash' '#!${stdenv.shell}'
43 nativeBuildInputs = [ autoreconfHook perl openssh ];
45 buildInputs = [ mpi blas lapack scalapack ]
46 ++ lib.optional enableCuda cudatoolkit;
54 # These need to be set for configure to succeed
55 export FCFLAGS="${lib.optionalString stdenv.hostPlatform.isx86_64 "-msse3 "
56 + lib.optionalString avxSupport "-mavx "
57 + lib.optionalString avx2Support "-mavx2 -mfma "
58 + lib.optionalString avx512Support "-mavx512"}"
60 export CFLAGS=$FCFLAGS
66 "--without-threading-support-check-during-build"
67 ] ++ lib.optional blas.isILP64 "--enable-64bit-integer-math-support"
68 ++ lib.optional (!avxSupport) "--disable-avx"
69 ++ lib.optional (!avx2Support) "--disable-avx2"
70 ++ lib.optional (!avx512Support) "--disable-avx512"
71 ++ lib.optional (!stdenv.hostPlatform.isx86_64) "--disable-sse"
72 ++ lib.optional stdenv.hostPlatform.isx86_64 "--enable-sse-assembly"
73 ++ lib.optionals enableCuda [ "--enable-nvidia-gpu" "--with-NVIDIA-GPU-compute-capability=${nvidiaArch}" ];
80 # make sure the test starts even if we have less than 4 cores
81 export OMPI_MCA_rmaps_base_oversubscribe=1
83 # Fix to make mpich run in a sandbox
87 export OMP_NUM_THREADS=2
89 # Reduce test problem sizes
90 export TEST_FLAGS="1500 50 16"
94 description = "Eigenvalue Solvers for Petaflop-Applications";
95 homepage = "https://elpa.mpcdf.mpg.de/";
96 license = licenses.lgpl3Only;
97 platforms = platforms.linux;
98 maintainers = [ maintainers.markuskowa ];