parallel.scm 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  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, 2021 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, 2020, 2021 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–2021 Tobias Geerinckx-Rice <me@tobias.gr>
  11. ;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
  12. ;;; Copyright © 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
  13. ;;; Copyright © 2020 Roel Janssen <roel@gnu.org>
  14. ;;; Copyright © 2021 Stefan Reichör <stefan@xsteve.at>
  15. ;;;
  16. ;;; This file is part of GNU Guix.
  17. ;;;
  18. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  19. ;;; under the terms of the GNU General Public License as published by
  20. ;;; the Free Software Foundation; either version 3 of the License, or (at
  21. ;;; your option) any later version.
  22. ;;;
  23. ;;; GNU Guix is distributed in the hope that it will be useful, but
  24. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  25. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26. ;;; GNU General Public License for more details.
  27. ;;;
  28. ;;; You should have received a copy of the GNU General Public License
  29. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  30. (define-module (gnu packages parallel)
  31. #:use-module (guix download)
  32. #:use-module (guix git-download)
  33. #:use-module (guix build-system cmake)
  34. #:use-module (guix build-system gnu)
  35. #:use-module (guix build-system python)
  36. #:use-module ((guix licenses) #:prefix license:)
  37. #:use-module ((guix utils) #:select (target-64bit?))
  38. #:use-module (guix packages)
  39. #:use-module (guix utils)
  40. #:use-module (gnu packages)
  41. #:use-module (gnu packages admin)
  42. #:use-module (gnu packages autotools)
  43. #:use-module (gnu packages base)
  44. #:use-module (gnu packages check)
  45. #:use-module (gnu packages flex)
  46. #:use-module (gnu packages freeipmi)
  47. #:use-module (gnu packages linux)
  48. #:use-module (gnu packages maths)
  49. #:use-module (gnu packages mpi)
  50. #:use-module (gnu packages perl)
  51. #:use-module (gnu packages pkg-config)
  52. #:use-module (gnu packages python)
  53. #:use-module (gnu packages python-science)
  54. #:use-module (gnu packages python-xyz)
  55. #:use-module (gnu packages readline)
  56. #:use-module (gnu packages tcl)
  57. #:use-module (gnu packages tls)
  58. #:use-module (gnu packages web))
  59. (define-public parallel
  60. (package
  61. (name "parallel")
  62. (version "20210822")
  63. (source
  64. (origin
  65. (method url-fetch)
  66. (uri (string-append "mirror://gnu/parallel/parallel-"
  67. version ".tar.bz2"))
  68. (sha256
  69. (base32 "08iqx2qq2p4a45nphlcj7xnhr2s8nacahzbyvapqxvr64znmj5kq"))))
  70. (build-system gnu-build-system)
  71. (arguments
  72. `(#:phases
  73. (modify-phases %standard-phases
  74. (add-after 'unpack 'patch-bin-sh
  75. (lambda _
  76. (for-each
  77. (lambda (file)
  78. (substitute* file
  79. ;; Patch hard coded '/bin/sh' in the line ending in:
  80. ;; $Global::shell = $ENV{'PARALLEL_SHELL'} ||
  81. ;; parent_shell($$) || $ENV{'SHELL'} || "/bin/sh";
  82. (("/bin/sh\\\";\n$") (string-append (which "sh") "\";\n"))))
  83. (list "src/parallel" "src/sem"))
  84. #t))
  85. (add-after 'install 'wrap-program
  86. (lambda* (#:key inputs outputs #:allow-other-keys)
  87. (let ((out (assoc-ref outputs "out")))
  88. (wrap-program (string-append out "/bin/parallel")
  89. `("PATH" ":" prefix
  90. ,(map (lambda (input)
  91. (string-append (assoc-ref inputs input) "/bin"))
  92. '("perl"
  93. "procps"))))
  94. #t)))
  95. (add-after 'wrap-program 'post-install-test
  96. (lambda* (#:key outputs #:allow-other-keys)
  97. (invoke (string-append
  98. (assoc-ref outputs "out") "/bin/parallel")
  99. "echo"
  100. ":::" "1" "2" "3"))))))
  101. (inputs
  102. `(("perl" ,perl)
  103. ("procps" ,procps)))
  104. (home-page "https://www.gnu.org/software/parallel/")
  105. (synopsis "Build and execute command lines in parallel")
  106. (description
  107. "GNU Parallel is a tool for executing shell jobs in parallel using one
  108. or more computers. Jobs can consist of single commands or of scripts
  109. and they are executed on lists of files, hosts, users or other items.")
  110. (license license:gpl3+)))
  111. (define-public xe
  112. (package
  113. (name "xe")
  114. (version "0.11")
  115. (source
  116. (origin
  117. (method git-fetch)
  118. (uri (git-reference
  119. (url "https://github.com/leahneukirchen/xe")
  120. (commit (string-append "v" version))))
  121. (file-name (git-file-name name version))
  122. (sha256
  123. (base32 "04jr8f6jcijr0bsmn8ajm0aj35qh9my3xjsaq64h8lwg5bpyn29x"))))
  124. (build-system gnu-build-system)
  125. (arguments
  126. `(#:tests? #f
  127. #:make-flags (list (string-append "CC=" ,(cc-for-target))
  128. (string-append "PREFIX=" %output))
  129. #:phases (modify-phases %standard-phases
  130. (delete 'configure))))
  131. (synopsis "Execute a command for every argument")
  132. (description
  133. "The xe utility constructs command lines from specified arguments,
  134. combining some of the best features of xargs(1) and apply(1). Parallel
  135. execution is also possible.")
  136. (home-page "https://github.com/leahneukirchen/xe")
  137. (license license:public-domain)))
  138. (define-public xjobs
  139. (package
  140. (name "xjobs")
  141. (version "20200726")
  142. (source (origin
  143. (method url-fetch)
  144. (uri (string-append
  145. "http://www.maier-komor.de/xjobs/xjobs-"
  146. version ".tgz"))
  147. (sha256
  148. (base32
  149. "0ay6gn43pnm7r1jamwgpycl67bjg5n87ncl27jb01w2x6x70z0i3"))))
  150. (build-system gnu-build-system)
  151. (arguments `(#:tests? #f)) ;; No tests
  152. (native-inputs
  153. `(("flex" ,flex)
  154. ("which" ,which)))
  155. (home-page "http://www.maier-komor.de/xjobs.html")
  156. (properties `((release-monitoring-url . ,home-page)))
  157. (synopsis
  158. "Parallel execution of jobs with several useful options")
  159. (description
  160. "xjobs reads job descriptions line by line and executes them in
  161. parallel. It limits the number of parallel executing jobs and starts new jobs
  162. when jobs finish.")
  163. (license license:gpl2+)))
  164. (define-public slurm
  165. (package
  166. (name "slurm")
  167. (version "20.11.7")
  168. (source (origin
  169. (method url-fetch)
  170. (uri (string-append
  171. "https://download.schedmd.com/slurm/slurm-"
  172. version ".tar.bz2"))
  173. (sha256
  174. (base32
  175. "1fdjihg1x7ks5l77yjv14a4mg6r0v8c3zk1dcxkhrhq3n4dc9nbs"))
  176. (modules '((guix build utils)))
  177. (snippet
  178. '(begin
  179. ;; According to
  180. ;; <https://lists.gnu.org/archive/html/guix-devel/2016-02/msg00534.html>
  181. ;; there are non-free bits under contribs/, though it's not
  182. ;; clear which ones. libpmi is clearly free (it used to be
  183. ;; under src/api/), so remove all of contribs/ except
  184. ;; contribs/pmi/.
  185. (substitute* "configure.ac"
  186. (("^[[:space:]]+contribs/(.*)$" all directory)
  187. (if (and (string-prefix? "pmi" directory)
  188. (not (string-prefix? "pmi2" directory)))
  189. all
  190. "")))
  191. (rename-file "contribs/pmi" "tmp-pmi")
  192. (delete-file-recursively "contribs")
  193. (mkdir "contribs")
  194. (rename-file "tmp-pmi" "contribs/pmi")
  195. #t))))
  196. ;; FIXME: More optional inputs could be added,
  197. ;; in particular mysql and gtk+.
  198. (inputs `(("freeipmi" ,freeipmi)
  199. ("hwloc" ,hwloc-2 "lib")
  200. ("json-c" ,json-c)
  201. ("linux-pam" , linux-pam)
  202. ("munge" ,munge)
  203. ("numactl" ,numactl)
  204. ("readline" ,readline)))
  205. (native-inputs
  206. `(("autoconf" ,autoconf)
  207. ("expect" ,expect)
  208. ("perl" ,perl)
  209. ("pkg-config" ,pkg-config)
  210. ("python" ,python-wrapper)))
  211. (build-system gnu-build-system)
  212. (arguments
  213. `(#:configure-flags
  214. (list "--enable-pam" "--sysconfdir=/etc/slurm"
  215. "--disable-static"
  216. (string-append "--with-freeipmi=" (assoc-ref %build-inputs "freeipmi"))
  217. (string-append "--with-hwloc=" (assoc-ref %build-inputs "hwloc"))
  218. (string-append "--with-json=" (assoc-ref %build-inputs "json-c"))
  219. (string-append "--with-munge=" (assoc-ref %build-inputs "munge"))
  220. ;; 32-bit support is marked as deprecated and needs to be
  221. ;; explicitly enabled.
  222. ,@(if (target-64bit?) '() '("--enable-deprecated")))
  223. #:phases
  224. (modify-phases %standard-phases
  225. (add-after 'unpack 'patch-plugin-linker-flags
  226. (lambda _
  227. (substitute* (find-files "src/plugins/" "Makefile.in")
  228. (("_la_LDFLAGS = ")
  229. "_la_LDFLAGS = ../../../api/libslurm.la "))))
  230. (add-after 'patch-plugin-linker-flags 'autoconf
  231. (lambda _ (invoke "autoconf"))) ;configure.ac was patched
  232. (add-after 'install 'install-libpmi
  233. (lambda _
  234. ;; Open MPI expects libpmi to be provided by Slurm so install it.
  235. (invoke "make" "install" "-C" "contribs/pmi"))))))
  236. (home-page "https://slurm.schedmd.com/")
  237. (synopsis "Workload manager for cluster computing")
  238. (description
  239. "SLURM is a fault-tolerant and highly scalable cluster management and job
  240. scheduling system for large and small clusters. It allocates access to
  241. resources (computer nodes) to users for some duration of time, provides a
  242. framework for starting, executing, and monitoring work (typically a parallel
  243. job) on a set of allocated nodes, and arbitrates contention for resources
  244. by managing a queue of pending work.")
  245. (license (list license:bsd-2 ; src/common/log.[ch], src/common/uthash
  246. license:expat ; slurm/pmi.h
  247. license:isc ; src/common/strlcpy.c
  248. license:lgpl2.1+ ; hilbert.[ch], src/common/slurm_time.h
  249. license:zlib ; src/common/strnatcmp.c
  250. license:gpl2+)))) ; the rest, often with OpenSSL exception
  251. ;; The SLURM client/daemon protocol and file format changes from time to time
  252. ;; in incompatible ways, as noted in
  253. ;; <https://slurm.schedmd.com/troubleshoot.html#network>. Thus, keep older
  254. ;; releases here. See also <https://issues.guix.gnu.org/44387>.
  255. ;; As noted in the link, YY.MM is the release scheme, and the 'maintenance'
  256. ;; digit does not introduce incompatibilities.
  257. (define-public slurm-20.02
  258. (package
  259. (inherit slurm)
  260. (version "20.02.6-1")
  261. (source (origin
  262. (inherit (package-source slurm))
  263. (method url-fetch)
  264. (uri (string-append
  265. "https://download.schedmd.com/slurm/slurm-"
  266. version ".tar.bz2"))
  267. (sha256
  268. (base32
  269. "0qj4blfymrd2ry2qmb58l3jbr4jwygc3adcfw7my27rippcijlyc"))))))
  270. (define-public slurm-19.05
  271. (package
  272. (inherit slurm)
  273. (version "19.05.8")
  274. (source (origin
  275. (inherit (package-source slurm))
  276. (method url-fetch)
  277. (uri (string-append
  278. "https://download.schedmd.com/slurm/slurm-"
  279. version ".tar.bz2"))
  280. (sha256
  281. (base32
  282. "10c9j4a9a6d4ibpf75006mn03p8xgpaprc247x2idakysjf2fw43"))))))
  283. ;; Same as Debian 10
  284. (define-public slurm-18.08
  285. (package
  286. (inherit slurm)
  287. (version "18.08.9")
  288. (source
  289. (origin
  290. (inherit (package-source slurm))
  291. (uri (string-append
  292. "https://download.schedmd.com/slurm/slurm-"
  293. version ".tar.bz2"))
  294. (sha256
  295. (base32
  296. "1bgrpz75m7l4xhirsd0fvnkzlkrl8v2qpmjcz60barc5qm2kn457"))))))
  297. (define-public slurm-drmaa
  298. (package
  299. (name "slurm-drmaa")
  300. (version "1.1.2")
  301. (source (origin
  302. (method url-fetch)
  303. (uri (string-append
  304. "https://github.com/natefoo/slurm-drmaa/releases/download/"
  305. version "/slurm-drmaa-" version ".tar.gz"))
  306. (sha256
  307. (base32
  308. "0dn8ypqxdaq3k4jqwwx7msckxnmr6n2z5j68yffp50yy07ajbzjv"))))
  309. (build-system gnu-build-system)
  310. (arguments `(#:tests? #f)) ; The tests require "bats".
  311. (inputs
  312. `(("slurm" ,slurm)))
  313. (native-inputs
  314. `(("which" ,which)))
  315. (home-page "https://github.com/natefoo/slurm-drmaa")
  316. (synopsis "Distributed resource management application API for SLURM")
  317. (description
  318. "PSNC DRMAA for Simple Linux Utility for Resource Management (SLURM) is
  319. an implementation of Open Grid Forum DRMAA 1.0 (Distributed Resource
  320. Management Application API) specification for submission and control of jobs
  321. to SLURM. Using DRMAA, grid applications builders, portal developers and ISVs
  322. can use the same high-level API to link their software with different
  323. cluster/resource management systems.")
  324. (license license:gpl3+)))
  325. (define-public python-slurm-magic
  326. (let ((commit "73dd1a2b85799f7dae4b3f1cd9027536eff0c4d7")
  327. (revision "0"))
  328. (package
  329. (name "python-slurm-magic")
  330. (version (git-version "0.0" revision commit))
  331. (home-page "https://github.com/NERSC/slurm-magic")
  332. (source (origin
  333. (method git-fetch)
  334. (uri (git-reference (url home-page)
  335. (commit commit)))
  336. (sha256
  337. (base32
  338. "19pp2vs0wm8mx0arz9n6lw9wgyv70w9wyi4y6b91qc5j3bz5igfs"))
  339. (file-name (git-file-name name version))))
  340. (build-system python-build-system)
  341. (arguments
  342. '(#:phases (modify-phases %standard-phases
  343. (add-before 'build 'set-slurm-path
  344. (lambda* (#:key inputs #:allow-other-keys)
  345. ;; The '_execute' method tries to exec 'salloc'
  346. ;; etc. from $PATH. Record the absolute file name
  347. ;; instead.
  348. (let ((slurm (assoc-ref inputs "slurm")))
  349. (substitute* "slurm_magic.py"
  350. (("name = (.*)$" _ value)
  351. (string-append "name = \""
  352. slurm "/bin/\" + "
  353. value "\n")))
  354. #t))))))
  355. (inputs
  356. `(("slurm" ,slurm)))
  357. (propagated-inputs
  358. `(("python-ipython" ,python-ipython)
  359. ("python-pandas" ,python-pandas)))
  360. (synopsis "Control the SLURM batch scheduler from Jupyter Notebook")
  361. (description
  362. "This package implements Jupyter/IPython
  363. @uref{http://ipython.readthedocs.io/en/stable/interactive/magics.html, magic
  364. commands} for interacting with the SLURM workload manager. SLURM magic simply
  365. wraps command-line executables and the commands themselves should look like
  366. their command-line counterparts. Commands are spawned via @code{subprocess}
  367. and output captured in the notebook. Whatever arguments are accepted by a
  368. SLURM command line executable are also accepted by the corresponding magic
  369. command---e.g., @code{%salloc}, @code{%sbatch}, etc.")
  370. (license license:bsd-3))))
  371. (define-public pthreadpool
  372. ;; This repository has only one tag, 0.1, which is older than what users
  373. ;; such as XNNPACK expect.
  374. (let ((commit "1787867f6183f056420e532eec640cba25efafea")
  375. (version "0.1")
  376. (revision "1"))
  377. (package
  378. (name "pthreadpool")
  379. (version (git-version version revision commit))
  380. (home-page "https://github.com/Maratyszcza/pthreadpool")
  381. (source (origin
  382. (method git-fetch)
  383. (uri (git-reference (url home-page) (commit commit)))
  384. (file-name (git-file-name name version))
  385. (sha256
  386. (base32
  387. "02hdvxfn5krw8zivkgjx3b4rk9p02yr4mpdjlp75lsv6z1xf5yrx"))
  388. (patches (search-patches "pthreadpool-system-libraries.patch"))))
  389. (build-system cmake-build-system)
  390. (arguments '(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")))
  391. (inputs
  392. `(("googletest" ,googletest)
  393. ("googlebenchmark" ,googlebenchmark)
  394. ("fxdiv" ,fxdiv)))
  395. (synopsis "Efficient thread pool implementation")
  396. (description
  397. "The pthreadpool library implements an efficient and portable thread
  398. pool, similar to those implemented by OpenMP run-time support libraries for
  399. constructs such as @code{#pragma omp parallel for}, with additional
  400. features.")
  401. (license license:bsd-2))))
  402. (define-public cpuinfo
  403. ;; There's currently no tag on this repo.
  404. (let ((version "0.0")
  405. (revision "1")
  406. (commit "866ae6e5ffe93a1f63be738078da94cf3005cce2"))
  407. (package
  408. (name "cpuinfo")
  409. (version (git-version version revision commit))
  410. (home-page "https://github.com/pytorch/cpuinfo")
  411. (source (origin
  412. (method git-fetch)
  413. (uri (git-reference (url home-page) (commit commit)))
  414. (file-name (git-file-name name version))
  415. (sha256
  416. (base32
  417. "1lmsf4bpkm19a31i40qwcjn46qf7prggziv4pbsi695bkx5as71p"))
  418. (patches (search-patches "cpuinfo-system-libraries.patch"))))
  419. (build-system cmake-build-system)
  420. (arguments '(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")))
  421. (inputs
  422. `(("googletest" ,googletest)
  423. ("googlebenchmark" ,googlebenchmark)))
  424. (synopsis "C/C++ library to obtain information about the CPU")
  425. (description
  426. "The cpuinfo library provides a C/C++ and a command-line interface to
  427. obtain information about the CPU being used: supported instruction set,
  428. processor name, cache information, and topology information.")
  429. (license license:bsd-2))))
  430. (define-public psimd
  431. ;; There is currently no tag in this repo.
  432. (let ((commit "072586a71b55b7f8c584153d223e95687148a900")
  433. (version "0.0")
  434. (revision "1"))
  435. (package
  436. (name "psimd")
  437. (version (git-version version revision commit))
  438. (home-page "https://github.com/Maratyszcza/Psimd")
  439. (source (origin
  440. (method git-fetch)
  441. (uri (git-reference (url home-page) (commit commit)))
  442. (file-name (git-file-name name version))
  443. (sha256
  444. (base32
  445. "16mslhvqs0gpqbg7kkq566a8gkn58cgjpqca8ljj9qcv5mk9apwm"))))
  446. (build-system cmake-build-system)
  447. (arguments '(#:tests? #f)) ;there are no tests
  448. (synopsis "Portable 128-bit SIMD intrinsics")
  449. (description
  450. "This header-only C++ library provides a portable interface to
  451. single-instruction multiple-data (SIMD) intrinsics.")
  452. (license license:expat))))