Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openmpi: 4.1.6 -> 5.0.3 #275796

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions pkgs/by-name/pr/prrte/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{ lib
, stdenv
, removeReferencesTo
, fetchFromGitHub
, autoconf
, automake
, libtool
, gitMinimal
, perl
, python3
, flex
, hwloc
, libevent
, zlib
, pmix
}:

stdenv.mkDerivation rec {
pname = "prrte";
version = "3.0.5";

src = fetchFromGitHub {
owner = "openpmix";
repo = "prrte";
rev = "v${version}";
sha256 = "sha256-RDxd4veLGbN+T7xCDnNp2lbOM7mwKKD+SKdPmExr1C8=";
fetchSubmodules = true;
};

outputs = [ "out" "dev" ];

postPatch = ''
patchShebangs ./autogen.pl
patchShebangs ./config
'';

preConfigure = ''
./autogen.pl
'';

postInstall = ''
moveToOutput "bin/prte_info" "''${!outputDev}"
moveToOutput "bin/pcc" "''${!outputDev}"

remove-references-to -t $dev $(readlink -f $out/lib/libprrte${stdenv.hostPlatform.extensions.library})
'';

nativeBuildInputs = [ removeReferencesTo perl python3 autoconf automake libtool flex gitMinimal ];

buildInputs = [ libevent hwloc zlib pmix ];

enableParallelBuilding = true;

meta = with lib; {
description = "PMIx Reference Runtime Environment";
homepage = "https://docs.prrte.org/";
license = licenses.bsd3;
maintainers = [ maintainers.markuskowa ];
platforms = platforms.linux;
};
}
118 changes: 72 additions & 46 deletions pkgs/development/libraries/openmpi/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{ lib, stdenv, fetchurl, removeReferencesTo, gfortran, perl, libnl
, rdma-core, zlib, numactl, libevent, hwloc, targetPackages, symlinkJoin
, libpsm2, libfabric, pmix, ucx, ucc, makeWrapper
, libpsm2, libfabric, pmix, ucx, ucc, prrte, makeWrapper, python3
, config

# Enable CUDA support
, cudaSupport ? config.cudaSupport, cudaPackages

Expand All @@ -16,62 +17,87 @@

# Enable Fortran support
, fortranSupport ? true

# AVX/SSE options
# note that opempi fails to build with AVX disabled.
# => everything up to AVX is enabled by default
, enableSse3 ? true
, enableSse4_1 ? true
, enableAvx ? true
, enableAvx2 ? stdenv.hostPlatform.avx2Support
, enableAvx512 ? stdenv.hostPlatform.avx512Support
}:

stdenv.mkDerivation rec {
pname = "openmpi";
version = "4.1.6";
version = "5.0.3";

src = with lib.versions; fetchurl {
url = "https://www.open-mpi.org/software/ompi/v${major version}.${minor version}/downloads/${pname}-${version}.tar.bz2";
sha256 = "sha256-90CZRIVRbetjtTEa8SLCZRefUyig2FelZ7hdsAsR5BU=";
sha256 = "sha256-mQWC8gazqzLpOKoxu/B8Y5No5EBdyhlvq+fw927tqQs=";
};

postPatch = ''
patchShebangs ./

# Ensure build is reproducible
ts=`date -d @$SOURCE_DATE_EPOCH`
sed -i 's/OPAL_CONFIGURE_USER=.*/OPAL_CONFIGURE_USER="nixbld"/' configure
sed -i 's/OPAL_CONFIGURE_HOST=.*/OPAL_CONFIGURE_HOST="localhost"/' configure
sed -i "s/OPAL_CONFIGURE_DATE=.*/OPAL_CONFIGURE_DATE=\"$ts\"/" configure
find -name "Makefile.in" -exec sed -i "s/\`date\`/$ts/" \{} \;
# This is dynamically detected. Configure does not provide fine grained options
# We just disable the check in the configure script for now
${lib.optionalString (!enableSse3)
"substituteInPlace configure --replace-fail 'ompi_cv_op_avx_check_sse3=yes' 'ompi_cv_op_avx_check_sse3=no'"}
${lib.optionalString (!enableSse4_1)
"substituteInPlace configure --replace-fail 'ompi_cv_op_avx_check_sse41=yes' 'ompi_cv_op_avx_check_sse41=no'"}
${lib.optionalString (!enableAvx)
"substituteInPlace configure --replace-fail 'ompi_cv_op_avx_check_avx=yes' 'ompi_cv_op_avx_check_avx=no'"}
${lib.optionalString (!enableAvx2)
"substituteInPlace configure --replace-fail 'ompi_cv_op_avx_check_avx2=yes' 'ompi_cv_op_avx_check_avx2=no'"}
${lib.optionalString (!enableAvx512)
"substituteInPlace configure --replace-fail 'ompi_cv_op_avx_check_avx512=yes' 'ompi_cv_op_avx_check_av512=no'"}
'';

preConfigure = ''
# Ensure build is reproducible according to manual
# https://docs.open-mpi.org/en/v5.0.x/release-notes/general.html#general-notes
export USER=nixbld
export HOSTNAME=localhost
export SOURCE_DATE_EPOCH=0
'';

outputs = [ "out" "man" "dev" ];
# Split output is too fragile. Limit to Linux.
outputs = if stdenv.isLinux then [ "out" "man" "dev" ] else [ "out" ];

buildInputs = [ zlib ]
++ lib.optionals stdenv.isLinux [ libnl numactl pmix ucx ucc ]
buildInputs = [ zlib libevent hwloc ]
++ lib.optionals stdenv.isLinux [ numactl pmix ucx ucc prrte ]
++ lib.optionals cudaSupport [ cudaPackages.cuda_cudart ]
++ [ libevent hwloc ]
++ lib.optional (stdenv.isLinux || stdenv.isFreeBSD) rdma-core
++ lib.optionals fabricSupport [ libpsm2 libfabric ];
++ lib.optionals fabricSupport [ libpsm2 libfabric ]
++ lib.optional (!stdenv.isLinux) python3; # needed for internal pmix

nativeBuildInputs = [ perl removeReferencesTo makeWrapper ]
++ lib.optionals cudaSupport [ cudaPackages.cuda_nvcc ]
++ lib.optionals fortranSupport [ gfortran ];

configureFlags = lib.optional (!cudaSupport) "--disable-mca-dso"
++ lib.optional stdenv.isLinux "--with-prrte=${lib.getBin prrte}"
++ lib.optional (!fortranSupport) "--disable-mpi-fortran"
++ lib.optionals stdenv.isLinux [
"--with-libnl=${lib.getDev libnl}"
"--with-pmix=${lib.getDev pmix}"
"--with-pmix-libdir=${pmix}/lib"
"--enable-mpi-cxx"
] ++ lib.optional enableSGE "--with-sge"
++ lib.optional enableSGE "--with-sge"
++ lib.optional enablePrefix "--enable-mpirun-prefix-by-default"
# TODO: add UCX support, which is recommended to use with cuda for the most robust OpenMPI build
# https://github.com/openucx/ucx
# https://www.open-mpi.org/faq/?category=buildcuda
++ lib.optionals cudaSupport [ "--with-cuda=${cudaPackages.cuda_cudart}" "--enable-dlopen" ]
++ lib.optionals fabricSupport [ "--with-psm2=${lib.getDev libpsm2}" "--with-libfabric=${lib.getDev libfabric}" ]
;
++ lib.optionals fabricSupport [
"--with-psm2=${lib.getDev libpsm2}"
"--with-libfabric=${lib.getDev libfabric}"
"--with-libfabric-libdir=${lib.getLib libfabric}/lib"
]
++ lib.optional (!stdenv.isLinux) "--with-pmix=internal";

enableParallelBuilding = true;

postInstall = ''
postInstall = lib.optionalString stdenv.isLinux ''
find $out/lib/ -name "*.la" -exec rm -f \{} \;

# Move compiler wrappers to $dev
for f in mpi shmem osh; do
for i in f77 f90 CC c++ cxx cc fort; do
moveToOutput "bin/$f$i" "''${!outputDev}"
Expand All @@ -87,35 +113,35 @@ stdenv.mkDerivation rec {
moveToOutput "share/openmpi/ortecc-wrapper-data.txt" "''${!outputDev}"
'';

postFixup = ''
remove-references-to -t $dev $(readlink -f $out/lib/libopen-pal${stdenv.hostPlatform.extensions.sharedLibrary})
remove-references-to -t $man $(readlink -f $out/lib/libopen-pal${stdenv.hostPlatform.extensions.sharedLibrary})
postFixup = lib.optionalString stdenv.isLinux ''
# These reference are caused by hard coded "configure options"
remove-references-to -t $dev $out/bin/mpirun
remove-references-to -t $dev $(readlink -f $out/lib/libopen-pal${stdenv.hostPlatform.extensions.library})
remove-references-to -t $man $(readlink -f $out/lib/libopen-pal${stdenv.hostPlatform.extensions.library})

# The path to the wrapper is hard coded in libopen-pal.so, which we just cleared.
wrapProgram $dev/bin/opal_wrapper \
--set OPAL_INCLUDEDIR $dev/include \
--set OPAL_PKGDATADIR $dev/share/openmpi

# default compilers should be indentical to the
# compilers at build time

echo "$dev/share/openmpi/mpicc-wrapper-data.txt"
sed -i 's:compiler=.*:compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc:' \
$dev/share/openmpi/mpicc-wrapper-data.txt

echo "$dev/share/openmpi/ortecc-wrapper-data.txt"
sed -i 's:compiler=.*:compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc:' \
$dev/share/openmpi/ortecc-wrapper-data.txt

echo "$dev/share/openmpi/mpic++-wrapper-data.txt"
sed -i 's:compiler=.*:compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}c++:' \
$dev/share/openmpi/mpic++-wrapper-data.txt
'' + lib.optionalString fortranSupport ''

echo "$dev/share/openmpi/mpifort-wrapper-data.txt"
sed -i 's:compiler=.*:compiler=${gfortran}/bin/${gfortran.targetPrefix}gfortran:' \
$dev/share/openmpi/mpifort-wrapper-data.txt

# default compilers should be identical to the compilers at build time
for api in mpi shmem; do
if [ -e $dev/share/openmpi/''${api}cc-wrapper-data.txt ]; then
sed -i 's:compiler=.*:compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc:' \
$dev/share/openmpi/''${api}cc-wrapper-data.txt
fi
if [ -e $dev/share/openmpi/''${api}c++-wrapper-data.txt ]; then
sed -i 's:compiler=.*:compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}c++:' \
$dev/share/openmpi/''${api}c++-wrapper-data.txt
fi
done
'' + lib.optionalString (fortranSupport && stdenv.isLinux) ''
for api in mpi shmem; do
if [ -e $dev/share/openmpi/''${api}fort-wrapper-data.txt ]; then
sed -i 's:compiler=.*:compiler=${gfortran}/bin/${gfortran.targetPrefix}gfortran:' \
$dev/share/openmpi/''${api}fort-wrapper-data.txt
fi
done
'';

doCheck = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
, blas
}:

assert !blas.isILP64;

stdenv.mkDerivation rec {
pname = "plumed";
version = "2.9.0";
Expand All @@ -21,6 +19,8 @@ stdenv.mkDerivation rec {
patchShebangs .
'';

configureFlags = [] ++ lib.optional blas.isILP64 "--enable-ilp64";

buildInputs = [ blas ];

enableParallelBuilding = true;
Expand Down
4 changes: 4 additions & 0 deletions pkgs/development/python-modules/mpi4py/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ buildPythonPackage rec {
substituteInPlace test/test_spawn.py --replace \
"unittest.skipMPI('openmpi(<3.0.0)')" \
"unittest.skipMPI('openmpi')"

substituteInPlace test/test_dynproc.py --replace \
"unittest.skipMPI('openmpi(<2.0.0)')" \
"unittest.skipMPI('openmpi')" \
'';

configurePhase = "";
Expand Down