From 8a86fdd51c0318cba32a3ef0c41199280f3626bc Mon Sep 17 00:00:00 2001 From: Jan Schmitz <44864658+danjujan@users.noreply.github.com> Date: Tue, 16 Apr 2024 13:39:19 +0200 Subject: [PATCH] Bump openmpi based on https://github.com/NixOS/nixpkgs/pull/275796 --- pkgs/by-name/pr/prrte/package.nix | 52 ++++++++ .../development/libraries/openmpi/default.nix | 114 +++++++++--------- pkgs/development/libraries/pmix/default.nix | 2 +- .../science/chemistry/plumed/default.nix | 4 +- 4 files changed, 109 insertions(+), 63 deletions(-) create mode 100644 pkgs/by-name/pr/prrte/package.nix diff --git a/pkgs/by-name/pr/prrte/package.nix b/pkgs/by-name/pr/prrte/package.nix new file mode 100644 index 0000000000000..71220d6b23fe4 --- /dev/null +++ b/pkgs/by-name/pr/prrte/package.nix @@ -0,0 +1,52 @@ +{ lib +, stdenv +, fetchFromGitHub +, autoconf +, automake +, libtool +, gitMinimal +, perl +, python3 +, flex +, hwloc +, libevent +, zlib +, pmix +, +}: + +stdenv.mkDerivation rec { + pname = "prrte"; + version = "3.0.3"; + + src = fetchFromGitHub { + owner = "openpmix"; + repo = "prrte"; + rev = "v${version}"; + sha256 = "sha256-WjK26jbte1iYngEfjVfwGXIMhU5aDhmWwUl/fYPrmfw="; + fetchSubmodules = true; + }; + + postPatch = '' + patchShebangs ./autogen.pl + patchShebangs ./config + ''; + + preConfigure = '' + ./autogen.pl + ''; + + nativeBuildInputs = [ 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; + }; +} diff --git a/pkgs/development/libraries/openmpi/default.nix b/pkgs/development/libraries/openmpi/default.nix index 8c54c13c9139e..018c8c8e47a40 100644 --- a/pkgs/development/libraries/openmpi/default.nix +++ b/pkgs/development/libraries/openmpi/default.nix @@ -1,7 +1,8 @@ -{ lib, stdenv, fetchurl, removeReferencesTo, gfortran, perl, libnl +{ lib, stdenv, fetchurl, gfortran, perl , rdma-core, zlib, numactl, libevent, hwloc, targetPackages, symlinkJoin -, libpsm2, libfabric, pmix, ucx, ucc, makeWrapper +, libpsm2, libfabric, pmix, ucx, ucc , config + # Enable CUDA support , cudaSupport ? config.cudaSupport, cudaPackages @@ -16,106 +17,99 @@ # Enable Fortran support , fortranSupport ? true + +# AVX/SSE options +, enableSse3 ? stdenv.hostPlatform.sse3Support +, enableSse4_1 ? stdenv.hostPlatform.sse4_1Support +, enableAvx ? true #stdenv.hostPlatform.avxSupport +, enableAvx2 ? stdenv.hostPlatform.avx2Support +, enableAvx512 ? stdenv.hostPlatform.avx512Support }: stdenv.mkDerivation rec { pname = "openmpi"; - version = "4.1.6"; + version = "5.0.2"; 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-7katju7iw/9wdyFgv/h3y/OMMwoLw7PdyBFkizOWaY8="; }; 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 'ompi_cv_op_avx_check_sse3=yes' 'ompi_cv_op_avx_check_sse3=no'"} + ${lib.optionalString (!enableSse4_1) + "substituteInPlace configure --replace 'ompi_cv_op_avx_check_sse41=yes' 'ompi_cv_op_avx_check_sse41=no'"} + ${lib.optionalString (!enableAvx) + "substituteInPlace configure --replace 'ompi_cv_op_avx_check_avx=yes' 'ompi_cv_op_avx_check_avx=no'"} + ${lib.optionalString (!enableAvx2) + "substituteInPlace configure --replace 'ompi_cv_op_avx_check_avx2=yes' 'ompi_cv_op_avx_check_avx2=no'"} + ${lib.optionalString (!enableAvx512) + "substituteInPlace configure --replace 'ompi_cv_op_avx_check_avx512=yes' 'ompi_cv_op_avx_check_av512=no'"} ''; - outputs = [ "out" "man" "dev" ]; + 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 + ''; - buildInputs = [ zlib ] - ++ lib.optionals stdenv.isLinux [ libnl numactl pmix ucx ucc ] + outputs = [ "out" "man" ]; + + buildInputs = [ zlib libevent hwloc ] + ++ lib.optionals stdenv.isLinux [ numactl pmix ucx ucc ] ++ lib.optionals cudaSupport [ cudaPackages.cuda_cudart ] - ++ [ libevent hwloc ] ++ lib.optional (stdenv.isLinux || stdenv.isFreeBSD) rdma-core ++ lib.optionals fabricSupport [ libpsm2 libfabric ]; - nativeBuildInputs = [ perl removeReferencesTo makeWrapper ] + nativeBuildInputs = [ perl ] ++ lib.optionals cudaSupport [ cudaPackages.cuda_nvcc ] ++ lib.optionals fortranSupport [ gfortran ]; configureFlags = lib.optional (!cudaSupport) "--disable-mca-dso" ++ 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" + ]; enableParallelBuilding = true; postInstall = '' find $out/lib/ -name "*.la" -exec rm -f \{} \; - - for f in mpi shmem osh; do - for i in f77 f90 CC c++ cxx cc fort; do - moveToOutput "bin/$f$i" "''${!outputDev}" - echo "move $fi$i" - moveToOutput "share/openmpi/$f$i-wrapper-data.txt" "''${!outputDev}" - done - done - - for i in ortecc orte-info ompi_info oshmem_info opal_wrapper; do - moveToOutput "bin/$i" "''${!outputDev}" - done - - 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}) - - # 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 + for cfg in mpicc shmemcc; do + sed -i 's:compiler=.*:compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc:' \ + "$out/share/openmpi/$cfg-wrapper-data.txt" + done - 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 + for cfg in mpic++ shmemc++; do + sed -i 's:compiler=.*:compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}c++:' \ + "$out/share/openmpi/$cfg-wrapper-data.txt" + done '' + 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 - + for cfg in mpifort shmemfort; do + sed -i 's:compiler=.*:compiler=${gfortran}/bin/${gfortran.targetPrefix}gfortran:' \ + "$out/share/openmpi/$cfg-wrapper-data.txt" + done ''; doCheck = true; diff --git a/pkgs/development/libraries/pmix/default.nix b/pkgs/development/libraries/pmix/default.nix index 78605179f710f..f102f73dbff22 100644 --- a/pkgs/development/libraries/pmix/default.nix +++ b/pkgs/development/libraries/pmix/default.nix @@ -36,7 +36,7 @@ stdenv.mkDerivation rec { makeWrapper ]; - buildInputs = [ libevent hwloc munge zlib ]; + buildInputs = [ libevent hwloc munge zlib python3 ]; configureFlags = [ "--with-libevent=${lib.getDev libevent}" diff --git a/pkgs/development/libraries/science/chemistry/plumed/default.nix b/pkgs/development/libraries/science/chemistry/plumed/default.nix index b825c8270d628..2d1388b3008a6 100644 --- a/pkgs/development/libraries/science/chemistry/plumed/default.nix +++ b/pkgs/development/libraries/science/chemistry/plumed/default.nix @@ -4,8 +4,6 @@ , blas }: -assert !blas.isILP64; - stdenv.mkDerivation rec { pname = "plumed"; version = "2.9.0"; @@ -21,6 +19,8 @@ stdenv.mkDerivation rec { patchShebangs . ''; + configureFlags = [] ++ lib.optional blas.isILP64 "--enable-ilp64"; + buildInputs = [ blas ]; enableParallelBuilding = true;