diff --git a/bsc/intel-mpi/default.nix b/bsc/intel-mpi/default.nix index 82b0f79..1f6f511 100644 --- a/bsc/intel-mpi/default.nix +++ b/bsc/intel-mpi/default.nix @@ -6,7 +6,6 @@ , enableDebug ? false }: - stdenv.mkDerivation rec { name = "intel-mpi-${version}"; version = "2019.7.217"; @@ -31,31 +30,43 @@ stdenv.mkDerivation rec { ''; }; - dontBuild = true; - installPhase = '' - mkdir -p $out - rpmextract rpm/intel-mpi-*.rpm - cd opt/intel/compilers_and_libraries_2020.1.217/linux/mpi/intel64 + buildInputs = [ + rpmextract + libfabric + patchelf + ]; + postUnpack = '' + pushd $sourceRoot + rpmextract rpm/intel-mpi-*.rpm + popd + ''; + + patches = [ + ./mpicc.patch + ./mpicxx.patch + ]; + + postPatch = '' for i in bin/mpi* ; do sed -i "s:I_MPI_SUBSTITUTE_INSTALLDIR:$out:g" $i done + ''; + dontBuild = true; + + installPhase = '' + cd opt/intel/compilers_and_libraries_2020.1.217/linux/mpi/intel64 + mkdir -p $out mv etc $out mv bin $out mv include $out - mkdir $out/lib cp -a lib/lib* $out/lib cp -a lib/${lib_variant}_mt/lib* $out/lib - - ''; preFixup = '' - echo $out/lib contains: - ls -l $out/lib - echo ---------------------- find $out/bin -type f -executable -exec \ patchelf \ --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ @@ -64,10 +75,4 @@ stdenv.mkDerivation rec { find $out/lib -name '*.so' -exec \ patchelf --set-rpath "$out/lib:${stdenv.cc}/lib:${stdenv.glibc}/lib:${libfabric}/lib" '{}' \; ''; - - buildInputs = [ - rpmextract - libfabric - patchelf - ]; } diff --git a/bsc/intel-mpi/mpicc.patch b/bsc/intel-mpi/mpicc.patch new file mode 100644 index 0000000..953b4f7 --- /dev/null +++ b/bsc/intel-mpi/mpicc.patch @@ -0,0 +1,20 @@ +--- a/opt/intel/compilers_and_libraries_2020.1.217/linux/mpi/intel64/bin/mpicc 2020-06-30 14:22:04.510566478 +0200 ++++ b/opt/intel/compilers_and_libraries_2020.1.217/linux/mpi/intel64/bin/mpicc 2020-06-30 14:24:58.250998988 +0200 +@@ -50,7 +50,7 @@ + if [ x"$opt_args" == x"" ]; then + case "${compiler_short_name}" in + icc) $dir/mpiicc -cc=$compiler_name "$@" ;; +- cc|*gcc*) $dir/mpigcc -cc=$compiler_name "$@" ;; ++ cc|*gcc*|mcc|clang) $dir/mpigcc -cc=$compiler_name "$@" ;; + mpicc) $dir/mpigcc "$@" ;; + *) + echo "Error: unsupported compiler name '$compiler_name'." +@@ -60,7 +60,7 @@ + else + case "${compiler_short_name}" in + icc) $dir/mpiicc -cc=$compiler_name "$@" $opt_args ;; +- cc|*gcc*) $dir/mpigcc -cc=$compiler_name "$@" $opt_args ;; ++ cc|*gcc*|mcc|clang) $dir/mpigcc -cc=$compiler_name "$@" $opt_args ;; + mpicc) $dir/mpigcc "$@" $opt_args ;; + *) + echo "Error: unsupported compiler name '$compiler_name'." diff --git a/bsc/intel-mpi/mpicxx.patch b/bsc/intel-mpi/mpicxx.patch new file mode 100644 index 0000000..a386007 --- /dev/null +++ b/bsc/intel-mpi/mpicxx.patch @@ -0,0 +1,28 @@ +--- a/opt/intel/compilers_and_libraries_2020.1.217/linux/mpi/intel64/bin/mpicxx 2020-06-30 14:26:14.619723932 +0200 ++++ b/opt/intel/compilers_and_libraries_2020.1.217/linux/mpi/intel64/bin/mpicxx 2020-06-30 14:27:56.644687134 +0200 +@@ -49,9 +49,9 @@ + + if [ x"$opt_args" == x"" ]; then + case "${compiler_short_name}" in +- icc|icpc) $dir/mpiicpc -cxx=$compiler_name "$@" ;; +- *g++*) $dir/mpigxx -cxx=$compiler_name "$@" ;; +- mpicxx) $dir/mpigxx "$@" ;; ++ icc|icpc) $dir/mpiicpc -cxx=$compiler_name "$@" ;; ++ *g++*|clang*++|mcxx) $dir/mpigxx -cxx=$compiler_name "$@" ;; ++ mpicxx) $dir/mpigxx "$@" ;; + *) + echo "Error: unsupported compiler name '$compiler_name'." + echo "Check -cxx= command line option and I_MPI_CXX='$I_MPI_CXX' and MPICH_CXX='$MPICH_CXX' variables."; +@@ -59,9 +59,9 @@ + esac + else + case "${compiler_short_name}" in +- icc|icpc) $dir/mpiicpc -cxx=$compiler_name "$@" $opt_args ;; +- *g++*) $dir/mpigxx -cxx=$compiler_name "$@" $opt_args ;; +- mpicxx) $dir/mpigxx "$@" $opt_args ;; ++ icc|icpc) $dir/mpiicpc -cxx=$compiler_name "$@" $opt_args ;; ++ *g++*|clang*++|mcxx) $dir/mpigxx -cxx=$compiler_name "$@" $opt_args ;; ++ mpicxx) $dir/mpigxx "$@" $opt_args ;; + *) + echo "Error: unsupported compiler name '$compiler_name'." + echo "Check -cxx= command line option and I_MPI_CXX='$I_MPI_CXX' and MPICH_CXX='$MPICH_CXX' variables.";