gnu: fish: Update to 2.7.1.
[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 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 (ice-9 match))
43
44 (define-public hwloc
45 (package
46 (name "hwloc")
47 (version "1.11.8")
48 (source (origin
49 (method url-fetch)
50 (uri (string-append "https://www.open-mpi.org/software/hwloc/v"
51 (version-major+minor version)
52 "/downloads/hwloc-" version ".tar.bz2"))
53 (sha256
54 (base32
55 "0karxv4r1r8sa7ki5aamlxdvyvz0bvzq4gdhq0yi5nc4a0k11vzc"))))
56 (build-system gnu-build-system)
57 (outputs '("out" ;'lstopo' & co., depends on Cairo, libx11, etc.
58 "lib" ;small closure
59 "debug"))
60 (inputs
61 `(("libx11" ,libx11)
62 ("cairo" ,cairo)
63 ("ncurses" ,ncurses)
64 ("expat" ,expat)
65 ,@(if (not (string-prefix? "armhf"
66 (or (%current-target-system)
67 (%current-system))))
68 `(("numactl" ,numactl))
69 '())))
70 (propagated-inputs
71 ;; hwloc.pc lists it in 'Requires.private'.
72 `(("libpciaccess" ,libpciaccess)))
73 (native-inputs
74 `(("pkg-config" ,pkg-config)))
75 (arguments
76 `(#:configure-flags '("--localstatedir=/var")
77 #:phases
78 (modify-phases %standard-phases
79 (add-after 'install 'refine-libnuma
80 ;; Give -L arguments for libraries to avoid propagation
81 (lambda* (#:key inputs outputs #:allow-other-keys)
82 (let ((out (assoc-ref outputs "lib"))
83 (numa (assoc-ref inputs "numactl")))
84 (substitute* (map (lambda (f) (string-append out "/" f))
85 '("lib/pkgconfig/hwloc.pc" "lib/libhwloc.la"))
86 (("-lnuma" lib)
87 (string-append "-L" numa "/lib " lib))))))
88 (add-after 'install 'avoid-circular-references
89 (lambda* (#:key outputs #:allow-other-keys)
90 (let ((lib (assoc-ref outputs "lib")))
91 ;; Suppress the 'prefix=' and 'exec_prefix=' lines so that the
92 ;; "lib" output doesn't refer to "out".
93 (substitute* (string-append lib "/lib/pkgconfig/hwloc.pc")
94 (("^.*prefix=.*$")
95 ""))
96 #t))))))
97 (home-page "https://www.open-mpi.org/projects/hwloc/")
98 (synopsis "Abstraction of hardware architectures")
99 (description
100 "hwloc provides a portable abstraction (across OS,
101 versions, architectures, ...) of the hierarchical topology of modern
102 architectures, including NUMA memory nodes, sockets, shared caches, cores and
103 simultaneous multithreading. It also gathers various attributes such as cache
104 and memory information. It primarily aims at helping high-performance
105 computing applications with gathering information about the hardware so as to
106 exploit it accordingly and efficiently.
107
108 hwloc may display the topology in multiple convenient formats. It also offers
109 a powerful programming interface to gather information about the hardware,
110 bind processes, and much more.")
111 (license bsd-3)))
112
113 (define-public openmpi
114 (package
115 (name "openmpi")
116 (version "1.10.7")
117 (source
118 (origin
119 (method url-fetch)
120 (uri (string-append "https://www.open-mpi.org/software/ompi/v"
121 (version-major+minor version)
122 "/downloads/openmpi-" version ".tar.bz2"))
123 (sha256
124 (base32
125 "142s1vny9gllkq336yafxayjgcirj2jv0ddabj879jgya7hyr2d0"))))
126 (build-system gnu-build-system)
127 (inputs
128 `(("hwloc" ,hwloc "lib")
129 ("gfortran" ,gfortran)
130 ("libfabric" ,libfabric)
131 ,@(match (%current-system)
132 ((member (package-supported-systems psm))
133 `(("psm" ,psm)))
134 (_ `()))
135 ("rdma-core" ,rdma-core)
136 ("valgrind" ,valgrind)))
137 (native-inputs
138 `(("pkg-config" ,pkg-config)
139 ("perl" ,perl)))
140 (outputs '("out" "debug"))
141 (arguments
142 `(#:configure-flags `("--enable-mpi-ext=affinity" ;cr doesn't work
143 "--enable-memchecker"
144 "--with-sge"
145
146 ;; VampirTrace is obsoleted by scorep and disabling
147 ;; it reduces the closure size considerably.
148 "--disable-vt"
149
150 ,(string-append "--with-valgrind="
151 (assoc-ref %build-inputs "valgrind"))
152 ,(string-append "--with-hwloc="
153 (assoc-ref %build-inputs "hwloc")))
154 #:phases (modify-phases %standard-phases
155 (add-before 'build 'remove-absolute
156 (lambda _
157 ;; Remove compiler absolute file names (OPAL_FC_ABSOLUTE
158 ;; etc.) to reduce the closure size. See
159 ;; <https://lists.gnu.org/archive/html/guix-devel/2017-07/msg00388.html>
160 ;; and
161 ;; <https://www.mail-archive.com/users@lists.open-mpi.org//msg31397.html>.
162 (substitute* '("orte/tools/orte-info/param.c"
163 "oshmem/tools/oshmem_info/param.c"
164 "ompi/tools/ompi_info/param.c")
165 (("_ABSOLUTE") ""))
166 ;; Avoid valgrind (which pulls in gdb etc.).
167 (substitute*
168 '("./ompi/mca/io/romio/src/io_romio_component.c")
169 (("MCA_io_romio_COMPLETE_CONFIGURE_FLAGS")
170 "\"[elided to reduce closure]\""))
171 #t))
172 (add-before 'build 'scrub-timestamps ;reproducibility
173 (lambda _
174 (substitute* '("ompi/tools/ompi_info/param.c"
175 "orte/tools/orte-info/param.c"
176 "oshmem/tools/oshmem_info/param.c")
177 ((".*(Built|Configured) on.*") ""))
178 #t))
179 (add-after 'install 'remove-logs ;reproducibility
180 (lambda* (#:key outputs #:allow-other-keys)
181 (let ((out (assoc-ref outputs "out")))
182 (for-each delete-file (find-files out "config.log"))
183 #t))))))
184 (home-page "http://www.open-mpi.org")
185 (synopsis "MPI-3 implementation")
186 (description
187 "The Open MPI Project is an MPI-3 implementation that is developed and
188 maintained by a consortium of academic, research, and industry partners. Open
189 MPI is therefore able to combine the expertise, technologies, and resources
190 from all across the High Performance Computing community in order to build the
191 best MPI library available. Open MPI offers advantages for system and
192 software vendors, application developers and computer science researchers.")
193 ;; See file://LICENSE
194 (license bsd-2)))
195
196 (define-public openmpi-thread-multiple
197 (package
198 (inherit openmpi)
199 (name "openmpi-thread-multiple")
200 (arguments
201 (substitute-keyword-arguments (package-arguments openmpi)
202 ((#:configure-flags flags)
203 `(cons "--enable-mpi-thread-multiple" ,flags))))
204 (description " This version of Open@tie{}MPI has an implementation of
205 @code{MPI_Init_thread} that provides @code{MPI_THREAD_MULTIPLE}. This won't
206 work correctly with all transports (such as @code{openib}), and the
207 performance is generally worse than the vanilla @code{openmpi} package, which
208 only provides @code{MPI_THREAD_FUNNELED}.")))