all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ericbavier@openmailbox.org
To: guix-devel@gnu.org
Cc: Eric Bavier <bavier@member.fsf.org>
Subject: [PATCH 10/14] gnu: Add MUMPS.
Date: Sat, 27 Jun 2015 22:45:47 -0500	[thread overview]
Message-ID: <1435463151-32099-11-git-send-email-ericbavier@openmailbox.org> (raw)
In-Reply-To: <1435463151-32099-1-git-send-email-ericbavier@openmailbox.org>

From: Eric Bavier <bavier@member.fsf.org>

* gnu/packages/maths.scm (mumps, mumps-metis, mumps-openmpi)
  (mumps-metis-openmpi): New variables.
* gnu/packages/patches/mumps-build-parallelism.patch: New patch.
* gnu-system.am (dist_patch_DATA): Add it.
---
 gnu-system.am                                      |   1 +
 gnu/packages/maths.scm                             | 165 +++++++++++++++++++++
 gnu/packages/patches/mumps-build-parallelism.patch |  13 ++
 3 files changed, 179 insertions(+)
 create mode 100644 gnu/packages/patches/mumps-build-parallelism.patch

diff --git a/gnu-system.am b/gnu-system.am
index 0c9a2eb..af2c0eb 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -518,6 +518,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/mpc123-initialize-ao.patch		\
   gnu/packages/patches/mplayer2-theora-fix.patch		\
   gnu/packages/patches/module-init-tools-moduledir.patch	\
+  gnu/packages/patches/mumps-build-parallelism.patch		\
   gnu/packages/patches/mupdf-buildsystem-fix.patch		\
   gnu/packages/patches/mutt-CVE-2014-9116.patch			\
   gnu/packages/patches/net-tools-bitrot.patch			\
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index bc13fd5..369457d 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -32,6 +32,7 @@
   #:use-module (guix download)
   #:use-module (guix svn-download)
   #:use-module (guix utils)
+  #:use-module (guix build utils)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages algebra)
@@ -628,6 +629,170 @@ scientific applications modeled by partial differential equations.")
            ,@(delete "--with-mpi=0" ,cf)))))
     (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
 
+(define-public mumps
+  (package
+    (name "mumps")
+    (version "5.0.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
+                           version ".tar.gz"))
+       (sha256
+        (base32
+         "0690yp73sqk8zn2jnrzdr5swnjdyd7j0774s4xamjjwcxarw87hr"))
+       (patches (list (search-patch "mumps-build-parallelism.patch")))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("fortran" ,gfortran)
+       ;; These are required for linking against mumps, but we let the user
+       ;; declare the dependency.
+       ("blas" ,openblas)
+       ("metis" ,metis)
+       ("scotch" ,scotch)))
+    (arguments
+     `(#:modules ((ice-9 match)
+                  (guix build gnu-build-system)
+                  (guix build utils))
+       #: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       = -L$(topdir)/libseq -lmpiseq
+LIBSEQNEEDED = libseqneeded~;
+CC           = mpicc
+FC           = mpifort
+FL           = mpifort~]
+AR           = ar vr # rules require trailing space, ugh...
+RANLIB       = ranlib
+LIBBLAS      = -L~a -lopenblas~@[
+SCALAP       = -L~a -lscalapack~]
+LIBOTHERS    = -pthread
+CDEFS        = -DAdd_
+PIC          = -fPIC
+OPTF         = -O2 -DALLOW_NON_INIT $(PIC)
+OPTL         = -O2 $(PIC)
+OPTC         = -O2 $(PIC)
+INCS         = $(INCSEQ)
+LIBS         = $(SCALAP) $(LIBSEQ)
+LPORDDIR     = $(topdir)/PORD/lib
+IPORD        = -I$(topdir)/PORD/include
+LPORD        = -L$(LPORDDIR) -lpord
+ORDERINGSF   = -Dpord~@[
+METISDIR     = ~a
+IMETIS       = -I$(METISDIR)/include
+LMETIS       = -L$(METISDIR)/lib -lmetis
+ORDERINGSF  += -Dmetis~]~@[~:{
+SCOTCHDIR    = ~a
+ISCOTCH      = -I$(SCOTCHDIR)/include
+LSCOTCH      = -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
+ORDERINGSF  += ~a~}~]
+ORDERINGSC   = $(ORDERINGSF)
+LORDERINGS   = $(LPORD) $(LMETIS) $(LSCOTCH)
+IORDERINGSF  = $(ISCOTCH)
+IORDERINGSC  = $(IPORD) $(IMETIS) $(ISCOTCH)"
+                        (assoc-ref inputs "mpi")
+                        (assoc-ref inputs "blas")
+                        (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
+                              "-lptesmumps -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 _
+            (zero? (system* "make" "all"
+                            (format #f "-j~a" (current-processor-count))))))
+         (replace
+          'check
+          (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
+            (with-directory-excursion "examples"
+              (use-modules (srfi srfi-1))
+              (every
+               (lambda (prec type)
+                 (use-modules (ice-9 popen))
+                 (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")))
+              (copy-recursively "lib" (string-append out "/lib"))
+              (copy-recursively "include" (string-append out "/include"))
+              (when (file-exists? "libseq/libmpiseq.a")
+                (copy-file "libseq/libmpiseq.a"
+                           (string-append out "/lib/libmpiseq.a")))))))))
+    (home-page "http://mumps.enseeiht.fr")
+    (synopsis "Multifrontal sparse direct solver")
+    (description
+     "MUMPS (MUltifrontal Massively Parallel sparse direct Solver) solves a
+sparse system of linear equations A x = b using Guassian elimination.")
+    (license license:public-domain)))
+
+(define-public mumps-metis
+  (package (inherit mumps)
+    (name "mumps-metis")
+    (inputs
+     (alist-delete "scotch" (package-inputs mumps)))))
+
+(define-public mumps-openmpi
+  (package (inherit mumps)
+    (name "mumps-openmpi")
+    (inputs
+     `(("mpi" ,openmpi)
+       ("scalapack" ,scalapack)
+       ("pt-scotch" ,pt-scotch)
+       ,@(alist-delete "scotch" (package-inputs mumps))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments mumps)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (replace
+            'check
+            (lambda _
+              ((assoc-ref ,phases 'check)
+               #:exec-prefix '("mpirun" "-n" "2"))))))))
+    (synopsis "Multifrontal sparse direct solver (with MPI)")))
+
+(define-public mumps-metis-openmpi
+  (package (inherit mumps-openmpi)
+    (name "mumps-metis-openmpi")
+    (inputs
+     (alist-delete "pt-scotch" (package-inputs mumps-openmpi)))))
+
 (define-public superlu
   (package
     (name "superlu")
diff --git a/gnu/packages/patches/mumps-build-parallelism.patch b/gnu/packages/patches/mumps-build-parallelism.patch
new file mode 100644
index 0000000..26dd330
--- /dev/null
+++ b/gnu/packages/patches/mumps-build-parallelism.patch
@@ -0,0 +1,13 @@
+Building sublibraries in parallel can lead to race conditions on the libseq
+and lipord targets.
+
+--- MUMPS_5.0.0/Makefile.orig	2015-06-15 10:08:54.523146562 -0500
++++ MUMPS_5.0.0/Makefile	2015-06-15 10:19:44.074367512 -0500
+@@ -11,6 +11,7 @@
+ 	sexamples dexamples cexamples zexamples \
+ 	mumps_lib requiredobj libseqneeded clean
+ 
++.NOTPARALLEL:
+ alllib:		c z s d
+ all:		cexamples zexamples sexamples dexamples
+ 
-- 
2.2.1

  parent reply	other threads:[~2015-06-28  3:45 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-28  3:45 [PATCH 00/14] Add deal.II and some dependencies ericbavier
2015-06-28  3:45 ` [PATCH 01/14] gnu: hwloc: Upgrade to 1.10.1 ericbavier
2015-06-28  9:08   ` Ludovic Courtès
2015-06-28  3:45 ` [PATCH 02/14] gnu: hwloc: Move numactl to inputs ericbavier
2015-06-28  9:09   ` Ludovic Courtès
2015-06-28  3:45 ` [PATCH 03/14] gnu: openmpi: Upgrade to 1.8.5 ericbavier
2015-06-28  9:10   ` Ludovic Courtès
2015-06-28  3:45 ` [PATCH 04/14] gnu: Update scotch to 6.0.4 ericbavier
2015-06-28  9:12   ` Ludovic Courtès
2015-06-28  3:45 ` [PATCH 05/14] gnu: scotch, pt-scotch: Use modify-phases ericbavier
2015-06-28  9:15   ` Ludovic Courtès
2015-06-28  3:45 ` [PATCH 06/14] gnu: scotch, pt-scotch: Build esmumps libraries ericbavier
2015-06-28  9:14   ` Ludovic Courtès
2015-06-28  3:45 ` [PATCH 07/14] gnu: Add ScaLAPACK ericbavier
2015-06-28  9:12   ` Ludovic Courtès
2015-06-28  3:45 ` [PATCH 08/14] gnu: Add p4est ericbavier
2015-06-28 20:03   ` Ludovic Courtès
2015-06-28  3:45 ` [PATCH 09/14] gnu: Add METIS ericbavier
2015-06-28 20:03   ` Ludovic Courtès
2015-06-28  3:45 ` ericbavier [this message]
2015-06-28 20:12   ` [PATCH 10/14] gnu: Add MUMPS Ludovic Courtès
2015-06-28 15:59     ` Eric Bavier
2015-06-28  3:45 ` [PATCH 11/14] gnu: petsc: Upgrade to 3.6.0 ericbavier
2015-06-28 20:13   ` Ludovic Courtès
2015-06-28  3:45 ` [PATCH 12/14] gnu: Add arpack-ng-openmpi ericbavier
2015-06-28 20:13   ` Ludovic Courtès
2015-06-28  3:45 ` [PATCH 13/14] gnu: Add SLEPc ericbavier
2015-06-28 20:18   ` Ludovic Courtès
2015-06-28  3:45 ` [PATCH 14/14] gnu: Add deal.II ericbavier
2015-06-28 20:22   ` Ludovic Courtès
2015-06-28 16:05     ` Eric Bavier
2015-06-28 21:09       ` Andreas Enge
2015-06-29  8:39         ` Ludovic Courtès
2015-06-30 19:55           ` Eric Bavier
2015-07-04  7:40             ` Mark H Weaver
2015-07-05 10:20               ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1435463151-32099-11-git-send-email-ericbavier@openmailbox.org \
    --to=ericbavier@openmailbox.org \
    --cc=bavier@member.fsf.org \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.