gnu: python-dateutil: Update to 2.7.3.
[jackhill/guix/guix.git] / gnu / packages / mpi.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014, 2015 Eric Bavier <bavier@member.fsf.org>
3 ;;; Copyright © 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
4 ;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
5 ;;; Copyright © 2016 Andreas Enge <andreas@enge.fr>
6 ;;; Copyright © 2017 Dave Love <fx@gnu.org>
7 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
8 ;;;
9 ;;; This file is part of GNU Guix.
10 ;;;
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
15 ;;;
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
20 ;;;
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24 (define-module (gnu packages mpi)
25 #:use-module (guix packages)
26 #:use-module ((guix licenses)
27 #:hide (expat))
28 #:use-module (guix download)
29 #:use-module (guix utils)
30 #:use-module (guix build-system gnu)
31 #:use-module (gnu packages)
32 #:use-module (gnu packages gcc)
33 #:use-module (gnu packages linux)
34 #:use-module (gnu packages pciutils)
35 #:use-module (gnu packages xorg)
36 #:use-module (gnu packages gtk)
37 #:use-module (gnu packages xml)
38 #:use-module (gnu packages perl)
39 #:use-module (gnu packages ncurses)
40 #:use-module (gnu packages pkg-config)
41 #:use-module (gnu packages valgrind)
42 #:use-module (srfi srfi-1)
43 #:use-module (ice-9 match))
44
45 (define-public hwloc
46 ;; Note: For now we keep 1.x as the default because many packages have yet
47 ;; to migrate to 2.0.
48 (package
49 (name "hwloc")
50 (version "1.11.10")
51 (source (origin
52 (method url-fetch)
53 (uri (string-append "https://www.open-mpi.org/software/hwloc/v"
54 (version-major+minor version)
55 "/downloads/hwloc-" version ".tar.bz2"))
56 (sha256
57 (base32
58 "1ryibcng40xcq22lsj85fn2vcvrksdx9rr3wwxpq8dw37lw0is1b"))))
59 (build-system gnu-build-system)
60 (outputs '("out" ;'lstopo' & co., depends on Cairo, libx11, etc.
61 "lib" ;small closure
62 "debug"))
63 (inputs
64 `(("libx11" ,libx11)
65 ("cairo" ,cairo)
66 ("ncurses" ,ncurses)
67 ("expat" ,expat)
68 ,@(if (not (string-prefix? "armhf"
69 (or (%current-target-system)
70 (%current-system))))
71 `(("numactl" ,numactl))
72 '())))
73 (propagated-inputs
74 ;; hwloc.pc lists it in 'Requires.private'.
75 `(("libpciaccess" ,libpciaccess)))
76 (native-inputs
77 `(("pkg-config" ,pkg-config)))
78 (arguments
79 `(#:configure-flags '("--localstatedir=/var")
80 #:phases
81 (modify-phases %standard-phases
82 (add-before 'check 'skip-linux-libnuma-test
83 (lambda _
84 ;; Arrange to skip 'tests/linux-libnuma', which fails on some
85 ;; machines: <https://github.com/open-mpi/hwloc/issues/213>.
86 (substitute* "tests/linux-libnuma.c"
87 (("numa_available\\(\\)")
88 "-1"))
89 #t))
90 (add-after 'install 'refine-libnuma
91 ;; Give -L arguments for libraries to avoid propagation
92 (lambda* (#:key inputs outputs #:allow-other-keys)
93 (let ((out (assoc-ref outputs "lib"))
94 (numa (assoc-ref inputs "numactl")))
95 (substitute* (map (lambda (f) (string-append out "/" f))
96 '("lib/pkgconfig/hwloc.pc" "lib/libhwloc.la"))
97 (("-lnuma" lib)
98 (string-append "-L" numa "/lib " lib))))))
99 (add-after 'install 'avoid-circular-references
100 (lambda* (#:key outputs #:allow-other-keys)
101 (let ((lib (assoc-ref outputs "lib")))
102 ;; Suppress the 'prefix=' and 'exec_prefix=' lines so that the
103 ;; "lib" output doesn't refer to "out".
104 (substitute* (string-append lib "/lib/pkgconfig/hwloc.pc")
105 (("^.*prefix=.*$")
106 ""))
107 #t))))))
108 (home-page "https://www.open-mpi.org/projects/hwloc/")
109 (synopsis "Abstraction of hardware architectures")
110 (description
111 "hwloc provides a portable abstraction (across OS,
112 versions, architectures, ...) of the hierarchical topology of modern
113 architectures, including NUMA memory nodes, sockets, shared caches, cores and
114 simultaneous multithreading. It also gathers various attributes such as cache
115 and memory information. It primarily aims at helping high-performance
116 computing applications with gathering information about the hardware so as to
117 exploit it accordingly and efficiently.
118
119 hwloc may display the topology in multiple convenient formats. It also offers
120 a powerful programming interface to gather information about the hardware,
121 bind processes, and much more.")
122 (license bsd-3)))
123
124 (define-public hwloc-2.0
125 ;; Note: 2.0 isn't the default yet, see above.
126 (package
127 (inherit hwloc)
128 (version "2.0.1")
129 (source (origin
130 (method url-fetch)
131 (uri (string-append "https://www.open-mpi.org/software/hwloc/v"
132 (version-major+minor version)
133 "/downloads/hwloc-" version ".tar.bz2"))
134 (sha256
135 (base32
136 "0jf0krj1h95flmb784ifv9vnkdnajjz00p4zbhmja7vm4v67axdr"))))
137
138 ;; libnuma is no longer needed.
139 (inputs (alist-delete "numactl" (package-inputs hwloc)))
140 (arguments
141 (substitute-keyword-arguments (package-arguments hwloc)
142 ((#:phases phases)
143 `(modify-phases ,phases
144 (replace 'skip-linux-libnuma-test
145 (lambda _
146 ;; Arrange to skip 'tests/hwloc/linux-libnuma', which fails on
147 ;; some machines: <https://github.com/open-mpi/hwloc/issues/213>.
148 (substitute* "tests/hwloc/linux-libnuma.c"
149 (("numa_available\\(\\)")
150 "-1"))
151 #t))))))))
152
153 (define-public openmpi
154 (package
155 (name "openmpi")
156 (version "3.0.1")
157 (source
158 (origin
159 (method url-fetch)
160 (uri (string-append "https://www.open-mpi.org/software/ompi/v"
161 (version-major+minor version)
162 "/downloads/openmpi-" version ".tar.bz2"))
163 (sha256
164 (base32
165 "0pbqrm5faf57nasy1s81wqivl7zvxmv8lzjh8hvb0f3qxv8m0d36"))))
166 (build-system gnu-build-system)
167 (inputs
168 `(("hwloc" ,hwloc "lib")
169 ("gfortran" ,gfortran)
170 ("libfabric" ,libfabric)
171 ,@(if (and (not (%current-target-system))
172 (member (%current-system) (package-supported-systems psm)))
173 `(("psm" ,psm))
174 '())
175 ,@(if (and (not (%current-target-system))
176 (member (%current-system) (package-supported-systems psm2)))
177 `(("psm2" ,psm2))
178 '())
179 ("rdma-core" ,rdma-core)
180 ("valgrind" ,valgrind)))
181 (native-inputs
182 `(("pkg-config" ,pkg-config)
183 ("perl" ,perl)))
184 (outputs '("out" "debug"))
185 (arguments
186 `(#:configure-flags `("--enable-mpi-ext=affinity" ;cr doesn't work
187 "--enable-memchecker"
188 "--with-sge"
189
190 ;; VampirTrace is obsoleted by scorep and disabling
191 ;; it reduces the closure size considerably.
192 "--disable-vt"
193
194 ,(string-append "--with-valgrind="
195 (assoc-ref %build-inputs "valgrind"))
196 ,(string-append "--with-hwloc="
197 (assoc-ref %build-inputs "hwloc")))
198 #:phases (modify-phases %standard-phases
199 (add-before 'build 'remove-absolute
200 (lambda _
201 ;; Remove compiler absolute file names (OPAL_FC_ABSOLUTE
202 ;; etc.) to reduce the closure size. See
203 ;; <https://lists.gnu.org/archive/html/guix-devel/2017-07/msg00388.html>
204 ;; and
205 ;; <https://www.mail-archive.com/users@lists.open-mpi.org//msg31397.html>.
206 (substitute* '("orte/tools/orte-info/param.c"
207 "oshmem/tools/oshmem_info/param.c"
208 "ompi/tools/ompi_info/param.c")
209 (("_ABSOLUTE") ""))
210 ;; Avoid valgrind (which pulls in gdb etc.).
211 (substitute*
212 '("./ompi/mca/io/romio314/src/io_romio314_component.c")
213 (("MCA_io_romio314_COMPLETE_CONFIGURE_FLAGS")
214 "\"[elided to reduce closure]\""))
215 #t))
216 (add-before 'build 'scrub-timestamps ;reproducibility
217 (lambda _
218 (substitute* '("ompi/tools/ompi_info/param.c"
219 "orte/tools/orte-info/param.c"
220 "oshmem/tools/oshmem_info/param.c")
221 ((".*(Built|Configured) on.*") ""))
222 #t))
223 (add-after 'install 'remove-logs ;reproducibility
224 (lambda* (#:key outputs #:allow-other-keys)
225 (let ((out (assoc-ref outputs "out")))
226 (for-each delete-file (find-files out "config.log"))
227 #t))))))
228 (home-page "http://www.open-mpi.org")
229 (synopsis "MPI-3 implementation")
230 (description
231 "The Open MPI Project is an MPI-3 implementation that is developed and
232 maintained by a consortium of academic, research, and industry partners. Open
233 MPI is therefore able to combine the expertise, technologies, and resources
234 from all across the High Performance Computing community in order to build the
235 best MPI library available. Open MPI offers advantages for system and
236 software vendors, application developers and computer science researchers.")
237 ;; See file://LICENSE
238 (license bsd-2)))
239
240 (define-public openmpi-thread-multiple
241 (package
242 (inherit openmpi)
243 (name "openmpi-thread-multiple")
244 (arguments
245 (substitute-keyword-arguments (package-arguments openmpi)
246 ((#:configure-flags flags)
247 `(cons "--enable-mpi-thread-multiple" ,flags))))
248 (description " This version of Open@tie{}MPI has an implementation of
249 @code{MPI_Init_thread} that provides @code{MPI_THREAD_MULTIPLE}. This won't
250 work correctly with all transports (such as @code{openib}), and the
251 performance is generally worse than the vanilla @code{openmpi} package, which
252 only provides @code{MPI_THREAD_FUNNELED}.")))