guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 4/4] gnu: Add superlu-dist package.


From: Eric Bavier
Subject: [PATCH 4/4] gnu: Add superlu-dist package.
Date: Sat, 17 May 2014 00:58:22 -0500
User-agent: mu4e 0.9.9.5; emacs 23.3.1

>From d288395409ba945ecd0c8533842283080e52bde3 Mon Sep 17 00:00:00 2001
From: Eric Bavier <address@hidden>
Date: Sat, 17 May 2014 00:44:20 -0500
Subject: [PATCH 4/4] 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-system.am                                      |    1 +
 gnu/packages/maths.scm                             |  102 ++++++++++++++++++++
 .../patches/superlu-dist-scotchmetis.patch         |   21 ++++
 3 files changed, 124 insertions(+)
 create mode 100644 gnu/packages/patches/superlu-dist-scotchmetis.patch

diff --git a/gnu-system.am b/gnu-system.am
index 829c997..3646292 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -346,6 +346,7 @@ dist_patch_DATA =                                           
\
   gnu/packages/patches/soprano-find-clucene.patch              \
   gnu/packages/patches/source-highlight-regexrange-test.patch  \
   gnu/packages/patches/sqlite-large-page-size-fix.patch                \
+  gnu/packages/patches/superlu-dist-scotchmetis.patch          \
   gnu/packages/patches/tcsh-fix-autotest.patch                 \
   gnu/packages/patches/teckit-cstdio.patch                     \
   gnu/packages/patches/valgrind-glibc.patch                    \
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index d9f846e..6cd82fa 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -589,6 +589,108 @@ library routines perform an LU decomposition with partial 
pivoting and
 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
+     `(("lapack" ,lapack)
+       ("openmpi" ,openmpi)
+       ("pt-scotch" ,pt-scotch)))
+    (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 0000000..3d78380
--- /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
-- 
1.7.9.5

-- 
Eric Bavier

Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

reply via email to

[Prev in Thread] Current Thread [Next in Thread]