From e013f0d81ac7fb9e0b33de1df8bea33e8679ad17 Mon Sep 17 00:00:00 2001 From: Markus Kowalewski Date: Fri, 19 Jan 2018 16:16:35 -0800 Subject: [PATCH 1/4] openmpi: 1.10.7->3.0.0, add markuskowa as maintainer * add license * update description * add markuskowa as maintainer --- .../development/libraries/openmpi/default.nix | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/pkgs/development/libraries/openmpi/default.nix b/pkgs/development/libraries/openmpi/default.nix index c2f79753bd19..c8cfec3ab2dd 100644 --- a/pkgs/development/libraries/openmpi/default.nix +++ b/pkgs/development/libraries/openmpi/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, gfortran, perl, rdma-core +{ stdenv, fetchurl, gfortran, perl, libnl, rdma-core, zlib # Enable the Sun Grid Engine bindings , enableSGE ? false @@ -10,41 +10,47 @@ with stdenv.lib; let - majorVersion = "1.10"; + majorVersion = "3.0"; + minorVersion = "0"; in stdenv.mkDerivation rec { - name = "openmpi-${majorVersion}.7"; + name = "openmpi-${majorVersion}.${minorVersion}"; src = fetchurl { url = "http://www.open-mpi.org/software/ompi/v${majorVersion}/downloads/${name}.tar.bz2"; - sha256 = "142s1vny9gllkq336yafxayjgcirj2jv0ddabj879jgya7hyr2d0"; + sha256 = "1mw2d94k6mp4scg1wnkj50vdh734fy5m2ygyrj65s4mh3prbz6gn"; }; - buildInputs = [ gfortran ] - ++ optional (stdenv.isLinux || stdenv.isFreeBSD) rdma-core; + postPatch = '' + patchShebangs ./ + ''; + + buildInputs = with stdenv; [ gfortran zlib ] + ++ optional isLinux libnl + ++ optional (isLinux || isFreeBSD) rdma-core; nativeBuildInputs = [ perl ]; configureFlags = [] + ++ optional stdenv.isLinux "--with-libnl=${libnl.dev}" ++ optional enableSGE "--with-sge" ++ optional enablePrefix "--enable-mpirun-prefix-by-default" ; enableParallelBuilding = true; - preBuild = '' - patchShebangs ompi/mpi/fortran/base/gen-mpi-sizeof.pl - ''; - postInstall = '' - rm -f $out/lib/*.la + rm -f $out/lib/*.la ''; + doCheck = true; + meta = { homepage = http://www.open-mpi.org/; - description = "Open source MPI-2 implementation"; - longDescription = "The Open MPI Project is an open source MPI-2 implementation that is developed and maintained by a consortium of academic, research, and industry partners. Open MPI is therefore able to combine the expertise, technologies, and resources from all across the High Performance Computing community in order to build the best MPI library available. Open MPI offers advantages for system and software vendors, application developers and computer science researchers."; - maintainers = [ ]; + description = "Open source MPI-3 implementation"; + longDescription = "The Open MPI Project is an open source MPI-3 implementation that is developed and maintained by a consortium of academic, research, and industry partners. Open MPI is therefore able to combine the expertise, technologies, and resources from all across the High Performance Computing community in order to build the best MPI library available. Open MPI offers advantages for system and software vendors, application developers and computer science researchers."; + maintainers = with maintainers; [ markuskowa ]; + license = licenses.bsd3; platforms = platforms.unix; }; } From 58765282f821216795a75c5cc130a75a02120df8 Mon Sep 17 00:00:00 2001 From: Markus Kowalewski Date: Thu, 25 Jan 2018 13:31:45 -0800 Subject: [PATCH 2/4] openmpi: refactor --- pkgs/development/libraries/openmpi/default.nix | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/pkgs/development/libraries/openmpi/default.nix b/pkgs/development/libraries/openmpi/default.nix index c8cfec3ab2dd..3f764b1d8453 100644 --- a/pkgs/development/libraries/openmpi/default.nix +++ b/pkgs/development/libraries/openmpi/default.nix @@ -7,8 +7,6 @@ , enablePrefix ? false }: -with stdenv.lib; - let majorVersion = "3.0"; minorVersion = "0"; @@ -26,15 +24,15 @@ in stdenv.mkDerivation rec { ''; buildInputs = with stdenv; [ gfortran zlib ] - ++ optional isLinux libnl - ++ optional (isLinux || isFreeBSD) rdma-core; + ++ lib.optional isLinux libnl + ++ lib.optional (isLinux || isFreeBSD) rdma-core; nativeBuildInputs = [ perl ]; - configureFlags = [] - ++ optional stdenv.isLinux "--with-libnl=${libnl.dev}" - ++ optional enableSGE "--with-sge" - ++ optional enablePrefix "--enable-mpirun-prefix-by-default" + configureFlags = with stdenv; [] + ++ lib.optional isLinux "--with-libnl=${libnl.dev}" + ++ lib.optional enableSGE "--with-sge" + ++ lib.optional enablePrefix "--enable-mpirun-prefix-by-default" ; enableParallelBuilding = true; @@ -45,7 +43,7 @@ in stdenv.mkDerivation rec { doCheck = true; - meta = { + meta = with stdenv.lib; { homepage = http://www.open-mpi.org/; description = "Open source MPI-3 implementation"; longDescription = "The Open MPI Project is an open source MPI-3 implementation that is developed and maintained by a consortium of academic, research, and industry partners. Open MPI is therefore able to combine the expertise, technologies, and resources from all across the High Performance Computing community in order to build the best MPI library available. Open MPI offers advantages for system and software vendors, application developers and computer science researchers."; From aa83877cf874f38d998262e25e5cf1e547181e2f Mon Sep 17 00:00:00 2001 From: Markus Kowalewski Date: Fri, 26 Jan 2018 18:26:22 -0800 Subject: [PATCH 3/4] mpi4py/h5py: fix test to run reliably with openmpi-3 --- pkgs/development/python-modules/h5py/default.nix | 8 ++++++-- pkgs/development/python-modules/mpi4py/default.nix | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pkgs/development/python-modules/h5py/default.nix b/pkgs/development/python-modules/h5py/default.nix index e9bae3f82060..bdbdcdcc2e74 100644 --- a/pkgs/development/python-modules/h5py/default.nix +++ b/pkgs/development/python-modules/h5py/default.nix @@ -1,6 +1,6 @@ { stdenv, fetchurl, python, buildPythonPackage , numpy, hdf5, cython, six, pkgconfig -, mpi4py ? null }: +, mpi4py ? null, openssh }: assert hdf5.mpiSupport -> mpi4py != null && hdf5.mpi == mpi4py.mpi; @@ -24,6 +24,10 @@ in buildPythonPackage rec { postConfigure = '' ${python.executable} setup.py configure ${configure_flags} + + # Needed to run the tests reliably. See: + # https://bitbucket.org/mpi4py/mpi4py/issues/87/multiple-test-errors-with-openmpi-30 + ${optionalString mpiSupport "export OMPI_MCA_rmaps_base_oversubscribe=yes"} ''; preBuild = if mpiSupport then "export CC=${mpi}/bin/mpicc" else ""; @@ -33,7 +37,7 @@ in buildPythonPackage rec { ++ optional mpiSupport mpi ; propagatedBuildInputs = [ numpy six] - ++ optional mpiSupport mpi4py + ++ optionals mpiSupport [ mpi4py openssh ] ; meta = { diff --git a/pkgs/development/python-modules/mpi4py/default.nix b/pkgs/development/python-modules/mpi4py/default.nix index fcbca62ff9df..9329d386099c 100644 --- a/pkgs/development/python-modules/mpi4py/default.nix +++ b/pkgs/development/python-modules/mpi4py/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchPypi, python, buildPythonPackage, mpi }: +{ stdenv, fetchPypi, python, buildPythonPackage, mpi, openssh }: buildPythonPackage rec { pname = "mpi4py"; @@ -28,11 +28,15 @@ buildPythonPackage rec { # sometimes packages specify where files should be installed outside the usual # python lib prefix, we override that back so all infrastructure (setup hooks) # work as expected + + # Needed to run the tests reliably. See: + # https://bitbucket.org/mpi4py/mpi4py/issues/87/multiple-test-errors-with-openmpi-30 + export OMPI_MCA_rmaps_base_oversubscribe=yes ''; setupPyBuildFlags = ["--mpicc=${mpi}/bin/mpicc"]; - buildInputs = [ mpi ]; + buildInputs = [ mpi openssh ]; meta = { description = From 389a130e6df3ef4e918e1fea7e4026c2584c1290 Mon Sep 17 00:00:00 2001 From: Markus Kowalewski Date: Sat, 10 Feb 2018 22:34:36 -0800 Subject: [PATCH 4/4] mpi4py: disable test_spawn.py test_spawn.py fails when build with openmpi-3.0.0 in a sandboxed environment. --- pkgs/development/python-modules/mpi4py/default.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/development/python-modules/mpi4py/default.nix b/pkgs/development/python-modules/mpi4py/default.nix index 9329d386099c..d4750f252ad0 100644 --- a/pkgs/development/python-modules/mpi4py/default.nix +++ b/pkgs/development/python-modules/mpi4py/default.nix @@ -14,6 +14,12 @@ buildPythonPackage rec { inherit mpi; }; + postPatch = '' + substituteInPlace test/test_spawn.py --replace \ + "unittest.skipMPI('openmpi(<3.0.0)')" \ + "unittest.skipMPI('openmpi')" + ''; + configurePhase = ""; installPhase = ''