gnu: r-zoo: Update to 1.8-7.
[jackhill/guix/guix.git] / gnu / packages / mpi.scm
CommitLineData
fb0e3709 1;;; GNU Guix --- Functional package management for GNU
41313ace 2;;; Copyright © 2014, 2015, 2018, 2019 Eric Bavier <bavier@member.fsf.org>
b07712bf 3;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
29a7c98a 4;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
37d6b097 5;;; Copyright © 2016 Andreas Enge <andreas@enge.fr>
1f9bff41 6;;; Copyright © 2017 Dave Love <fx@gnu.org>
91298042 7;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
fe390200 8;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
54fcd547 9;;; Copyright © 2018 Paul Garlick <pgarlick@tourbillion-technology.com>
e9823f9c 10;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
fb0e3709
EB
11;;;
12;;; This file is part of GNU Guix.
13;;;
14;;; GNU Guix is free software; you can redistribute it and/or modify it
15;;; under the terms of the GNU General Public License as published by
16;;; the Free Software Foundation; either version 3 of the License, or (at
17;;; your option) any later version.
18;;;
19;;; GNU Guix is distributed in the hope that it will be useful, but
20;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22;;; GNU General Public License for more details.
23;;;
24;;; You should have received a copy of the GNU General Public License
25;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27(define-module (gnu packages mpi)
28 #:use-module (guix packages)
2b0d560a
LC
29 #:use-module ((guix licenses)
30 #:hide (expat))
fb0e3709 31 #:use-module (guix download)
29a7c98a 32 #:use-module (guix utils)
8c8e1089 33 #:use-module (guix deprecation)
fb0e3709 34 #:use-module (guix build-system gnu)
54fcd547 35 #:use-module (guix build-system python)
fb0e3709 36 #:use-module (gnu packages)
e9823f9c 37 #:use-module (gnu packages fabric-management)
fb0e3709 38 #:use-module (gnu packages gcc)
fa5a2538 39 #:use-module (gnu packages java)
41313ace 40 #:use-module (gnu packages libevent)
2b0d560a
LC
41 #:use-module (gnu packages linux)
42 #:use-module (gnu packages pciutils)
43 #:use-module (gnu packages xorg)
44 #:use-module (gnu packages gtk)
45 #:use-module (gnu packages xml)
38f0a2ba 46 #:use-module (gnu packages perl)
2b0d560a 47 #:use-module (gnu packages ncurses)
b07712bf 48 #:use-module (gnu packages parallel)
2b0d560a 49 #:use-module (gnu packages pkg-config)
91298042 50 #:use-module (gnu packages valgrind)
71e78931 51 #:use-module (srfi srfi-1)
91298042 52 #:use-module (ice-9 match))
fb0e3709 53
8ec7ca22 54(define-public hwloc-1
71e78931
LC
55 ;; Note: For now we keep 1.x as the default because many packages have yet
56 ;; to migrate to 2.0.
2b0d560a
LC
57 (package
58 (name "hwloc")
9dd50845 59 (version "1.11.12")
2b0d560a
LC
60 (source (origin
61 (method url-fetch)
a2d0e200 62 (uri (string-append "https://www.open-mpi.org/software/hwloc/v"
ce7d9c98
EB
63 (version-major+minor version)
64 "/downloads/hwloc-" version ".tar.bz2"))
2b0d560a
LC
65 (sha256
66 (base32
9dd50845 67 "0za1b9lvrm3rhn0lrxja5f64r0aq1qs4m0pxn1ji2mbi8ndppyyx"))))
2b0d560a 68 (build-system gnu-build-system)
798b7678
LC
69 (outputs '("out" ;'lstopo' & co., depends on Cairo, libx11, etc.
70 "lib" ;small closure
71 "debug"))
2b0d560a 72 (inputs
5b527256 73 `(("libx11" ,libx11)
2b0d560a
LC
74 ("cairo" ,cairo)
75 ("ncurses" ,ncurses)
37d6b097
AE
76 ("expat" ,expat)
77 ,@(if (not (string-prefix? "armhf"
78 (or (%current-target-system)
79 (%current-system))))
80 `(("numactl" ,numactl))
81 '())))
c6e59259
LC
82 (propagated-inputs
83 ;; hwloc.pc lists it in 'Requires.private'.
84 `(("libpciaccess" ,libpciaccess)))
2b0d560a
LC
85 (native-inputs
86 `(("pkg-config" ,pkg-config)))
579f5c8a 87 (arguments
7eb9f31c
LC
88 `(#:configure-flags '("--localstatedir=/var")
89 #:phases
579f5c8a 90 (modify-phases %standard-phases
10de06bd
LC
91 (add-before 'check 'skip-linux-libnuma-test
92 (lambda _
93 ;; Arrange to skip 'tests/linux-libnuma', which fails on some
94 ;; machines: <https://github.com/open-mpi/hwloc/issues/213>.
95 (substitute* "tests/linux-libnuma.c"
96 (("numa_available\\(\\)")
97 "-1"))
98 #t))
798b7678
LC
99 (add-after 'install 'refine-libnuma
100 ;; Give -L arguments for libraries to avoid propagation
101 (lambda* (#:key inputs outputs #:allow-other-keys)
102 (let ((out (assoc-ref outputs "lib"))
103 (numa (assoc-ref inputs "numactl")))
104 (substitute* (map (lambda (f) (string-append out "/" f))
105 '("lib/pkgconfig/hwloc.pc" "lib/libhwloc.la"))
106 (("-lnuma" lib)
107 (string-append "-L" numa "/lib " lib))))))
108 (add-after 'install 'avoid-circular-references
109 (lambda* (#:key outputs #:allow-other-keys)
110 (let ((lib (assoc-ref outputs "lib")))
111 ;; Suppress the 'prefix=' and 'exec_prefix=' lines so that the
112 ;; "lib" output doesn't refer to "out".
113 (substitute* (string-append lib "/lib/pkgconfig/hwloc.pc")
114 (("^.*prefix=.*$")
115 ""))
116 #t))))))
a2d0e200 117 (home-page "https://www.open-mpi.org/projects/hwloc/")
2b0d560a
LC
118 (synopsis "Abstraction of hardware architectures")
119 (description
120 "hwloc provides a portable abstraction (across OS,
121versions, architectures, ...) of the hierarchical topology of modern
122architectures, including NUMA memory nodes, sockets, shared caches, cores and
123simultaneous multithreading. It also gathers various attributes such as cache
124and memory information. It primarily aims at helping high-performance
125computing applications with gathering information about the hardware so as to
126exploit it accordingly and efficiently.
127
128hwloc may display the topology in multiple convenient formats. It also offers
129a powerful programming interface to gather information about the hardware,
130bind processes, and much more.")
2b0d560a
LC
131 (license bsd-3)))
132
8c8e1089 133(define-public hwloc-2
71e78931
LC
134 ;; Note: 2.0 isn't the default yet, see above.
135 (package
8ec7ca22 136 (inherit hwloc-1)
8c8e1089 137 (version "2.1.0")
71e78931
LC
138 (source (origin
139 (method url-fetch)
140 (uri (string-append "https://www.open-mpi.org/software/hwloc/v"
141 (version-major+minor version)
142 "/downloads/hwloc-" version ".tar.bz2"))
143 (sha256
144 (base32
8c8e1089 145 "0qh8s7pphz0m5cwb7liqmc17xzfs23xhz5wn24r6ikvjyx99fhhr"))))
71e78931
LC
146
147 ;; libnuma is no longer needed.
0d8a8234 148 (inputs (alist-delete "numactl" (package-inputs hwloc-1)))
10de06bd 149 (arguments
0d8a8234 150 (substitute-keyword-arguments (package-arguments hwloc-1)
10de06bd
LC
151 ((#:phases phases)
152 `(modify-phases ,phases
153 (replace 'skip-linux-libnuma-test
154 (lambda _
155 ;; Arrange to skip 'tests/hwloc/linux-libnuma', which fails on
156 ;; some machines: <https://github.com/open-mpi/hwloc/issues/213>.
157 (substitute* "tests/hwloc/linux-libnuma.c"
158 (("numa_available\\(\\)")
159 "-1"))
160 #t))))))))
71e78931 161
9b65dea8 162(define-deprecated hwloc-2.0 hwloc-2)
8c8e1089 163
8ec7ca22
LC
164(define-public hwloc
165 ;; The latest stable series of hwloc.
166 hwloc-2)
167
fb0e3709
EB
168(define-public openmpi
169 (package
170 (name "openmpi")
8f02e5ac 171 (version "4.0.2")
fb0e3709
EB
172 (source
173 (origin
174 (method url-fetch)
6876590f 175 (uri (string-append "https://www.open-mpi.org/software/ompi/v"
29a7c98a 176 (version-major+minor version)
fb0e3709
EB
177 "/downloads/openmpi-" version ".tar.bz2"))
178 (sha256
faab7082 179 (base32 "0ms0zvyxyy3pnx9qwib6zaljyp2b3ixny64xvq3czv3jpr8zf2wh"))
68ac34e1 180 (patches (search-patches "openmpi-mtl-priorities.patch"))))
fb0e3709 181 (build-system gnu-build-system)
5b527256 182 (inputs
58a536bb 183 `(("hwloc" ,hwloc-2 "lib")
19afbea1 184 ("gfortran" ,gfortran)
a0995702 185 ("libfabric" ,libfabric)
41313ace 186 ("libevent" ,libevent)
e9823f9c 187 ("opensm" ,opensm)
a560641a
LC
188 ,@(if (and (not (%current-target-system))
189 (member (%current-system) (package-supported-systems psm)))
190 `(("psm" ,psm))
191 '())
fbe1b85b
LC
192 ,@(if (and (not (%current-target-system))
193 (member (%current-system) (package-supported-systems psm2)))
194 `(("psm2" ,psm2))
195 '())
8ba94edd 196 ,@(if (and (not (%current-target-system))
96a469f1 197 (member (%current-system) (package-supported-systems ucx)))
8ba94edd
LC
198 `(("ucx" ,ucx))
199 '())
a0995702 200 ("rdma-core" ,rdma-core)
b07712bf
LC
201 ("valgrind" ,valgrind)
202 ("slurm" ,slurm))) ;for PMI support (launching via "srun")
5b527256 203 (native-inputs
38f0a2ba
EB
204 `(("pkg-config" ,pkg-config)
205 ("perl" ,perl)))
c971d9ef 206 (outputs '("out" "debug"))
fb0e3709 207 (arguments
b08952f1 208 `(#:configure-flags `("--enable-mpi-ext=affinity" ;cr doesn't work
1691b4cd 209 "--enable-memchecker"
efcacc17 210 "--with-sge"
41313ace
EB
211 "--with-valgrind"
212 "--with-hwloc=external"
213 "--with-libevent"
e9823f9c
RW
214
215 ;; InfiniBand support
216 "--enable-openib-control-hdr-padding"
217 "--enable-openib-dynamic-sl"
218 "--enable-openib-udcm"
219 "--enable-openib-rdmacm"
220 "--enable-openib-rdmacm-ibaddr"
221
b07712bf
LC
222 ;; Enable support for SLURM's Process Manager
223 ;; Interface (PMI).
224 ,(string-append "--with-pmi="
225 (assoc-ref %build-inputs "slurm")))
9474a4b3 226 #:phases (modify-phases %standard-phases
e9823f9c
RW
227 ;; opensm is needed for InfiniBand support.
228 (add-after 'unpack 'find-opensm-headers
229 (lambda* (#:key inputs #:allow-other-keys)
230 (setenv "C_INCLUDE_PATH"
231 (string-append (assoc-ref inputs "opensm")
97149c57 232 "/include/infiniband"))
e9823f9c
RW
233 (setenv "CPLUS_INCLUDE_PATH"
234 (string-append (assoc-ref inputs "opensm")
97149c57 235 "/include/infiniband"))
e9823f9c 236 #t))
0d97d3cb 237 (add-before 'build 'remove-absolute
0d97d3cb 238 (lambda _
a247fe7b
DL
239 ;; Remove compiler absolute file names (OPAL_FC_ABSOLUTE
240 ;; etc.) to reduce the closure size. See
241 ;; <https://lists.gnu.org/archive/html/guix-devel/2017-07/msg00388.html>
242 ;; and
243 ;; <https://www.mail-archive.com/users@lists.open-mpi.org//msg31397.html>.
0d97d3cb
DL
244 (substitute* '("orte/tools/orte-info/param.c"
245 "oshmem/tools/oshmem_info/param.c"
246 "ompi/tools/ompi_info/param.c")
247 (("_ABSOLUTE") ""))
a247fe7b
DL
248 ;; Avoid valgrind (which pulls in gdb etc.).
249 (substitute*
41313ace
EB
250 '("./ompi/mca/io/romio321/src/io_romio321_component.c")
251 (("MCA_io_romio321_COMPLETE_CONFIGURE_FLAGS")
a247fe7b 252 "\"[elided to reduce closure]\""))
0d97d3cb 253 #t))
9474a4b3
EB
254 (add-before 'build 'scrub-timestamps ;reproducibility
255 (lambda _
256 (substitute* '("ompi/tools/ompi_info/param.c"
257 "orte/tools/orte-info/param.c"
258 "oshmem/tools/oshmem_info/param.c")
259 ((".*(Built|Configured) on.*") ""))
260 #t))
261 (add-after 'install 'remove-logs ;reproducibility
262 (lambda* (#:key outputs #:allow-other-keys)
263 (let ((out (assoc-ref outputs "out")))
264 (for-each delete-file (find-files out "config.log"))
265 #t))))))
fb0e3709 266 (home-page "http://www.open-mpi.org")
bb0f6d75 267 (synopsis "MPI-3 implementation")
fb0e3709 268 (description
bb0f6d75 269 "The Open MPI Project is an MPI-3 implementation that is developed and
8ede638c
EB
270maintained by a consortium of academic, research, and industry partners. Open
271MPI is therefore able to combine the expertise, technologies, and resources
272from all across the High Performance Computing community in order to build the
273best MPI library available. Open MPI offers advantages for system and
274software vendors, application developers and computer science researchers.")
fb0e3709
EB
275 ;; See file://LICENSE
276 (license bsd-2)))
685bef2b 277
fa5a2538
RW
278;; TODO: javadoc files contain timestamps.
279(define-public java-openmpi
280 (package (inherit openmpi)
281 (name "java-openmpi")
282 (inputs
283 `(("openmpi" ,openmpi)
284 ,@(package-inputs openmpi)))
285 (native-inputs
286 `(("jdk" ,openjdk11 "jdk")
287 ("zip" ,(@ (gnu packages compression) zip))
288 ,@(package-native-inputs openmpi)))
289 (outputs '("out"))
290 (arguments
291 `(#:modules ((guix build gnu-build-system)
292 ((guix build ant-build-system) #:prefix ant:)
293 (guix build utils))
294 #:imported-modules ((guix build ant-build-system)
295 (guix build syscalls)
296 ,@%gnu-build-system-modules)
297 ,@(substitute-keyword-arguments (package-arguments openmpi)
298 ((#:configure-flags flags)
299 `(cons "--enable-mpi-java" ,flags))
300 ((#:make-flags flags ''())
301 `(append '("-C" "ompi/mpi/java")
302 ,flags))
303 ((#:phases phases)
304 `(modify-phases ,phases
305 ;; We could provide the location of the JDK in the configure
306 ;; flags, but since the configure flags are embedded in the
307 ;; info binaries that would leave a reference to the JDK in
308 ;; the "out" output. To avoid this we set JAVA_HOME.
309 (add-after 'unpack 'set-JAVA_HOME
310 (lambda* (#:key inputs #:allow-other-keys)
311 (setenv "JAVA_HOME" (assoc-ref inputs "jdk"))
312 #t))
313 (add-after 'unpack 'link-with-existing-mpi-libraries
314 (lambda* (#:key inputs #:allow-other-keys)
315 (substitute* "ompi/mpi/java/c/Makefile.in"
316 (("\\$\\(top_builddir\\)/ompi/lib@OMPI_LIBMPI_NAME@.la")
317 (string-append (assoc-ref inputs "openmpi") "/lib/libmpi.la")))
318 #t))
319 (add-after 'install 'strip-jar-timestamps
320 (assoc-ref ant:%standard-phases 'strip-jar-timestamps)))))))
321 (synopsis "Java bindings for MPI")))
322
685bef2b
DL
323(define-public openmpi-thread-multiple
324 (package
325 (inherit openmpi)
326 (name "openmpi-thread-multiple")
327 (arguments
328 (substitute-keyword-arguments (package-arguments openmpi)
329 ((#:configure-flags flags)
330 `(cons "--enable-mpi-thread-multiple" ,flags))))
331 (description " This version of Open@tie{}MPI has an implementation of
332@code{MPI_Init_thread} that provides @code{MPI_THREAD_MULTIPLE}. This won't
333work correctly with all transports (such as @code{openib}), and the
334performance is generally worse than the vanilla @code{openmpi} package, which
335only provides @code{MPI_THREAD_FUNNELED}.")))
bbe46a4a
EB
336
337;;; Build phase to be used for packages that execute MPI code.
338(define-public %openmpi-setup
339 '(lambda _
340 ;; By default, running the test suite would fail because 'ssh' could not
341 ;; be found in $PATH. Define this variable to placate Open MPI without
342 ;; adding a dependency on OpenSSH (the agent isn't used anyway.)
343 (setenv "OMPI_MCA_plm_rsh_agent" (which "false"))
344 ;; Allow oversubscription in case there are less physical cores available
345 ;; in the build environment than the package wants while testing.
41313ace 346 (setenv "OMPI_MCA_rmaps_base_mapping_policy" "core:OVERSUBSCRIBE")
b1077c22
LC
347
348 ;; UCX sometimes outputs uninteresting warnings such as:
349 ;;
350 ;; mpool.c:38 UCX WARN object 0x7ffff44fffc0 was not returned to mpool ucp_am_bufs
351 ;;
352 ;; These in turn leads to failures of test suites that capture and
353 ;; compare stdout, such as that of 'hdf5-parallel-openmpi'. Thus, tell
354 ;; UCX to not emit those warnings.
355 (setenv "UCX_LOG_LEVEL" "error")
bbe46a4a 356 #t))
54fcd547
PG
357
358(define-public python-mpi4py
359 (package
360 (name "python-mpi4py")
fe390200 361 (version "3.0.3")
54fcd547 362 (source
fe390200
TGR
363 (origin
364 (method url-fetch)
365 (uri (pypi-uri "mpi4py" version))
366 (sha256
367 (base32 "07ssbhssv27rrjx1c5vd3vsr31vay5d8xcf4zh9yblcyidn72b81"))))
54fcd547
PG
368 (build-system python-build-system)
369 (arguments
370 `(#:phases
371 (modify-phases %standard-phases
372 (add-after 'build 'mpi-setup
373 ,%openmpi-setup)
374 (add-before 'check 'pre-check
375 (lambda _
376 ;; Skip BaseTestSpawn class (causes error 'ompi_dpm_dyn_init()
377 ;; failed --> Returned "Unreachable"' in chroot environment).
378 (substitute* "test/test_spawn.py"
379 (("unittest.skipMPI\\('openmpi\\(<3.0.0\\)'\\)")
380 "unittest.skipMPI('openmpi')"))
381 #t)))))
382 (inputs
383 `(("openmpi" ,openmpi)))
384 (home-page "https://bitbucket.org/mpi4py/mpi4py/")
385 (synopsis "Python bindings for the Message Passing Interface standard")
386 (description "MPI for Python (mpi4py) provides bindings of the Message
387Passing Interface (MPI) standard for the Python programming language, allowing
388any Python program to exploit multiple processors.
389
390mpi4py is constructed on top of the MPI-1/MPI-2 specification and provides an
391object oriented interface which closely follows MPI-2 C++ bindings. It
392supports point-to-point and collective communications of any picklable Python
393object as well as optimized communications of Python objects (such as NumPy
394arrays) that expose a buffer interface.")
395 (license bsd-3)))