diff mbox series

[bug#72062,3/4] gnu: Add openmpi-5.

Message ID 20240711143540.25601-3-romain.garbage@inria.fr
State New
Headers show
Series Add OpenMPI 5.x | expand

Commit Message

Romain GARBAGE July 11, 2024, 2:35 p.m. UTC
* gnu/packages/mpi.scm (openmpi-5): New variable.

Change-Id: I048692b2e928077c9cfa9fb8076ceb356251e1db
---
 gnu/packages/mpi.scm | 52 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

Comments

Ludovic Courtès July 12, 2024, 8:40 a.m. UTC | #1
Hello!

Romain GARBAGE <romain.garbage@inria.fr> skribis:

> * gnu/packages/mpi.scm (openmpi-5): New variable.
>
> Change-Id: I048692b2e928077c9cfa9fb8076ceb356251e1db

[...]

> +(define-public openmpi-5
> +  (package/inherit openmpi

I think it’s a case where (package (inherit openmpi) …) is more
appropriate: ‘package/inherit’ would cause the ‘replacement’ of
‘openmpi’ to be inherited, which is probably not a good idea since it’s
a different version.

> +     (substitute-keyword-arguments (package-arguments openmpi)
> +       ((#:configure-flags flags)
> +        #~(append (list "--enable-prte-prefix-by-default" ;replaces --enable-mpirun-prefix-by-default
> +                        ;; Enable support for the 'Process Management
> +                        ;; Interface for Exascale' (PMIx) used e.g. by
> +                        ;; Slurm for the management communication and
> +                        ;; coordination of MPI processes.
> +                        (string-append "--with-pmix=" #$(this-package-input "openpmix"))
> +                        (string-append "--with-prrte=" #$(this-package-input "prrte"))
> +
> +                        ;; Since 5.x, Infiniband support is provided by ucx.
> +                        (string-append "--with-ucx=" #$(this-package-input "ucx")))
> +                  (filter (lambda (e)
> +                            (and (not (string-contains e "pmi")) ;; Since 5.x, OpenMPI doesn't support PMI/PMI-2
> +                                 ;; Deprecated since 5.x.
> +                                 (not (string-contains e "enable-mpirun-prefix-by-default"))
> +                                 ;; Infiniband support is deprecated and superseded by ucx
> +                                 ;; See https://docs.open-mpi.org/en/main/release-notes/networks.html#miscellaneous-network-notes
> +                                 (not (string-contains e "openib"))))
> +                          #$flags)))

How about listing all the configure flags explicitly rather than
relative to those of 4.x?  I feel like this would be clearer and that
there’s little to be gained by factorizing anyway.

Thanks,
Ludo’.
Ludovic Courtès July 12, 2024, 8:42 a.m. UTC | #2
Romain GARBAGE <romain.garbage@inria.fr> skribis:

> +(define-public openmpi-5

Also, probably as a separate patch, you could rename ‘openmpi’ to
‘openmpi-4’ and add:

  (define-public openmpi openmpi-4)

That way, we’ll only have to touch that variable when we decide to
upgrade wholesale.

WDYT?

Ludo’.
diff mbox series

Patch

diff --git a/gnu/packages/mpi.scm b/gnu/packages/mpi.scm
index 6270108b16..8cde8ef044 100644
--- a/gnu/packages/mpi.scm
+++ b/gnu/packages/mpi.scm
@@ -8,6 +8,7 @@ 
 ;;; Copyright © 2018–2022 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Paul Garlick <pgarlick@tourbillion-technology.com>
 ;;; Copyright © 2019, 2021 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2024 Romain Garbage <romain.garbage@inria.fr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -49,6 +50,7 @@  (define-module (gnu packages mpi)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages parallel)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages valgrind)
   #:use-module (srfi srfi-1)
   #:use-module (ice-9 match))
@@ -307,6 +309,56 @@  (define-public openmpi
     ;; See file://LICENSE
     (license license:bsd-2)))
 
+(define-public openmpi-5
+  (package/inherit openmpi
+    (version "5.0.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://www.open-mpi.org/software/ompi/v"
+                           (version-major+minor version)
+                           "/downloads/openmpi-" version ".tar.bz2"))
+       (sha256
+        (base32 "02x9xmpggw77mdpikjjx83j6i4v3gkqbncda73lk5axk0vr841cr"))))
+
+    (inputs (modify-inputs (package-inputs openmpi)
+              ;; As of Open MPI 5.0.X, PMIx is used to communicate
+              ;; with SLURM, so SLURM'S PMI is no longer needed.
+              (delete "slurm")
+              (append ucx)              ;for Infiniband support
+              (append openpmix)         ;for PMI support (launching via "srun")
+              (append prrte)))          ;for PMI support (launching via "srun")
+    (native-inputs (modify-inputs (package-native-inputs openmpi)
+                     (append python)))
+
+    (outputs '("out" "debug"))
+    (arguments
+     (substitute-keyword-arguments (package-arguments openmpi)
+       ((#:configure-flags flags)
+        #~(append (list "--enable-prte-prefix-by-default" ;replaces --enable-mpirun-prefix-by-default
+                        ;; Enable support for the 'Process Management
+                        ;; Interface for Exascale' (PMIx) used e.g. by
+                        ;; Slurm for the management communication and
+                        ;; coordination of MPI processes.
+                        (string-append "--with-pmix=" #$(this-package-input "openpmix"))
+                        (string-append "--with-prrte=" #$(this-package-input "prrte"))
+
+                        ;; Since 5.x, Infiniband support is provided by ucx.
+                        (string-append "--with-ucx=" #$(this-package-input "ucx")))
+                  (filter (lambda (e)
+                            (and (not (string-contains e "pmi")) ;; Since 5.x, OpenMPI doesn't support PMI/PMI-2
+                                 ;; Deprecated since 5.x.
+                                 (not (string-contains e "enable-mpirun-prefix-by-default"))
+                                 ;; Infiniband support is deprecated and superseded by ucx
+                                 ;; See https://docs.open-mpi.org/en/main/release-notes/networks.html#miscellaneous-network-notes
+                                 (not (string-contains e "openib"))))
+                          #$flags)))
+
+       ((#:phases phases)
+        #~(modify-phases #$phases
+            (delete 'remove-absolute)
+            (delete 'scrub-timestamps)))))))
+
 (define-public openmpi-c++
   (package/inherit openmpi
     (name "openmpi-c++")