diff mbox series

[bug#56831] gnu: mumps: Update to 5.5.1

Message ID 20220729154411.8017-1-marek@felsoci.sk
State Accepted
Headers show
Series [bug#56831] gnu: mumps: Update to 5.5.1 | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

FELŠÖCI Marek July 29, 2022, 3:44 p.m. UTC
---
 gnu/packages/maths.scm | 227 +++++++++++++++++++++++------------------
 1 file changed, 125 insertions(+), 102 deletions(-)

Comments

Ludovic Courtès Aug. 4, 2022, 10:17 a.m. UTC | #1
Hi Marek,

FELŠÖCI Marek <marek@felsoci.sk> skribis:

> -       (patches (search-patches "mumps-build-parallelism.patch"
> -                                "mumps-shared-libseq.patch"
> -                                "mumps-shared-mumps.patch"
> -                                "mumps-shared-pord.patch"))))

Good to see them go.  :-)

Could you please also remove the files and remove them from
‘gnu/local.mk’?

> -     `(#:modules ((ice-9 match)
> -                  (ice-9 popen)
> -                  (srfi srfi-1)
> -                  ,@%gnu-build-system-modules)
> +     `(#:modules
> +       ((ice-9 match)
> +        (ice-9 popen)
> +        (srfi srfi-1)
> +        ,@%gnu-build-system-modules)

This is unnecessary; if you could avoid it, that’d be great: it’d make
the important changes more visible.

>         #:phases
>         (modify-phases %standard-phases
>           (replace 'configure
> -          (lambda* (#:key inputs #:allow-other-keys)
> -            (call-with-output-file "Makefile.inc"
> -              (lambda (port)

Looks like this hunk is mostly reformatting as well?

> +                         (assoc-ref inputs "openblas")
> +                         (->bool ;; OpenBLAS or MKL?
> +                          (file-exists?
> +                           (string-append
> +                            (assoc-ref inputs "openblas")
> +                            "/include/mkl_cblas.h")))

I understand the intent and that’s fine, but I would prefer a solution
that does not explicitly refer to MKL.  Perhaps we could devise a
solution that, more generally, allows users to swap one BLAS for
another, but maybe that’s beyond the scope of this patch.

Could you send a v2 of the patch that addresses these comments?

Bonus points if you can provide a commit log that follows the ChangeLog
style:

  https://guix.gnu.org/manual/devel/en/html_node/Submitting-Patches.html

:-)

Thank you,
Ludo’.
diff mbox series

Patch

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 6a84f47468..983e8bf87a 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -52,6 +52,7 @@ 
 ;;; Copyright © 2021 Pierre-Antoine Bouttier <pierre-antoine.bouttier@univ-grenoble-alpes.fr>
 ;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
 ;;; Copyright © 2022 Sharlatan Hellseher <sharlatanus@gmail.com>
+;;; Copyright © 2022 Marek Felšöci <marek@felsoci.sk>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -3681,19 +3682,15 @@  language understood by many solvers.")
 (define-public mumps
   (package
     (name "mumps")
-    (version "5.2.1")
+    (version "5.5.1")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
-                           version ".tar.gz"))
+       (uri
+        (string-append "http://mumps.enseeiht.fr/MUMPS_" version ".tar.gz"))
        (sha256
         (base32
-         "0jklh54x4y3ik1zkw6db7766kakjm5910diyaghfxxf8vwsgr26r"))
-       (patches (search-patches "mumps-build-parallelism.patch"
-                                "mumps-shared-libseq.patch"
-                                "mumps-shared-mumps.patch"
-                                "mumps-shared-pord.patch"))))
+         "05gs2i8b76m9flm1826fxpyfnwibjjawbmfza3ylrvj7zaag5gqs"))))
     (build-system gnu-build-system)
     (inputs
      (list gfortran
@@ -3703,105 +3700,131 @@  language understood by many solvers.")
            metis
            scotch))
     (arguments
-     `(#:modules ((ice-9 match)
-                  (ice-9 popen)
-                  (srfi srfi-1)
-                  ,@%gnu-build-system-modules)
+     `(#:modules
+       ((ice-9 match)
+        (ice-9 popen)
+        (srfi srfi-1)
+        ,@%gnu-build-system-modules)
        #:phases
        (modify-phases %standard-phases
          (replace 'configure
-          (lambda* (#:key inputs #:allow-other-keys)
-            (call-with-output-file "Makefile.inc"
-              (lambda (port)
-                (format port "
-PLAT         =
-LIBEXT       = .a
-OUTC         = -o
-OUTF         = -o
-RM           = rm -f~:[
-CC           = gcc
-FC           = gfortran
-FL           = gfortran
-INCSEQ       = -I$(topdir)/libseq
-LIBSEQ       = $(topdir)/libseq/libmpiseq.a
-LIBSEQNEEDED = libseqneeded~;
-CC           = mpicc
-FC           = mpifort
-FL           = mpifort~]
-AR           = ar vr # rules require trailing space, ugh...
-RANLIB       = ranlib
-BLASDIR      = ~a
-LIBBLAS      = -Wl,-rpath=$(BLASDIR) -Wl,-rpath='$$ORIGIN' -L$(BLASDIR) -lopenblas~@[
-SCALAPDIR    = ~a
-SCALAP       = -Wl,-rpath=$(SCALAPDIR) -Wl,-rpath='$$ORIGIN' -L$(SCALAPDIR) -lscalapack~]
-LIBOTHERS    = -pthread
-CDEFS        = -DAdd_
-PIC          = -fPIC
-OPTF         = -O2 -DALLOW_NON_INIT -fallow-argument-mismatch $(PIC)
-OPTL         = -O2 $(PIC)
-OPTC         = -O2 $(PIC)
-INCS         = $(INCSEQ)
-LIBS         = $(SCALAP) $(LIBSEQ)
-LPORDDIR     = $(topdir)/PORD/lib
-IPORD        = -I$(topdir)/PORD/include
-LPORD        = $(LPORDDIR)/libpord.a
-ORDERINGSF   = -Dpord~@[
-METISDIR     = ~a
-IMETIS       = -I$(METISDIR)/include
-LMETIS       = -Wl,-rpath $(METISDIR)/lib -L$(METISDIR)/lib -lmetis
-ORDERINGSF  += -Dmetis~]~@[~:{
-SCOTCHDIR    = ~a
-ISCOTCH      = -I$(SCOTCHDIR)/include
-LSCOTCH      = -Wl,-rpath $(SCOTCHDIR)/lib -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
-ORDERINGSF  += ~a~}~]
-ORDERINGSC   = $(ORDERINGSF)
-LORDERINGS   = $(LPORD) $(LMETIS) $(LSCOTCH) $(LIBSEQ)
-IORDERINGSF  = $(ISCOTCH)
-IORDERINGSC  = $(IPORD) $(IMETIS) $(ISCOTCH)"
-                        (->bool (which "mpicc"))  ;MPI support enabled?
-                        (dirname
-                         (dirname (search-input-file inputs "/include/cblas.h")))
-                        (assoc-ref inputs "scalapack")
-                        (assoc-ref inputs "metis")
-                        (match (list (assoc-ref inputs "pt-scotch")
-                                     (assoc-ref inputs "scotch"))
-                          ((#f #f)
-                           #f)
-                          ((#f scotch)
-                           `((,scotch "" "-Dscotch")))
-                          ((ptscotch _)
-                           `((,ptscotch
-                              "-lesmumps -lptscotch -lptscotcherr "
-                              "-Dptscotch")))))))))
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (call-with-output-file "Makefile.inc"
+               (lambda (port)
+                 (format port "
+PLAT          =
+LIBEXT        = .a
+LIBEXT_SHARED = .so
+OUTC          = -o
+OUTF          = -o
+BLASDIR       = ~a
+LIBBLAS       = -Wl,-rpath=$(BLASDIR)/lib -Wl,-rpath='$$ORIGIN'
+LIBBLAS      += -L$(BLASDIR)/lib~:[
+LIBBLAS      += -lopenblas
+OPTF          = ~;
+LIBBLAS      += -L${BLASDIR}/lib/intel64 -Wl,--no-as-needed -lmkl_gf_lp64
+LIBBLAS      += -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl
+OPTF          = -DGEMMT_AVAILABLE~]~@[
+SCALAPDIR     = ~a
+SCALAP        = -Wl,-rpath=$(SCALAPDIR)/lib -Wl,-rpath='$$ORIGIN'
+SCALAP       += -L$(SCALAPDIR)/lib -lscalapack~]
+RM            = rm -f~:[
+CC            = gcc
+FC            = gfortran
+FL            = gfortran
+INCSEQ        = -I$(topdir)/libseq
+LIBSEQ        = $(LAPACK) -L$(topdir)/libseq -lmpiseq
+LIBSEQNEEDED  = libseqneeded
+INCS          = $(INCSEQ)
+LIBS          = $(LIBSEQ)~;
+CC            = mpicc
+FC            = mpifort
+FL            = mpifort
+INCPAR        =
+LIBPAR        = $(SCALAP) $(LAPACK)
+LIBSEQNEEDED  = 
+INCS          = $(INCPAR)
+LIBS          = $(LIBPAR)~]
+AR            = ar vr # rules require trailing space, ugh...
+RANLIB        = ranlib
+LIBOTHERS     = -pthread
+CDEFS         = -DAdd_
+PIC           = -fPIC
+FPIC_OPT      = $(PIC)
+RPATH_OPT     = -Wl,-rpath,~a/lib
+OPTF         += -O2 -fopenmp -DMUMPS_USE_BLAS2 -DALLOW_NON_INIT -DBLR_MT
+OPTF         += -fallow-argument-mismatch $(PIC)
+OPTL          = -O2 -fopenmp $(PIC)
+OPTC          = -O2 -fopenmp $(PIC)
+LPORDDIR      = $(topdir)/PORD/lib
+IPORD         = -I$(topdir)/PORD/include
+LPORD         = $(LPORDDIR)/libpord.a
+ORDERINGSF    = -Dpord~@[
+METISDIR      = ~a
+IMETIS        = -I$(METISDIR)/include
+LMETIS        = -Wl,-rpath $(METISDIR)/lib -L$(METISDIR)/lib -lmetis
+ORDERINGSF   += -Dmetis~]~@[~:{
+SCOTCHDIR     = ~a
+ISCOTCH       = -I$(SCOTCHDIR)/include
+LSCOTCH       = -Wl,-rpath $(SCOTCHDIR)/lib -L$(SCOTCHDIR)/lib ~a -lesmumps
+LSCOTCH      += -lscotch -lscotcherr
+ORDERINGSF   += ~a~}~]
+ORDERINGSC    = $(ORDERINGSF)
+LORDERINGS    = $(LPORD) $(LMETIS) $(LSCOTCH)
+IORDERINGSF   = $(ISCOTCH)
+IORDERINGSC   = $(IPORD) $(IMETIS) $(ISCOTCH)"
+                         (assoc-ref inputs "openblas")
+                         (->bool ;; OpenBLAS or MKL?
+                          (file-exists?
+                           (string-append
+                            (assoc-ref inputs "openblas")
+                            "/include/mkl_cblas.h")))
+                         (assoc-ref inputs "scalapack")
+                         (->bool (which "mpicc"))  ;; MPI support enabled?
+                         (assoc-ref outputs "out")
+                         (assoc-ref inputs "metis")
+                         (match (list (assoc-ref inputs "pt-scotch")
+                                      (assoc-ref inputs "scotch"))
+                                ((#f #f)
+                                 #f)
+                                ((#f scotch)
+                                 `((,scotch "" "-Dscotch")))
+                                ((ptscotch _)
+                                 `((,ptscotch
+                                    "-lesmumps -lptscotch -lptscotcherr "
+                                    "-Dptscotch")))))))))
          (replace 'build
-          ;; By default only the d-precision library is built.  Make with "all"
-          ;; target so that all precision libraries and examples are built.
-          (lambda _
-            (invoke "make" "all"
-                    (format #f "-j~a" (parallel-job-count)))))
+           ;; By default only the d-precision library is built. Make with "all"
+           ;; target so that all precision libraries and examples are built.
+           ;; Then, "make allshared" builts equivalent shared libraries as well.
+           (lambda _
+             (invoke "make" "all"
+                     (format #f "-j~a" (parallel-job-count)))
+             (invoke "make" "allshared"
+                     (format #f "-j~a" (parallel-job-count)))))
          (replace 'check
-          ;; Run the simple test drivers, which read test input from stdin:
-          ;; from the "real" input for the single- and double-precision
-          ;; testers, and from the "cmplx" input for complex-precision
-          ;; testers.  The EXEC-PREFIX key is used by the mumps-openmpi
-          ;; package to prefix execution with "mpirun".
-          (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
-            (with-directory-excursion "examples"
-              (every
-               (lambda (prec type)
-                 (let ((tester (apply open-pipe*
-                                      `(,OPEN_WRITE
-                                        ,@exec-prefix
-                                        ,(string-append "./" prec
-                                                        "simpletest"))))
-                       (input  (open-input-file
-                                (string-append "input_simpletest_" type))))
-                   (begin
-                     (dump-port input tester)
-                     (close-port input)
-                     (zero? (close-pipe tester)))))
-               '("s" "d" "c" "z")
-               '("real" "real" "cmplx" "cmplx")))))
+           ;; Run the simple test drivers, which read test input from stdin:
+           ;; from the "real" input for the single- and double-precision
+           ;; testers, and from the "cmplx" input for complex-precision
+           ;; testers.  The EXEC-PREFIX key is used by the mumps-openmpi
+           ;; package to prefix execution with "mpirun".
+           (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
+             (with-directory-excursion "examples"
+               (every
+                (lambda (prec type)
+                  (let ((tester (apply open-pipe*
+                                       `(,OPEN_WRITE
+                                         ,@exec-prefix
+                                         ,(string-append "./" prec
+                                                         "simpletest"))))
+                        (input  (open-input-file
+                                 (string-append "input_simpletest_" type))))
+                    (begin
+                      (dump-port input tester)
+                      (close-port input)
+                      (zero? (close-pipe tester)))))
+                '("s" "d" "c" "z")
+                '("real" "real" "cmplx" "cmplx")))))
          (replace 'install
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))