depot/third_party/nixpkgs/pkgs/development/libraries/mvapich/default.nix
Default email 841d9c7fc1 Project import generated by Copybara.
GitOrigin-RevId: 3a8d7958a610cd3fec3a6f424480f91a1b259185
2021-06-29 00:13:55 +01:00

73 lines
2.3 KiB
Nix

{ lib, stdenv, fetchurl, pkg-config, bison, numactl, libxml2
, perl, gfortran, slurm, openssh, hwloc, zlib, makeWrapper
# InfiniBand dependencies
, opensm, rdma-core
# OmniPath dependencies
, libpsm2, libfabric
# Compile with slurm as a process manager
, useSlurm ? false
# Network type for MVAPICH2
, network ? "ethernet"
} :
assert builtins.elem network [ "ethernet" "infiniband" "omnipath" ];
stdenv.mkDerivation rec {
pname = "mvapich";
version = "2.3.6";
src = fetchurl {
url = "http://mvapich.cse.ohio-state.edu/download/mvapich/mv2/mvapich2-${version}.tar.gz";
sha256 = "0jd28vy9ivl3rcpkxmhw73b6krzm0pd9jps8asw92wa00lm2z9mk";
};
nativeBuildInputs = [ pkg-config bison makeWrapper ];
propagatedBuildInputs = [ numactl rdma-core zlib opensm ];
buildInputs = with lib; [
numactl
libxml2
perl
gfortran
openssh
hwloc
] ++ optionals (network == "infiniband") [ rdma-core opensm ]
++ optionals (network == "omnipath") [ libpsm2 libfabric ]
++ optional useSlurm slurm;
configureFlags = with lib; [
"--with-pm=hydra"
"--enable-fortran=all"
"--enable-cxx"
"--enable-threads=multiple"
"--enable-hybrid"
"--enable-shared"
] ++ optional useSlurm "--with-pm=slurm"
++ optional (network == "ethernet") "--with-device=ch3:sock"
++ optionals (network == "infiniband") [ "--with-device=ch3:mrail" "--with-rdma=gen2" ]
++ optionals (network == "omnipath") ["--with-device=ch3:psm" "--with-psm2=${libpsm2}"];
doCheck = true;
preFixup = ''
# /tmp/nix-build... ends up in the RPATH, fix it manually
for entry in $out/bin/mpichversion $out/bin/mpivars; do
echo "fix rpath: $entry"
patchelf --set-rpath "$out/lib" $entry
done
# Ensure the default compilers are the ones mvapich was built with
substituteInPlace $out/bin/mpicc --replace 'CC="gcc"' 'CC=${stdenv.cc}/bin/cc'
substituteInPlace $out/bin/mpicxx --replace 'CXX="g++"' 'CXX=${stdenv.cc}/bin/c++'
substituteInPlace $out/bin/mpifort --replace 'FC="gfortran"' 'FC=${gfortran}/bin/gfortran'
'';
enableParallelBuilding = true;
meta = with lib; {
description = "MPI-3.1 implementation optimized for Infiband transport";
homepage = "https://mvapich.cse.ohio-state.edu";
license = licenses.bsd3;
maintainers = [ maintainers.markuskowa ];
platforms = platforms.linux;
};
}