gnu: facter: Update to 4.0.33.
[jackhill/guix/guix.git] / gnu / packages / mpi.scm
index f08a7f5..b39c507 100644 (file)
@@ -1,12 +1,13 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015, 2018 Eric Bavier <bavier@member.fsf.org>
-;;; Copyright © 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2015, 2018, 2019 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
 ;;; Copyright © 2016 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2017 Dave Love <fx@gnu.org>
 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
-;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Paul Garlick <pgarlick@tourbillion-technology.com>
+;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
 
 (define-module (gnu packages mpi)
   #:use-module (guix packages)
-  #:use-module ((guix licenses)
-                #:hide (expat))
+  #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix download)
   #:use-module (guix utils)
+  #:use-module (guix deprecation)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
   #:use-module (gnu packages)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages compression)
+  #:use-module (gnu packages fabric-management)
   #:use-module (gnu packages gcc)
+  #:use-module (gnu packages java)
+  #:use-module (gnu packages libevent)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages pciutils)
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages parallel)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages valgrind)
   #:use-module (srfi srfi-1)
   #:use-module (ice-9 match))
 
-(define-public hwloc
+(define-public hwloc-1
   ;; Note: For now we keep 1.x as the default because many packages have yet
   ;; to migrate to 2.0.
   (package
     (name "hwloc")
-    (version "1.11.10")
+    (version "1.11.12")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://www.open-mpi.org/software/hwloc/v"
@@ -58,7 +65,7 @@
                                   "/downloads/hwloc-" version ".tar.bz2"))
               (sha256
                (base32
-                "1ryibcng40xcq22lsj85fn2vcvrksdx9rr3wwxpq8dw37lw0is1b"))))
+                "0za1b9lvrm3rhn0lrxja5f64r0aq1qs4m0pxn1ji2mbi8ndppyyx"))))
     (build-system gnu-build-system)
     (outputs '("out"           ;'lstopo' & co., depends on Cairo, libx11, etc.
                "lib"           ;small closure
@@ -122,13 +129,13 @@ exploit it accordingly and efficiently.
 hwloc may display the topology in multiple convenient formats.  It also offers
 a powerful programming interface to gather information about the hardware,
 bind processes, and much more.")
-    (license bsd-3)))
+    (license license:bsd-3)))
 
-(define-public hwloc-2.0
+(define-public hwloc-2
   ;; Note: 2.0 isn't the default yet, see above.
   (package
-    (inherit hwloc)
-    (version "2.0.2")
+    (inherit hwloc-1)
+    (version "2.2.0")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://www.open-mpi.org/software/hwloc/v"
@@ -136,12 +143,12 @@ bind processes, and much more.")
                                   "/downloads/hwloc-" version ".tar.bz2"))
               (sha256
                (base32
-                "1phc863d5b2fvwpyyq4mlh4rkjdslh6h0h197zmyk3prwrq7si8l"))))
+                "0li27a3lnmb77qxpijj0kpblz32wmqd3b386sypq8ar7vy9vhw5f"))))
 
     ;; libnuma is no longer needed.
-    (inputs (alist-delete "numactl" (package-inputs hwloc)))
+    (inputs (alist-delete "numactl" (package-inputs hwloc-1)))
     (arguments
-     (substitute-keyword-arguments (package-arguments hwloc)
+     (substitute-keyword-arguments (package-arguments hwloc-1)
        ((#:phases phases)
         `(modify-phases ,phases
            (replace 'skip-linux-libnuma-test
@@ -151,12 +158,26 @@ bind processes, and much more.")
                (substitute* "tests/hwloc/linux-libnuma.c"
                  (("numa_available\\(\\)")
                   "-1"))
+               #t))
+           (add-before 'check 'skip-test-that-fails-on-qemu
+             (lambda _
+               ;; Skip test that fails on emulated hardware due to QEMU bug:
+               ;; <https://bugs.gnu.org/40342>.
+               (substitute* "tests/hwloc/hwloc_get_last_cpu_location.c"
+                 (("hwloc_topology_init" all)
+                  (string-append "exit (77);\n" all)))
                #t))))))))
 
+(define-deprecated hwloc-2.0 hwloc-2)
+
+(define-public hwloc
+  ;; The latest stable series of hwloc.
+  hwloc-2)
+
 (define-public openmpi
   (package
     (name "openmpi")
-    (version "3.0.1")
+    (version "4.0.3")
     (source
      (origin
       (method url-fetch)
@@ -164,13 +185,15 @@ bind processes, and much more.")
                           (version-major+minor version)
                           "/downloads/openmpi-" version ".tar.bz2"))
       (sha256
-       (base32
-        "0pbqrm5faf57nasy1s81wqivl7zvxmv8lzjh8hvb0f3qxv8m0d36"))))
+       (base32 "00zxcw99gr5n693cmcmn4f6a47vx1ywna895p0x7p163v37gw0hl"))
+      (patches (search-patches "openmpi-mtl-priorities.patch"))))
     (build-system gnu-build-system)
     (inputs
-     `(("hwloc" ,hwloc "lib")
+     `(("hwloc" ,hwloc-2 "lib")
        ("gfortran" ,gfortran)
        ("libfabric" ,libfabric)
+       ("libevent" ,libevent)
+       ("opensm" ,opensm)
        ,@(if (and (not (%current-target-system))
                   (member (%current-system) (package-supported-systems psm)))
              `(("psm" ,psm))
@@ -179,8 +202,13 @@ bind processes, and much more.")
                   (member (%current-system) (package-supported-systems psm2)))
              `(("psm2" ,psm2))
              '())
+       ,@(if (and (not (%current-target-system))
+                  (member (%current-system) (package-supported-systems ucx)))
+             `(("ucx" ,ucx))
+             '())
        ("rdma-core" ,rdma-core)
-       ("valgrind" ,valgrind)))
+       ("valgrind" ,valgrind)
+       ("slurm" ,slurm)))              ;for PMI support (launching via "srun")
     (native-inputs
      `(("pkg-config" ,pkg-config)
        ("perl" ,perl)))
@@ -189,16 +217,32 @@ bind processes, and much more.")
      `(#:configure-flags `("--enable-mpi-ext=affinity" ;cr doesn't work
                            "--enable-memchecker"
                            "--with-sge"
+                           "--with-valgrind"
+                           "--with-hwloc=external"
+                           "--with-libevent"
 
-                           ;; VampirTrace is obsoleted by scorep and disabling
-                           ;; it reduces the closure size considerably.
-                           "--disable-vt"
+                           ;; InfiniBand support
+                           "--enable-openib-control-hdr-padding"
+                           "--enable-openib-dynamic-sl"
+                           "--enable-openib-udcm"
+                           "--enable-openib-rdmacm"
+                           "--enable-openib-rdmacm-ibaddr"
 
-                           ,(string-append "--with-valgrind="
-                                           (assoc-ref %build-inputs "valgrind"))
-                           ,(string-append "--with-hwloc="
-                                           (assoc-ref %build-inputs "hwloc")))
+                           ;; Enable support for SLURM's Process Manager
+                           ;; Interface (PMI).
+                           ,(string-append "--with-pmi="
+                                           (assoc-ref %build-inputs "slurm")))
        #:phases (modify-phases %standard-phases
+                  ;; opensm is needed for InfiniBand support.
+                  (add-after 'unpack 'find-opensm-headers
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      (setenv "C_INCLUDE_PATH"
+                              (string-append (assoc-ref inputs "opensm")
+                                             "/include/infiniband"))
+                      (setenv "CPLUS_INCLUDE_PATH"
+                              (string-append (assoc-ref inputs "opensm")
+                                             "/include/infiniband"))
+                      #t))
                   (add-before 'build 'remove-absolute
                     (lambda _
                       ;; Remove compiler absolute file names (OPAL_FC_ABSOLUTE
@@ -212,8 +256,8 @@ bind processes, and much more.")
                         (("_ABSOLUTE") ""))
                       ;; Avoid valgrind (which pulls in gdb etc.).
                       (substitute*
-                          '("./ompi/mca/io/romio314/src/io_romio314_component.c")
-                        (("MCA_io_romio314_COMPLETE_CONFIGURE_FLAGS")
+                          '("./ompi/mca/io/romio321/src/io_romio321_component.c")
+                        (("MCA_io_romio321_COMPLETE_CONFIGURE_FLAGS")
                          "\"[elided to reduce closure]\""))
                       #t))
                   (add-before 'build 'scrub-timestamps ;reproducibility
@@ -228,7 +272,7 @@ bind processes, and much more.")
                       (let ((out (assoc-ref outputs "out")))
                         (for-each delete-file (find-files out "config.log"))
                         #t))))))
-    (home-page "http://www.open-mpi.org")
+    (home-page "https://www.open-mpi.org")
     (synopsis "MPI-3 implementation")
     (description
      "The Open MPI Project is an MPI-3 implementation that is developed and
@@ -238,7 +282,52 @@ 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.")
     ;; See file://LICENSE
-    (license bsd-2)))
+    (license license:bsd-2)))
+
+;; TODO: javadoc files contain timestamps.
+(define-public java-openmpi
+  (package (inherit openmpi)
+    (name "java-openmpi")
+    (inputs
+     `(("openmpi" ,openmpi)
+       ,@(package-inputs openmpi)))
+    (native-inputs
+     `(("jdk" ,openjdk11 "jdk")
+       ("zip" ,(@ (gnu packages compression) zip))
+       ,@(package-native-inputs openmpi)))
+    (outputs '("out"))
+    (arguments
+     `(#:modules ((guix build gnu-build-system)
+                  ((guix build ant-build-system) #:prefix ant:)
+                  (guix build utils))
+       #:imported-modules ((guix build ant-build-system)
+                           (guix build syscalls)
+                           ,@%gnu-build-system-modules)
+       ,@(substitute-keyword-arguments (package-arguments openmpi)
+           ((#:configure-flags flags)
+            `(cons "--enable-mpi-java" ,flags))
+           ((#:make-flags flags ''())
+            `(append '("-C" "ompi/mpi/java")
+                     ,flags))
+           ((#:phases phases)
+            `(modify-phases ,phases
+               ;; We could provide the location of the JDK in the configure
+               ;; flags, but since the configure flags are embedded in the
+               ;; info binaries that would leave a reference to the JDK in
+               ;; the "out" output.  To avoid this we set JAVA_HOME.
+               (add-after 'unpack 'set-JAVA_HOME
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   (setenv "JAVA_HOME" (assoc-ref inputs "jdk"))
+                   #t))
+               (add-after 'unpack 'link-with-existing-mpi-libraries
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   (substitute* "ompi/mpi/java/c/Makefile.in"
+                     (("\\$\\(top_builddir\\)/ompi/lib@OMPI_LIBMPI_NAME@.la")
+                      (string-append (assoc-ref inputs "openmpi") "/lib/libmpi.la")))
+                   #t))
+               (add-after 'install 'strip-jar-timestamps
+                 (assoc-ref ant:%standard-phases 'strip-jar-timestamps)))))))
+    (synopsis "Java bindings for MPI")))
 
 (define-public openmpi-thread-multiple
   (package
@@ -263,20 +352,28 @@ only provides @code{MPI_THREAD_FUNNELED}.")))
      (setenv "OMPI_MCA_plm_rsh_agent" (which "false"))
      ;; Allow oversubscription in case there are less physical cores available
      ;; in the build environment than the package wants while testing.
-     (setenv "OMPI_MCA_rmaps_base_oversubscribe" "yes")
+     (setenv "OMPI_MCA_rmaps_base_mapping_policy" "core:OVERSUBSCRIBE")
+
+     ;; UCX sometimes outputs uninteresting warnings such as:
+     ;;
+     ;;   mpool.c:38   UCX  WARN  object 0x7ffff44fffc0 was not returned to mpool ucp_am_bufs
+     ;;
+     ;; These in turn leads to failures of test suites that capture and
+     ;; compare stdout, such as that of 'hdf5-parallel-openmpi'.  Thus, tell
+     ;; UCX to not emit those warnings.
+     (setenv "UCX_LOG_LEVEL" "error")
      #t))
 
 (define-public python-mpi4py
   (package
     (name "python-mpi4py")
-    (version "3.0.0")
+    (version "3.0.3")
     (source
-      (origin
-        (method url-fetch)
-        (uri (pypi-uri "mpi4py" version))
-        (sha256
-          (base32
-            "1mzgd26dfv4vwbci8gq77ss9f0x26i9aqzq9b9vs9ndxhlnv0mxl"))))
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "mpi4py" version))
+       (sha256
+        (base32 "07ssbhssv27rrjx1c5vd3vsr31vay5d8xcf4zh9yblcyidn72b81"))))
     (build-system python-build-system)
     (arguments
      `(#:phases
@@ -304,4 +401,81 @@ object oriented interface which closely follows MPI-2 C++ bindings.  It
 supports point-to-point and collective communications of any picklable Python
 object as well as optimized communications of Python objects (such as NumPy
 arrays) that expose a buffer interface.")
-    (license bsd-3)))
+    (license license:bsd-3)))
+
+(define-public mpich
+  (package
+    (name "mpich")
+    (version "3.3.2")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://www.mpich.org/static/downloads/"
+                                  version "/mpich-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1farz5zfx4cd0c3a0wb9pgfypzw0xxql1j1294z1sxslga1ziyjb"))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("zlib" ,zlib)
+       ("hwloc" ,hwloc-2 "lib")
+       ("slurm" ,slurm)
+       ,@(if (and (not (%current-target-system))
+                  (member (%current-system) (package-supported-systems ucx)))
+             `(("ucx" ,ucx))
+             '())))
+    (native-inputs
+     `(("perl" ,perl)
+       ("which" ,which)
+       ("gfortran" ,gfortran)))
+    (outputs '("out" "debug"))
+    (arguments
+     `(#:configure-flags
+       (list "--disable-silent-rules"             ;let's see what's happening
+             "--enable-debuginfo"
+             ;; "--with-device=ch4:ucx" ; --with-device=ch4:ofi segfaults in tests
+             (string-append "--with-hwloc-prefix="
+                            (assoc-ref %build-inputs "hwloc"))
+
+             ,@(if (assoc "ucx" (package-inputs this-package))
+                   `((string-append "--with-ucx="
+                                    (assoc-ref %build-inputs "ucx")))
+                   '()))
+
+       #:phases (modify-phases %standard-phases
+                  (add-after 'unpack 'patch-sources
+                    (lambda _
+                      (substitute* "./maint/gen_subcfg_m4"
+                        (("/usr/bin/env") (which "env")))
+                      (substitute* "src/glue/romio/all_romio_symbols"
+                        (("/usr/bin/env") (which "env")))
+                      (substitute* (find-files "." "buildiface")
+                        (("/usr/bin/env") (which "env")))
+                      (substitute* "maint/extracterrmsgs"
+                        (("/usr/bin/env") (which "env")))
+                      (substitute* (find-files "." "f77tof90")
+                        (("/usr/bin/env") (which "env")))
+                      (substitute* (find-files "." "\\.sh$")
+                        (("/bin/sh") (which "sh")))
+                      #t))
+                  (add-before 'configure 'fix-makefile
+                    (lambda _
+                      ;; Remove "@hwloclib@" from 'pmpi_convenience_libs'.
+                      ;; This fixes "No rule to make target '-lhwloc', needed
+                      ;; by 'lib/libmpi.la'".
+                      (substitute* "Makefile.in"
+                        (("^pmpi_convenience_libs = (.*) @hwloclib@ (.*)$" _
+                          before after)
+                         (string-append "pmpi_convenience_libs = "
+                                        before " " after)))
+                      #t)))))
+    (home-page "https://www.mpich.org/")
+    (synopsis "Implementation of the Message Passing Interface (MPI)")
+    (description
+     "MPICH is a high-performance and portable implementation of the Message
+Passing Interface (MPI) standard (MPI-1, MPI-2 and MPI-3).  MPICH provides an
+MPI implementation that efficiently supports different computation and
+communication platforms including commodity clusters, high-speed networks (10
+Gigabit Ethernet, InfiniBand, Myrinet, Quadrics), and proprietary high-end
+computing systems (Blue Gene, Cray).  It enables research in MPI through a
+modular framework for other derived implementations.")
+    (license license:bsd-2)))