gnu: Remove WebKitGTK@2.20.
[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>
b9b53fb4 8;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
54fcd547 9;;; Copyright © 2018 Paul Garlick <pgarlick@tourbillion-technology.com>
fb0e3709
EB
10;;;
11;;; This file is part of GNU Guix.
12;;;
13;;; GNU Guix is free software; you can redistribute it and/or modify it
14;;; under the terms of the GNU General Public License as published by
15;;; the Free Software Foundation; either version 3 of the License, or (at
16;;; your option) any later version.
17;;;
18;;; GNU Guix is distributed in the hope that it will be useful, but
19;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21;;; GNU General Public License for more details.
22;;;
23;;; You should have received a copy of the GNU General Public License
24;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
26(define-module (gnu packages mpi)
27 #:use-module (guix packages)
2b0d560a
LC
28 #:use-module ((guix licenses)
29 #:hide (expat))
fb0e3709 30 #:use-module (guix download)
29a7c98a 31 #:use-module (guix utils)
fb0e3709 32 #:use-module (guix build-system gnu)
54fcd547 33 #:use-module (guix build-system python)
fb0e3709
EB
34 #:use-module (gnu packages)
35 #:use-module (gnu packages gcc)
41313ace 36 #:use-module (gnu packages libevent)
2b0d560a
LC
37 #:use-module (gnu packages linux)
38 #:use-module (gnu packages pciutils)
39 #:use-module (gnu packages xorg)
40 #:use-module (gnu packages gtk)
41 #:use-module (gnu packages xml)
38f0a2ba 42 #:use-module (gnu packages perl)
2b0d560a 43 #:use-module (gnu packages ncurses)
b07712bf 44 #:use-module (gnu packages parallel)
2b0d560a 45 #:use-module (gnu packages pkg-config)
91298042 46 #:use-module (gnu packages valgrind)
71e78931 47 #:use-module (srfi srfi-1)
91298042 48 #:use-module (ice-9 match))
fb0e3709 49
2b0d560a 50(define-public hwloc
71e78931
LC
51 ;; Note: For now we keep 1.x as the default because many packages have yet
52 ;; to migrate to 2.0.
2b0d560a
LC
53 (package
54 (name "hwloc")
9dd50845 55 (version "1.11.12")
2b0d560a
LC
56 (source (origin
57 (method url-fetch)
a2d0e200 58 (uri (string-append "https://www.open-mpi.org/software/hwloc/v"
ce7d9c98
EB
59 (version-major+minor version)
60 "/downloads/hwloc-" version ".tar.bz2"))
2b0d560a
LC
61 (sha256
62 (base32
9dd50845 63 "0za1b9lvrm3rhn0lrxja5f64r0aq1qs4m0pxn1ji2mbi8ndppyyx"))))
2b0d560a 64 (build-system gnu-build-system)
798b7678
LC
65 (outputs '("out" ;'lstopo' & co., depends on Cairo, libx11, etc.
66 "lib" ;small closure
67 "debug"))
2b0d560a 68 (inputs
5b527256 69 `(("libx11" ,libx11)
2b0d560a
LC
70 ("cairo" ,cairo)
71 ("ncurses" ,ncurses)
37d6b097
AE
72 ("expat" ,expat)
73 ,@(if (not (string-prefix? "armhf"
74 (or (%current-target-system)
75 (%current-system))))
76 `(("numactl" ,numactl))
77 '())))
c6e59259
LC
78 (propagated-inputs
79 ;; hwloc.pc lists it in 'Requires.private'.
80 `(("libpciaccess" ,libpciaccess)))
2b0d560a
LC
81 (native-inputs
82 `(("pkg-config" ,pkg-config)))
579f5c8a 83 (arguments
7eb9f31c
LC
84 `(#:configure-flags '("--localstatedir=/var")
85 #:phases
579f5c8a 86 (modify-phases %standard-phases
10de06bd
LC
87 (add-before 'check 'skip-linux-libnuma-test
88 (lambda _
89 ;; Arrange to skip 'tests/linux-libnuma', which fails on some
90 ;; machines: <https://github.com/open-mpi/hwloc/issues/213>.
91 (substitute* "tests/linux-libnuma.c"
92 (("numa_available\\(\\)")
93 "-1"))
94 #t))
798b7678
LC
95 (add-after 'install 'refine-libnuma
96 ;; Give -L arguments for libraries to avoid propagation
97 (lambda* (#:key inputs outputs #:allow-other-keys)
98 (let ((out (assoc-ref outputs "lib"))
99 (numa (assoc-ref inputs "numactl")))
100 (substitute* (map (lambda (f) (string-append out "/" f))
101 '("lib/pkgconfig/hwloc.pc" "lib/libhwloc.la"))
102 (("-lnuma" lib)
103 (string-append "-L" numa "/lib " lib))))))
104 (add-after 'install 'avoid-circular-references
105 (lambda* (#:key outputs #:allow-other-keys)
106 (let ((lib (assoc-ref outputs "lib")))
107 ;; Suppress the 'prefix=' and 'exec_prefix=' lines so that the
108 ;; "lib" output doesn't refer to "out".
109 (substitute* (string-append lib "/lib/pkgconfig/hwloc.pc")
110 (("^.*prefix=.*$")
111 ""))
112 #t))))))
a2d0e200 113 (home-page "https://www.open-mpi.org/projects/hwloc/")
2b0d560a
LC
114 (synopsis "Abstraction of hardware architectures")
115 (description
116 "hwloc provides a portable abstraction (across OS,
117versions, architectures, ...) of the hierarchical topology of modern
118architectures, including NUMA memory nodes, sockets, shared caches, cores and
119simultaneous multithreading. It also gathers various attributes such as cache
120and memory information. It primarily aims at helping high-performance
121computing applications with gathering information about the hardware so as to
122exploit it accordingly and efficiently.
123
124hwloc may display the topology in multiple convenient formats. It also offers
125a powerful programming interface to gather information about the hardware,
126bind processes, and much more.")
2b0d560a
LC
127 (license bsd-3)))
128
71e78931
LC
129(define-public hwloc-2.0
130 ;; Note: 2.0 isn't the default yet, see above.
131 (package
132 (inherit hwloc)
cb85742f 133 (version "2.0.3")
71e78931
LC
134 (source (origin
135 (method url-fetch)
136 (uri (string-append "https://www.open-mpi.org/software/hwloc/v"
137 (version-major+minor version)
138 "/downloads/hwloc-" version ".tar.bz2"))
139 (sha256
140 (base32
cb85742f 141 "09f7ajak8wv5issr0hw72vs3jkldc7crcc7z5fd34sspkvrsm4z3"))))
71e78931
LC
142
143 ;; libnuma is no longer needed.
10de06bd
LC
144 (inputs (alist-delete "numactl" (package-inputs hwloc)))
145 (arguments
146 (substitute-keyword-arguments (package-arguments hwloc)
147 ((#:phases phases)
148 `(modify-phases ,phases
149 (replace 'skip-linux-libnuma-test
150 (lambda _
151 ;; Arrange to skip 'tests/hwloc/linux-libnuma', which fails on
152 ;; some machines: <https://github.com/open-mpi/hwloc/issues/213>.
153 (substitute* "tests/hwloc/linux-libnuma.c"
154 (("numa_available\\(\\)")
155 "-1"))
156 #t))))))))
71e78931 157
fb0e3709
EB
158(define-public openmpi
159 (package
160 (name "openmpi")
41313ace 161 (version "4.0.0")
fb0e3709
EB
162 (source
163 (origin
164 (method url-fetch)
6876590f 165 (uri (string-append "https://www.open-mpi.org/software/ompi/v"
29a7c98a 166 (version-major+minor version)
fb0e3709
EB
167 "/downloads/openmpi-" version ".tar.bz2"))
168 (sha256
169 (base32
41313ace 170 "0srnjwzsmyhka9hhnmqm86qck4w3xwjm8g6sbns58wzbrwv8l2rg"))))
fb0e3709 171 (build-system gnu-build-system)
5b527256 172 (inputs
798b7678 173 `(("hwloc" ,hwloc "lib")
19afbea1 174 ("gfortran" ,gfortran)
a0995702 175 ("libfabric" ,libfabric)
41313ace 176 ("libevent" ,libevent)
a560641a
LC
177 ,@(if (and (not (%current-target-system))
178 (member (%current-system) (package-supported-systems psm)))
179 `(("psm" ,psm))
180 '())
fbe1b85b
LC
181 ,@(if (and (not (%current-target-system))
182 (member (%current-system) (package-supported-systems psm2)))
183 `(("psm2" ,psm2))
184 '())
a0995702 185 ("rdma-core" ,rdma-core)
b07712bf
LC
186 ("valgrind" ,valgrind)
187 ("slurm" ,slurm))) ;for PMI support (launching via "srun")
5b527256 188 (native-inputs
38f0a2ba
EB
189 `(("pkg-config" ,pkg-config)
190 ("perl" ,perl)))
c971d9ef 191 (outputs '("out" "debug"))
fb0e3709 192 (arguments
b08952f1 193 `(#:configure-flags `("--enable-mpi-ext=affinity" ;cr doesn't work
1691b4cd 194 "--enable-memchecker"
efcacc17 195 "--with-sge"
41313ace
EB
196 "--with-psm"
197 "--with-psm2"
198 "--with-valgrind"
199 "--with-hwloc=external"
200 "--with-libevent"
b07712bf
LC
201 ;; Enable support for SLURM's Process Manager
202 ;; Interface (PMI).
203 ,(string-append "--with-pmi="
204 (assoc-ref %build-inputs "slurm")))
9474a4b3 205 #:phases (modify-phases %standard-phases
0d97d3cb 206 (add-before 'build 'remove-absolute
0d97d3cb 207 (lambda _
a247fe7b
DL
208 ;; Remove compiler absolute file names (OPAL_FC_ABSOLUTE
209 ;; etc.) to reduce the closure size. See
210 ;; <https://lists.gnu.org/archive/html/guix-devel/2017-07/msg00388.html>
211 ;; and
212 ;; <https://www.mail-archive.com/users@lists.open-mpi.org//msg31397.html>.
0d97d3cb
DL
213 (substitute* '("orte/tools/orte-info/param.c"
214 "oshmem/tools/oshmem_info/param.c"
215 "ompi/tools/ompi_info/param.c")
216 (("_ABSOLUTE") ""))
a247fe7b
DL
217 ;; Avoid valgrind (which pulls in gdb etc.).
218 (substitute*
41313ace
EB
219 '("./ompi/mca/io/romio321/src/io_romio321_component.c")
220 (("MCA_io_romio321_COMPLETE_CONFIGURE_FLAGS")
a247fe7b 221 "\"[elided to reduce closure]\""))
0d97d3cb 222 #t))
9474a4b3
EB
223 (add-before 'build 'scrub-timestamps ;reproducibility
224 (lambda _
225 (substitute* '("ompi/tools/ompi_info/param.c"
226 "orte/tools/orte-info/param.c"
227 "oshmem/tools/oshmem_info/param.c")
228 ((".*(Built|Configured) on.*") ""))
229 #t))
230 (add-after 'install 'remove-logs ;reproducibility
231 (lambda* (#:key outputs #:allow-other-keys)
232 (let ((out (assoc-ref outputs "out")))
233 (for-each delete-file (find-files out "config.log"))
234 #t))))))
fb0e3709 235 (home-page "http://www.open-mpi.org")
bb0f6d75 236 (synopsis "MPI-3 implementation")
fb0e3709 237 (description
bb0f6d75 238 "The Open MPI Project is an MPI-3 implementation that is developed and
8ede638c
EB
239maintained by a consortium of academic, research, and industry partners. Open
240MPI is therefore able to combine the expertise, technologies, and resources
241from all across the High Performance Computing community in order to build the
242best MPI library available. Open MPI offers advantages for system and
243software vendors, application developers and computer science researchers.")
fb0e3709
EB
244 ;; See file://LICENSE
245 (license bsd-2)))
685bef2b
DL
246
247(define-public openmpi-thread-multiple
248 (package
249 (inherit openmpi)
250 (name "openmpi-thread-multiple")
251 (arguments
252 (substitute-keyword-arguments (package-arguments openmpi)
253 ((#:configure-flags flags)
254 `(cons "--enable-mpi-thread-multiple" ,flags))))
255 (description " This version of Open@tie{}MPI has an implementation of
256@code{MPI_Init_thread} that provides @code{MPI_THREAD_MULTIPLE}. This won't
257work correctly with all transports (such as @code{openib}), and the
258performance is generally worse than the vanilla @code{openmpi} package, which
259only provides @code{MPI_THREAD_FUNNELED}.")))
bbe46a4a
EB
260
261;;; Build phase to be used for packages that execute MPI code.
262(define-public %openmpi-setup
263 '(lambda _
264 ;; By default, running the test suite would fail because 'ssh' could not
265 ;; be found in $PATH. Define this variable to placate Open MPI without
266 ;; adding a dependency on OpenSSH (the agent isn't used anyway.)
267 (setenv "OMPI_MCA_plm_rsh_agent" (which "false"))
268 ;; Allow oversubscription in case there are less physical cores available
269 ;; in the build environment than the package wants while testing.
41313ace 270 (setenv "OMPI_MCA_rmaps_base_mapping_policy" "core:OVERSUBSCRIBE")
bbe46a4a 271 #t))
54fcd547
PG
272
273(define-public python-mpi4py
274 (package
275 (name "python-mpi4py")
276 (version "3.0.0")
277 (source
278 (origin
279 (method url-fetch)
280 (uri (pypi-uri "mpi4py" version))
281 (sha256
282 (base32
283 "1mzgd26dfv4vwbci8gq77ss9f0x26i9aqzq9b9vs9ndxhlnv0mxl"))))
284 (build-system python-build-system)
285 (arguments
286 `(#:phases
287 (modify-phases %standard-phases
288 (add-after 'build 'mpi-setup
289 ,%openmpi-setup)
290 (add-before 'check 'pre-check
291 (lambda _
292 ;; Skip BaseTestSpawn class (causes error 'ompi_dpm_dyn_init()
293 ;; failed --> Returned "Unreachable"' in chroot environment).
294 (substitute* "test/test_spawn.py"
295 (("unittest.skipMPI\\('openmpi\\(<3.0.0\\)'\\)")
296 "unittest.skipMPI('openmpi')"))
297 #t)))))
298 (inputs
299 `(("openmpi" ,openmpi)))
300 (home-page "https://bitbucket.org/mpi4py/mpi4py/")
301 (synopsis "Python bindings for the Message Passing Interface standard")
302 (description "MPI for Python (mpi4py) provides bindings of the Message
303Passing Interface (MPI) standard for the Python programming language, allowing
304any Python program to exploit multiple processors.
305
306mpi4py is constructed on top of the MPI-1/MPI-2 specification and provides an
307object oriented interface which closely follows MPI-2 C++ bindings. It
308supports point-to-point and collective communications of any picklable Python
309object as well as optimized communications of Python objects (such as NumPy
310arrays) that expose a buffer interface.")
311 (license bsd-3)))