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