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