gnu: Add cl-ana.statistical-learning.
[jackhill/guix/guix.git] / gnu / packages / parallel.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014 Eric Bavier <bavier@member.fsf.org>
3 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2015, 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2016 Pjotr Prins <pjotr.guix@thebird.nl>
6 ;;; Copyright © 2016 Andreas Enge <andreas@enge.fr>
7 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
8 ;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
9 ;;; Copyright © 2017, 2018 Rutger Helling <rhelling@mykolab.com>
10 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
11 ;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
12 ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
13 ;;;
14 ;;; This file is part of GNU Guix.
15 ;;;
16 ;;; GNU Guix is free software; you can redistribute it and/or modify it
17 ;;; under the terms of the GNU General Public License as published by
18 ;;; the Free Software Foundation; either version 3 of the License, or (at
19 ;;; your option) any later version.
20 ;;;
21 ;;; GNU Guix is distributed in the hope that it will be useful, but
22 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;;; GNU General Public License for more details.
25 ;;;
26 ;;; You should have received a copy of the GNU General Public License
27 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28
29 (define-module (gnu packages parallel)
30 #:use-module (guix download)
31 #:use-module (guix git-download)
32 #:use-module (guix build-system gnu)
33 #:use-module (guix build-system python)
34 #:use-module ((guix licenses) #:prefix license:)
35 #:use-module ((guix utils) #:select (target-64bit?))
36 #:use-module (guix packages)
37 #:use-module (gnu packages)
38 #:use-module (gnu packages admin)
39 #:use-module (gnu packages autotools)
40 #:use-module (gnu packages base)
41 #:use-module (gnu packages freeipmi)
42 #:use-module (gnu packages linux)
43 #:use-module (gnu packages mpi)
44 #:use-module (gnu packages perl)
45 #:use-module (gnu packages pkg-config)
46 #:use-module (gnu packages python)
47 #:use-module (gnu packages python-science)
48 #:use-module (gnu packages python-xyz)
49 #:use-module (gnu packages readline)
50 #:use-module (gnu packages tcl)
51 #:use-module (gnu packages tls)
52 #:use-module (gnu packages web))
53
54 (define-public parallel
55 (package
56 (name "parallel")
57 (version "20191222")
58 (source
59 (origin
60 (method url-fetch)
61 (uri (string-append "mirror://gnu/parallel/parallel-"
62 version ".tar.bz2"))
63 (sha256
64 (base32 "0xvw578440s9cc382n7z2l8npj30nwr6wwmkyxn2pj1pcszfjagy"))))
65 (build-system gnu-build-system)
66 (arguments
67 `(#:phases
68 (modify-phases %standard-phases
69 (add-after 'unpack 'patch-bin-sh
70 (lambda _
71 (for-each
72 (lambda (file)
73 (substitute* file
74 ;; Patch hard coded '/bin/sh' in the line ending in:
75 ;; $Global::shell = $ENV{'PARALLEL_SHELL'} ||
76 ;; parent_shell($$) || $ENV{'SHELL'} || "/bin/sh";
77 (("/bin/sh\\\";\n$") (string-append (which "sh") "\";\n"))))
78 (list "src/parallel" "src/sem"))
79 #t))
80 (add-after 'install 'wrap-program
81 (lambda* (#:key inputs outputs #:allow-other-keys)
82 (let ((out (assoc-ref outputs "out")))
83 (wrap-program (string-append out "/bin/parallel")
84 `("PATH" ":" prefix
85 ,(map (lambda (input)
86 (string-append (assoc-ref inputs input) "/bin"))
87 '("perl"
88 "procps"))))
89 #t)))
90 (add-after 'wrap-program 'post-install-test
91 (lambda* (#:key outputs #:allow-other-keys)
92 (invoke (string-append
93 (assoc-ref outputs "out") "/bin/parallel")
94 "echo"
95 ":::" "1" "2" "3"))))))
96 (inputs
97 `(("perl" ,perl)
98 ("procps" ,procps)))
99 (home-page "https://www.gnu.org/software/parallel/")
100 (synopsis "Build and execute command lines in parallel")
101 (description
102 "GNU Parallel is a tool for executing shell jobs in parallel using one
103 or more computers. Jobs can consist of single commands or of scripts
104 and they are executed on lists of files, hosts, users or other items.")
105 (license license:gpl3+)))
106
107 (define-public slurm
108 (package
109 (name "slurm")
110 (version "19.05.3-2")
111 (source (origin
112 (method url-fetch)
113 (uri (string-append
114 "https://download.schedmd.com/slurm/slurm-"
115 version ".tar.bz2"))
116 (sha256
117 (base32
118 "0qj4blfymrd2ry2qmb58l3jbr4jwygc3adcfw7my27rippcijlyc"))
119 (modules '((guix build utils)))
120 (snippet
121 '(begin
122 ;; According to
123 ;; <https://lists.gnu.org/archive/html/guix-devel/2016-02/msg00534.html>
124 ;; there are non-free bits under contribs/, though it's not
125 ;; clear which ones. libpmi is clearly free (it used to be
126 ;; under src/api/), so remove all of contribs/ except
127 ;; contribs/pmi/.
128 (substitute* "configure.ac"
129 (("^[[:space:]]+contribs/(.*)$" all directory)
130 (if (and (string-prefix? "pmi" directory)
131 (not (string-prefix? "pmi2" directory)))
132 all
133 "")))
134
135 (rename-file "contribs/pmi" "tmp-pmi")
136 (delete-file-recursively "contribs")
137 (mkdir "contribs")
138 (rename-file "tmp-pmi" "contribs/pmi")
139 #t))))
140 ;; FIXME: More optional inputs could be added,
141 ;; in particular mysql and gtk+.
142 (inputs `(("expect" ,expect)
143 ("freeipmi" ,freeipmi)
144 ("hwloc" ,hwloc-2 "lib")
145 ("json-c" ,json-c)
146 ("linux-pam" , linux-pam)
147 ("munge" ,munge)
148 ("numactl" ,numactl)
149 ("perl" ,perl)
150 ("python" ,python-wrapper)
151 ("readline" ,readline)))
152 (native-inputs
153 `(("autoconf" ,autoconf)
154 ("pkg-config" ,pkg-config)))
155 (build-system gnu-build-system)
156 (arguments
157 `(#:configure-flags
158 (list "--enable-pam" "--sysconfdir=/etc/slurm"
159 "--disable-static"
160 (string-append "--with-freeipmi=" (assoc-ref %build-inputs "freeipmi"))
161 (string-append "--with-hwloc=" (assoc-ref %build-inputs "hwloc"))
162 (string-append "--with-json=" (assoc-ref %build-inputs "json-c"))
163 (string-append "--with-munge=" (assoc-ref %build-inputs "munge"))
164
165 ;; 32-bit support is marked as deprecated and needs to be
166 ;; explicitly enabled.
167 ,@(if (target-64bit?) '() '("--enable-deprecated")))
168 #:phases
169 (modify-phases %standard-phases
170 (add-after 'unpack 'autoconf
171 (lambda _ (invoke "autoconf"))) ;configure.ac was patched
172 (add-after 'install 'install-libpmi
173 (lambda _
174 ;; Open MPI expects libpmi to be provided by Slurm so install it.
175 (invoke "make" "install" "-C" "contribs/pmi"))))))
176 (home-page "https://slurm.schedmd.com/")
177 (synopsis "Workload manager for cluster computing")
178 (description
179 "SLURM is a fault-tolerant and highly scalable cluster management and job
180 scheduling system for large and small clusters. It allocates access to
181 resources (computer nodes) to users for some duration of time, provides a
182 framework for starting, executing, and monitoring work (typically a parallel
183 job) on a set of allocated nodes, and arbitrates contention for resources
184 by managing a queue of pending work.")
185 (license (list license:bsd-2 ; src/common/log.[ch], src/common/uthash
186 license:expat ; slurm/pmi.h
187 license:isc ; src/common/strlcpy.c
188 license:lgpl2.1+ ; hilbert.[ch], src/common/slurm_time.h
189 license:zlib ; src/common/strnatcmp.c
190 license:gpl2+)))) ; the rest, often with OpenSSL exception
191
192 (define-public slurm-drmaa
193 (package
194 (name "slurm-drmaa")
195 (version "1.0.7")
196 (source (origin
197 (method url-fetch)
198 (uri "http://apps.man.poznan.pl/trac/slurm-drmaa/downloads/9")
199 (file-name (string-append name "-" version ".tar.gz"))
200 (sha256
201 (base32
202 "0grw55hmny2mc4nc0y1arnvxd2k0dcdfn476kzs180fibjxgfw14"))))
203 (build-system gnu-build-system)
204 (inputs
205 `(("slurm" ,slurm)))
206 (native-inputs
207 `(("which" ,which)))
208 (home-page "http://apps.man.poznan.pl/trac/slurm-drmaa")
209 (synopsis "Distributed resource management application API for SLURM")
210 (description
211 "PSNC DRMAA for Simple Linux Utility for Resource Management (SLURM) is
212 an implementation of Open Grid Forum DRMAA 1.0 (Distributed Resource
213 Management Application API) specification for submission and control of jobs
214 to SLURM. Using DRMAA, grid applications builders, portal developers and ISVs
215 can use the same high-level API to link their software with different
216 cluster/resource management systems.")
217 (license license:gpl3+)))
218
219 (define-public python-slurm-magic
220 (let ((commit "73dd1a2b85799f7dae4b3f1cd9027536eff0c4d7")
221 (revision "0"))
222 (package
223 (name "python-slurm-magic")
224 (version (git-version "0.0" revision commit))
225 (home-page "https://github.com/NERSC/slurm-magic")
226 (source (origin
227 (method git-fetch)
228 (uri (git-reference (url home-page)
229 (commit commit)))
230 (sha256
231 (base32
232 "19pp2vs0wm8mx0arz9n6lw9wgyv70w9wyi4y6b91qc5j3bz5igfs"))
233 (file-name (git-file-name name version))))
234 (build-system python-build-system)
235 (arguments
236 '(#:phases (modify-phases %standard-phases
237 (add-before 'build 'set-slurm-path
238 (lambda* (#:key inputs #:allow-other-keys)
239 ;; The '_execute' method tries to exec 'salloc'
240 ;; etc. from $PATH. Record the absolute file name
241 ;; instead.
242 (let ((slurm (assoc-ref inputs "slurm")))
243 (substitute* "slurm_magic.py"
244 (("name = (.*)$" _ value)
245 (string-append "name = \""
246 slurm "/bin/\" + "
247 value "\n")))
248 #t))))))
249 (inputs
250 `(("slurm" ,slurm)))
251 (propagated-inputs
252 `(("python-ipython" ,python-ipython)
253 ("python-pandas" ,python-pandas)))
254 (synopsis "Control the SLURM batch scheduler from Jupyter Notebook")
255 (description
256 "This package implements Jupyter/IPython
257 @uref{http://ipython.readthedocs.io/en/stable/interactive/magics.html, magic
258 commands} for interacting with the SLURM workload manager. SLURM magic simply
259 wraps command-line executables and the commands themselves should look like
260 their command-line counterparts. Commands are spawned via @code{subprocess}
261 and output captured in the notebook. Whatever arguments are accepted by a
262 SLURM command line executable are also accepted by the corresponding magic
263 command---e.g., @code{%salloc}, @code{%sbatch}, etc.")
264 (license license:bsd-3))))