1 { lib, stdenv, fetchurl, pkg-config, bison, numactl, libxml2
2 , perl, gfortran, slurm, openssh, hwloc, zlib, makeWrapper
3 # InfiniBand dependencies
5 # OmniPath dependencies
7 # Compile with slurm as a process manager
9 # Network type for MVAPICH2
10 , network ? "ethernet"
13 assert builtins.elem network [ "ethernet" "infiniband" "omnipath" ];
15 stdenv.mkDerivation rec {
20 url = "http://mvapich.cse.ohio-state.edu/download/mvapich/mv2/mvapich2-${version}.tar.gz";
21 sha256 = "sha256-w5pEkvS+UN9hAHhXSLoolOI85FCpQSgYHVFtpXV3Ua4=";
24 outputs = [ "out" "doc" "man" ];
26 nativeBuildInputs = [ pkg-config bison makeWrapper gfortran ];
27 propagatedBuildInputs = [ numactl rdma-core zlib opensm ];
28 buildInputs = with lib; [
34 ] ++ optionals (network == "infiniband") [ rdma-core opensm ]
35 ++ optionals (network == "omnipath") [ libpsm2 libfabric ]
36 ++ optional useSlurm slurm;
38 configureFlags = with lib; [
40 "--enable-fortran=all"
42 "--enable-threads=multiple"
45 "FFLAGS=-fallow-argument-mismatch" # fix build with gfortran 10
46 ] ++ optional useSlurm "--with-pm=slurm"
47 ++ optional (network == "ethernet") "--with-device=ch3:sock"
48 ++ optionals (network == "infiniband") [ "--with-device=ch3:mrail" "--with-rdma=gen2" "--disable-ibv-dlopen" ]
49 ++ optionals (network == "omnipath") ["--with-device=ch3:psm" "--with-psm2=${libpsm2}"];
54 # /tmp/nix-build... ends up in the RPATH, fix it manually
55 for entry in $out/bin/mpichversion $out/bin/mpivars; do
56 echo "fix rpath: $entry"
57 patchelf --allowed-rpath-prefixes ${builtins.storeDir} --shrink-rpath $entry
60 # Ensure the default compilers are the ones mvapich was built with
61 substituteInPlace $out/bin/mpicc --replace 'CC="gcc"' 'CC=${stdenv.cc}/bin/cc'
62 substituteInPlace $out/bin/mpicxx --replace 'CXX="g++"' 'CXX=${stdenv.cc}/bin/c++'
63 substituteInPlace $out/bin/mpifort --replace 'FC="gfortran"' 'FC=${gfortran}/bin/gfortran'
66 enableParallelBuilding = true;
69 description = "MPI-3.1 implementation optimized for Infiband transport";
70 homepage = "https://mvapich.cse.ohio-state.edu";
71 license = licenses.bsd3;
72 maintainers = [ maintainers.markuskowa ];
73 platforms = platforms.linux;