From a54aefead6bfcc35bce0ac2aebb4cd32eb94208e Mon Sep 17 00:00:00 2001 From: Eric Bavier Date: Mon, 19 May 2014 00:12:46 -0500 Subject: gnu: Add superlu-dist package. * gnu/packages/maths.scm (superlu-dist): New variable. * gnu/packages/patches/superlu-dist-scotchmetis.patch: New patch. * gnu-system.am (dist_patch_DATA): Add it. --- gnu/packages/maths.scm | 101 +++++++++++++++++++++ .../patches/superlu-dist-scotchmetis.patch | 21 +++++ 2 files changed, 122 insertions(+) create mode 100644 gnu/packages/patches/superlu-dist-scotchmetis.patch (limited to 'gnu/packages') diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm index 9288ba91f4..cda3af8d97 100644 --- a/gnu/packages/maths.scm +++ b/gnu/packages/maths.scm @@ -590,6 +590,107 @@ triangular system solves through forward and back substitution. The library also provides threshold-based ILU factorization preconditioners.") (license license:bsd-3))) +(define-public superlu-dist + (package + (name "superlu-dist") + (version "3.3") + (source + (origin + (method url-fetch) + (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/" + "superlu_dist_" version ".tar.gz")) + (sha256 + (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj")) + (patches (list (search-patch "superlu-dist-scotchmetis.patch"))))) + (build-system gnu-build-system) + (native-inputs + `(("tcsh" ,tcsh))) + (inputs + `(("gfortran" ,gfortran-4.8))) + (propagated-inputs + `(("openmpi" ,openmpi) ;headers include MPI heades + ("lapack" ,lapack) ;required to link with output library + ("pt-scotch" ,pt-scotch))) ;same + (arguments + `(#:parallel-build? #f ;race conditions using ar + #:phases + (alist-replace + 'configure + (lambda* (#:key inputs outputs #:allow-other-keys) + (call-with-output-file "make.inc" + (lambda (port) + (format port " +PLAT = +DSuperLUroot = ~a +DSUPERLULIB = ~a/lib/libsuperlu_dist.a +BLASDEF = -DUSE_VENDOR_BLAS +BLASLIB = -L~a/lib -lblas +PARMETISLIB = -L~a/lib \ + -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \ + -lscotch -lscotcherr -lscotcherrexit +METISLIB = -L~:*~a/lib \ + -lscotchmetis -lscotch -lscotcherr -lscotcherrexit +LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB) +ARCH = ar +ARCHFLAGS = cr +RANLIB = ranlib +CC = mpicc +PIC = -fPIC +CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC) +NOOPTS = -O0 -g $(PIC) +FORTRAN = mpifort +FFLAGS = -O2 -g $(PIC) +LOADER = $(CC) +CDEFS = -DAdd_" + (getcwd) + (assoc-ref outputs "out") + (assoc-ref inputs "lapack") + (assoc-ref inputs "pt-scotch"))))) + (alist-cons-after + 'unpack 'remove-broken-symlinks + (lambda _ + (for-each delete-file + (find-files "MAKE_INC" "\\.#make\\..*"))) + (alist-cons-before + 'build 'create-install-directories + (lambda* (#:key outputs #:allow-other-keys) + (for-each + (lambda (dir) + (mkdir-p (string-append (assoc-ref outputs "out") + "/" dir))) + '("lib" "include"))) + (alist-replace + 'check + (lambda _ + (with-directory-excursion "EXAMPLE" + (and + (zero? (system* "mpirun" "-n" "2" + "./pddrive" "-r" "1" "-c" "2" "g20.rua")) + (zero? (system* "mpirun" "-n" "2" + "./pzdrive" "-r" "1" "-c" "2" "cg20.cua"))))) + (alist-replace + 'install + (lambda* (#:key outputs #:allow-other-keys) + ;; Library is placed in lib during the build phase. Copy over + ;; headers to include. + (let* ((out (assoc-ref outputs "out")) + (incdir (string-append out "/include"))) + (for-each (lambda (file) + (let ((base (basename file))) + (format #t "installing `~a' to `~a'~%" + base incdir) + (copy-file file + (string-append incdir "/" base)))) + (find-files "SRC" ".*\\.h$")))) + %standard-phases))))))) + (home-page (package-home-page superlu)) + (synopsis "Parallel supernodal direct solver") + (description + "SuperLU_DIST is a parallel extension to the serial SuperLU library. +It is targeted for distributed memory parallel machines. SuperLU_DIST is +implemented in ANSI C, and MPI for communications.") + (license license:bsd-3))) + (define-public scotch (package (name "scotch") diff --git a/gnu/packages/patches/superlu-dist-scotchmetis.patch b/gnu/packages/patches/superlu-dist-scotchmetis.patch new file mode 100644 index 0000000000..3d78380551 --- /dev/null +++ b/gnu/packages/patches/superlu-dist-scotchmetis.patch @@ -0,0 +1,21 @@ +The METIS interface from Scotch may segfault if passed NULL to indicate a +default parameter, so use the older calling style. + +--- a/SRC/get_perm_c.c 2014-05-16 23:38:30.070835316 -0500 ++++ b/SRC/get_perm_c.c 2014-05-16 23:39:04.582836211 -0500 +@@ -70,11 +70,13 @@ + #else + + /* Earlier version 3.x.x */ +- /* METIS_NodeND(&nm, b_colptr, b_rowind, &numflag, metis_options, +- perm, iperm);*/ ++ METIS_NodeND(&nm, b_colptr, b_rowind, &numflag, metis_options, ++ perm, iperm); + + /* Latest version 4.x.x */ ++#if 0 + METIS_NodeND(&nm, b_colptr, b_rowind, NULL, NULL, perm, iperm); ++#endif + + /*check_perm_dist("metis perm", n, perm);*/ + #endif -- cgit v1.2.3