gnu: Add cl-ana.statistical-learning.
[jackhill/guix/guix.git] / gnu / packages / parallel.scm
index d44a422..5bed372 100644 (file)
@@ -1,13 +1,15 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013, 2014 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
-;;; Copyright © 2015, 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2015, 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Pjotr Prins <pjotr.guix@thebird.nl>
 ;;; Copyright © 2016 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
-;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
-;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2017, 2018 Rutger Helling <rhelling@mykolab.com>
+;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
+;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages parallel)
-  #:use-module (guix build-system gnu)
   #:use-module (guix download)
+  #:use-module (guix git-download)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix build-system python)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module ((guix utils) #:select (target-64bit?))
   #:use-module (guix packages)
   #:use-module (gnu packages)
   #:use-module (gnu packages admin)
@@ -39,6 +44,8 @@
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-science)
+  #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages tcl)
   #:use-module (gnu packages tls)
 (define-public parallel
   (package
     (name "parallel")
-    (version "20180122")
+    (version "20191222")
     (source
      (origin
       (method url-fetch)
       (uri (string-append "mirror://gnu/parallel/parallel-"
                           version ".tar.bz2"))
       (sha256
-       (base32
-        "1wkkqghdjp9j2aqnrfh57kad1w41gdg7knhhlciczkm853f4d0sw"))))
+       (base32 "0xvw578440s9cc382n7z2l8npj30nwr6wwmkyxn2pj1pcszfjagy"))))
     (build-system gnu-build-system)
     (arguments
      `(#:phases
              (for-each
               (lambda (file)
                 (substitute* file
-                  ;; Patch hard coded '/bin/sh' in the lin ending in:
+                  ;; Patch hard coded '/bin/sh' in the line ending in:
                   ;; $Global::shell = $ENV{'PARALLEL_SHELL'} ||
                   ;;  parent_shell($$) || $ENV{'SHELL'} || "/bin/sh";
-                  (("/bin/sh\\\";\n$") (string-append (which "sh") "\";\n"))
-                  ;; Patch call to 'ps' and 'perl' commands.
-                  ((" ps ") (string-append " " (which "ps") " "))
-                  ((" perl -") (string-append " " (which "perl") " -"))))
+                  (("/bin/sh\\\";\n$") (string-append (which "sh") "\";\n"))))
               (list "src/parallel" "src/sem"))
              #t))
-         (add-after 'install 'post-install-test
+         (add-after 'install 'wrap-program
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (wrap-program (string-append out "/bin/parallel")
+                 `("PATH" ":" prefix
+                   ,(map (lambda (input)
+                           (string-append (assoc-ref inputs input) "/bin"))
+                         '("perl"
+                           "procps"))))
+               #t)))
+         (add-after 'wrap-program 'post-install-test
            (lambda* (#:key outputs #:allow-other-keys)
-             (zero? (system* (string-append
-                              (assoc-ref outputs "out") "/bin/parallel")
-                             "echo"
-                             ":::" "1" "2" "3")))))))
+             (invoke (string-append
+                      (assoc-ref outputs "out") "/bin/parallel")
+                     "echo"
+                     ":::" "1" "2" "3"))))))
     (inputs
      `(("perl" ,perl)
        ("procps" ,procps)))
@@ -94,7 +107,7 @@ and they are executed on lists of files, hosts, users or other items.")
 (define-public slurm
   (package
    (name "slurm")
-   (version "17.11.2")
+   (version "19.05.3-2")
    (source (origin
             (method url-fetch)
             (uri (string-append
@@ -102,24 +115,37 @@ and they are executed on lists of files, hosts, users or other items.")
                   version ".tar.bz2"))
             (sha256
              (base32
-              "18yakb8kmhb16n0cv3zhjv8ahvsk9p0max8mmr2flb2c65fawks6"))
+              "0qj4blfymrd2ry2qmb58l3jbr4jwygc3adcfw7my27rippcijlyc"))
             (modules '((guix build utils)))
             (snippet
              '(begin
+                ;; According to
+                ;; <https://lists.gnu.org/archive/html/guix-devel/2016-02/msg00534.html>
+                ;; there are non-free bits under contribs/, though it's not
+                ;; clear which ones.  libpmi is clearly free (it used to be
+                ;; under src/api/), so remove all of contribs/ except
+                ;; contribs/pmi/.
                 (substitute* "configure.ac"
-                  (("^[[:space:]]+contribs/.*$") ""))
+                  (("^[[:space:]]+contribs/(.*)$" all directory)
+                   (if (and (string-prefix? "pmi" directory)
+                            (not (string-prefix? "pmi2" directory)))
+                       all
+                       "")))
+
+                (rename-file "contribs/pmi" "tmp-pmi")
                 (delete-file-recursively "contribs")
+                (mkdir "contribs")
+                (rename-file "tmp-pmi" "contribs/pmi")
                 #t))))
    ;; FIXME: More optional inputs could be added,
    ;; in particular mysql and gtk+.
    (inputs `(("expect" ,expect)
              ("freeipmi" ,freeipmi)
-             ("hwloc" ,hwloc "lib")
+             ("hwloc" ,hwloc-2 "lib")
              ("json-c" ,json-c)
              ("linux-pam" , linux-pam)
              ("munge" ,munge)
              ("numactl" ,numactl)
-             ("openssl" ,openssl)
              ("perl" ,perl)
              ("python" ,python-wrapper)
              ("readline" ,readline)))
@@ -129,16 +155,24 @@ and they are executed on lists of files, hosts, users or other items.")
    (build-system gnu-build-system)
    (arguments
     `(#:configure-flags
-      (list "--enable-pam"
+      (list "--enable-pam" "--sysconfdir=/etc/slurm"
+            "--disable-static"
             (string-append "--with-freeipmi=" (assoc-ref %build-inputs "freeipmi"))
             (string-append "--with-hwloc=" (assoc-ref %build-inputs "hwloc"))
             (string-append "--with-json=" (assoc-ref %build-inputs "json-c"))
             (string-append "--with-munge=" (assoc-ref %build-inputs "munge"))
-            (string-append "--with-ssl=" (assoc-ref %build-inputs "openssl")))
+
+            ;; 32-bit support is marked as deprecated and needs to be
+            ;; explicitly enabled.
+            ,@(if (target-64bit?) '() '("--enable-deprecated")))
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'autoconf
-          (lambda _ (invoke "autoconf")))))) ; configure.ac was patched
+          (lambda _ (invoke "autoconf")))         ;configure.ac was patched
+        (add-after 'install 'install-libpmi
+          (lambda _
+            ;; Open MPI expects libpmi to be provided by Slurm so install it.
+            (invoke "make" "install" "-C" "contribs/pmi"))))))
    (home-page "https://slurm.schedmd.com/")
    (synopsis "Workload manager for cluster computing")
    (description
@@ -181,3 +215,50 @@ to SLURM.  Using DRMAA, grid applications builders, portal developers and ISVs
 can use the same high-level API to link their software with different
 cluster/resource management systems.")
     (license license:gpl3+)))
+
+(define-public python-slurm-magic
+  (let ((commit "73dd1a2b85799f7dae4b3f1cd9027536eff0c4d7")
+        (revision "0"))
+    (package
+      (name "python-slurm-magic")
+      (version (git-version "0.0" revision commit))
+      (home-page "https://github.com/NERSC/slurm-magic")
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference (url home-page)
+                                    (commit commit)))
+                (sha256
+                 (base32
+                  "19pp2vs0wm8mx0arz9n6lw9wgyv70w9wyi4y6b91qc5j3bz5igfs"))
+                (file-name (git-file-name name version))))
+      (build-system python-build-system)
+      (arguments
+       '(#:phases (modify-phases %standard-phases
+                    (add-before 'build 'set-slurm-path
+                      (lambda* (#:key inputs #:allow-other-keys)
+                        ;; The '_execute' method tries to exec 'salloc'
+                        ;; etc. from $PATH.  Record the absolute file name
+                        ;; instead.
+                        (let ((slurm (assoc-ref inputs "slurm")))
+                          (substitute* "slurm_magic.py"
+                            (("name = (.*)$" _ value)
+                             (string-append "name = \""
+                                            slurm "/bin/\" + "
+                                            value "\n")))
+                          #t))))))
+      (inputs
+       `(("slurm" ,slurm)))
+      (propagated-inputs
+       `(("python-ipython" ,python-ipython)
+         ("python-pandas" ,python-pandas)))
+      (synopsis "Control the SLURM batch scheduler from Jupyter Notebook")
+      (description
+       "This package implements Jupyter/IPython
+@uref{http://ipython.readthedocs.io/en/stable/interactive/magics.html, magic
+commands} for interacting with the SLURM workload manager.  SLURM magic simply
+wraps command-line executables and the commands themselves should look like
+their command-line counterparts.  Commands are spawned via @code{subprocess}
+and output captured in the notebook.  Whatever arguments are accepted by a
+SLURM command line executable are also accepted by the corresponding magic
+command---e.g., @code{%salloc}, @code{%sbatch}, etc.")
+      (license license:bsd-3))))