[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
11/15: gnu: Add MUMPS.
From: |
Eric Bavier |
Subject: |
11/15: gnu: Add MUMPS. |
Date: |
Tue, 30 Jun 2015 01:29:48 +0000 |
bavier pushed a commit to branch master
in repository guix.
commit cec86422b7dfc4a45243545355d3f6ac126ce304
Author: Eric Bavier <address@hidden>
Date: Tue Jun 16 07:10:51 2015 -0500
gnu: Add MUMPS.
* 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 | 169 ++++++++++++++++++++
gnu/packages/patches/mumps-build-parallelism.patch | 13 ++
3 files changed, 183 insertions(+), 0 deletions(-)
diff --git a/gnu-system.am b/gnu-system.am
index cbf9223..3631c71 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -519,6 +519,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 e5da8c2..a70e9de 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,174 @@ 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)
+ (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 = -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 address@hidden
+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 = address@hidden
+METISDIR = ~a
+IMETIS = -I$(METISDIR)/include
+LMETIS = -L$(METISDIR)/lib -lmetis
+ORDERINGSF += address@hidden:{
+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" (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")))))
+ (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:cecill-c)))
+
+(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
+
- 01/15: gnu: python-mccabe: Fix license field., (continued)
- 01/15: gnu: python-mccabe: Fix license field., Eric Bavier, 2015/06/29
- 04/15: gnu: openmpi: Upgrade to 1.8.5., Eric Bavier, 2015/06/29
- 03/15: gnu: hwloc: Move numactl to inputs., Eric Bavier, 2015/06/29
- 06/15: gnu: scotch, pt-scotch: Use modify-phases., Eric Bavier, 2015/06/29
- 08/15: gnu: Add ScaLAPACK., Eric Bavier, 2015/06/29
- 07/15: gnu: scotch, pt-scotch: Build esmumps libraries., Eric Bavier, 2015/06/29
- 09/15: gnu: Add p4est., Eric Bavier, 2015/06/29
- 02/15: gnu: hwloc: Upgrade to 1.10.1., Eric Bavier, 2015/06/29
- 10/15: gnu: Add METIS., Eric Bavier, 2015/06/29
- 05/15: gnu: Update scotch to 6.0.4., Eric Bavier, 2015/06/29
- 11/15: gnu: Add MUMPS.,
Eric Bavier <=
- 13/15: gnu: Add arpack-ng-openmpi., Eric Bavier, 2015/06/29
- 12/15: gnu: petsc: Upgrade to 3.6.0., Eric Bavier, 2015/06/29
- 14/15: gnu: Add SLEPc., Eric Bavier, 2015/06/29
- 15/15: gnu: Add deal.II., Eric Bavier, 2015/06/29