guix-devel
[Top][All Lists]
Advanced

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

[PATCH 2/4] gnu: Add scotch package.


From: Eric Bavier
Subject: [PATCH 2/4] gnu: Add scotch package.
Date: Sat, 17 May 2014 00:56:13 -0500
User-agent: mu4e 0.9.9.5; emacs 23.3.1

>From 1fad4e1e207870c3e5aab2dc6c17fdfa6e0cb404 Mon Sep 17 00:00:00 2001
From: Eric Bavier <address@hidden>
Date: Sat, 17 May 2014 00:30:13 -0500
Subject: [PATCH 2/4] gnu: Add scotch package.

* gnu/packages/maths.scm (scotch): New variable.
* gnu/packages/patches/scotch-test-threading.patch: New patch.
* gnu-system.am (dist_patch_DATA): Add it.
---
 gnu-system.am                                    |    1 +
 gnu/packages/maths.scm                           |   74 ++++++++++++
 gnu/packages/patches/scotch-test-threading.patch |  139 ++++++++++++++++++++++
 3 files changed, 214 insertions(+)
 create mode 100644 gnu/packages/patches/scotch-test-threading.patch

diff --git a/gnu-system.am b/gnu-system.am
index b54aba1..829c997 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -339,6 +339,7 @@ dist_patch_DATA =                                           
\
   gnu/packages/patches/readline-link-ncurses.patch             \
   gnu/packages/patches/ripperx-libm.patch                      \
   gnu/packages/patches/scheme48-tests.patch                    \
+  gnu/packages/patches/scotch-test-threading.patch             \
   gnu/packages/patches/slim-session.patch                      \
   gnu/packages/patches/slim-config.patch                       \
   gnu/packages/patches/slim-sigusr1.patch                      \
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 49fdace..0366385 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -589,3 +589,77 @@ 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 scotch
+  (package
+    (name "scotch")
+    (version "6.0.0")
+    (source
+     (origin
+      (method url-fetch)
+      (uri (string-append "https://gforge.inria.fr/frs/download.php/31831/";
+                          "scotch_" version ".tar.gz"))
+      (sha256
+       (base32 "0yfqf9lk7chb3h42777x42x4adx0v3n0b41q0cdqrdmscp4iczp5"))
+      (patches (list (search-patch "scotch-test-threading.patch")))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("zlib" ,zlib)
+       ("flex" ,flex)
+       ("bison" ,bison)))
+    (arguments
+     `(#:phases
+       (alist-cons-after
+        'unpack 'chdir-to-src
+        (lambda _ (chdir "src"))
+        (alist-replace
+         'configure
+         (lambda _
+           (call-with-output-file "Makefile.inc"
+             (lambda (port)
+               (format port "
+EXE =
+LIB = .a
+OBJ = .o
+MAKE = make
+AR = ar
+ARFLAGS = -ruv
+CCS = gcc
+CCP = gcc
+CCD = gcc
+CPPFLAGS =~{ -D~a~}
+CFLAGS = -O2 -g $(CPPFLAGS)
+LDFLAGS = -lz -lm -lrt -lpthread
+CP = cp
+LEX = flex -Pscotchyy -olex.yy.c
+LN = ln
+MKDIR = mkdir
+MV = mv
+RANLIB = ranlib
+YACC = bison -pscotchyy -y -b y
+"
+                       '("COMMON_FILE_COMPRESS_GZ"
+                         "COMMON_PTHREAD"
+                         "COMMON_RANDOM_FIXED_SEED"
+                         ;; TODO: Define once our MPI supports 
MPI_THREAD_MULTIPLE
+                         ;; "SCOTCH_PTHREAD"
+                         ;; "SCOTCH_PTHREAD_NUMBER=2"
+                         "restrict=__restrict")))))
+         (alist-replace
+          'install
+          (lambda* (#:key outputs #:allow-other-keys)
+            (let ((out (assoc-ref outputs "out")))
+              (mkdir out)
+              (zero? (system* "make"
+                              (string-append "prefix=" out)
+                              "install"))))
+          %standard-phases)))))
+    (home-page "http://www.labri.fr/perso/pelegrin/scotch/";)
+    (synopsis "Programs and libraries for graph algorithms")
+    (description "SCOTCH is a set of programs and libraries which implement
+the static mapping and sparse matrix reordering algorithms developed within
+the SCOTCH project.  Its purpose is to apply graph theory, with a divide and
+conquer approach, to scientific computing problems such as graph and mesh
+partitioning, static mapping, and sparse matrix ordering, in application
+domains ranging from structural mechanics to operating systems or
+bio-chemistry.")
+    (license (license:fsf-free "file://LICENSE_en.txt"))))
diff --git a/gnu/packages/patches/scotch-test-threading.patch 
b/gnu/packages/patches/scotch-test-threading.patch
new file mode 100644
index 0000000..2527a6e
--- /dev/null
+++ b/gnu/packages/patches/scotch-test-threading.patch
@@ -0,0 +1,139 @@
+* These tests assume threading support, even when the library is compiled
+  without it.  Protect these checks.
+
+* Tests should not require keyboard interaction.
+
+--- a/src/check/test_scotch_dgraph_band.c      2012-09-27 10:46:42.000000000 
-0500
++++ b/src/check/test_scotch_dgraph_band.c      2014-05-13 14:36:07.479270243 
-0500
+@@ -99,10 +99,12 @@
+     errorPrint ("main: Cannot initialize (1)");
+     exit       (1);
+   }
++#ifdef SCOTCH_PTHREAD
+   if (thrdlvlreqval > thrdlvlproval) {
+     errorPrint ("main: Cannot initialize (2)");
+     exit       (1);
+   }
++#endif
+ 
+   if (argc != 2) {
+     errorPrint ("main: invalid number of parameters");
+@@ -115,12 +117,14 @@
+ 
+   fprintf (stderr, "Proc %2d of %2d, pid %d\n", proclocnum, procglbnbr, 
getpid ());
+ 
++#ifdef SCOTCH_DEBUG_CHECK2
+   if (proclocnum == 0) {                          /* Synchronize on keybord 
input */
+     char           c;
+ 
+     printf ("Waiting for key press...\n");
+     scanf ("%c", &c);
+   }
++#endif /* SCOTCH_DEBUG_CHECK2 */
+ 
+   if (MPI_Barrier (proccomm) != MPI_SUCCESS) {    /* Synchronize for debug */
+     errorPrint ("main: cannot communicate");
+--- a/src/check/test_scotch_dgraph_grow.c      2012-11-30 12:19:33.000000000 
-0600
++++ b/src/check/test_scotch_dgraph_grow.c      2014-05-13 14:35:31.307269303 
-0500
+@@ -103,10 +103,12 @@
+     errorPrint ("main: Cannot initialize (1)");
+     exit       (1);
+   }
++#ifdef SCOTCH_PTHREAD
+   if (thrdlvlreqval > thrdlvlproval) {
+     errorPrint ("main: Cannot initialize (2)");
+     exit       (1);
+   }
++#endif
+ 
+   if (argc != 2) {
+     errorPrint ("main: invalid number of parameters");
+@@ -119,12 +121,14 @@
+ 
+   fprintf (stderr, "Proc %2d of %2d, pid %d\n", proclocnum, procglbnbr, 
getpid ());
+ 
++#ifdef SCOTCH_DEBUG_CHECK2
+   if (proclocnum == 0) {                          /* Synchronize on keybord 
input */
+     char           c;
+ 
+     printf ("Waiting for key press...\n");
+     scanf ("%c", &c);
+   }
++#endif /* SCOTCH_DEBUG_CHECK2 */
+ 
+   if (MPI_Barrier (proccomm) != MPI_SUCCESS) {    /* Synchronize for debug */
+     errorPrint ("main: cannot communicate");
+--- a/src/check/test_scotch_dgraph_redist.c    2012-09-26 11:42:27.000000000 
-0500
++++ b/src/check/test_scotch_dgraph_redist.c    2014-05-13 14:34:30.323267722 
-0500
+@@ -98,10 +98,12 @@
+     errorPrint ("main: Cannot initialize (1)");
+     exit       (1);
+   }
++#ifdef SCOTCH_PTHREAD
+   if (thrdlvlreqval > thrdlvlproval) {
+     errorPrint ("main: Cannot initialize (2)");
+     exit       (1);
+   }
++#endif
+ 
+   if (argc != 2) {
+     errorPrint ("main: invalid number of parameters");
+@@ -114,7 +116,6 @@
+ 
+   fprintf (stderr, "Proc %2d of %2d, pid %d\n", proclocnum, procglbnbr, 
getpid ());
+ 
+-#define SCOTCH_DEBUG_CHECK2
+ #ifdef SCOTCH_DEBUG_CHECK2
+   if (proclocnum == 0) {                          /* Synchronize on keybord 
input */
+     char           c;
+--- 
/tmp/nix-build-scotch-6.0.0.drv-9/scotch_6.0.0/src/check/test_common_thread.c   
   2012-11-30 11:05:23.000000000 -0600
++++ scotch_6.0.0/src/check/test_common_thread.c        2014-05-13 
17:26:27.159535244 -0500
+@@ -90,7 +90,7 @@
+ /*                       */
+ /*************************/
+ 
+-#if ((defined COMMON_PTHREAD) || (defined SCOTCH_PTHREAD))
++#ifdef SCOTCH_PTHREAD
+ 
+ static
+ void
+@@ -161,7 +161,7 @@
+   return (o);
+ }
+ 
+-#endif /* ((defined COMMON_PTHREAD) || (defined SCOTCH_PTHREAD)) */
++#endif /* SCOTCH_PTHREAD */
+ 
+ /*********************/
+ /*                   */
+@@ -175,14 +175,14 @@
+ char *              argv[])
+ {
+   TestThreadGroup       groudat;
+-#if ((defined COMMON_PTHREAD) || (defined SCOTCH_PTHREAD))
++#ifdef SCOTCH_PTHREAD
+   TestThread * restrict thrdtab;
+   int                   thrdnbr;
+-#endif /* ((defined COMMON_PTHREAD) || (defined SCOTCH_PTHREAD)) */
++#endif /* SCOTCH_PTHREAD */
+ 
+   SCOTCH_errorProg (argv[0]);
+ 
+-#if ((defined COMMON_PTHREAD) || (defined SCOTCH_PTHREAD))
++#ifdef SCOTCH_PTHREAD
+   thrdnbr = SCOTCH_PTHREAD_NUMBER;
+ 
+   groudat.redusum = COMPVAL (thrdnbr);
+@@ -197,9 +197,9 @@
+     errorPrint ("main: cannot launch or run threads");
+     return     (1);
+   }
+-#else /* ((defined COMMON_PTHREAD) || (defined SCOTCH_PTHREAD)) */
+-  printf ("Scotch not compiled with either COMMON_PTHREAD or 
SCOTCH_PTHREAD\n");
+-#endif /* ((defined COMMON_PTHREAD) || (defined SCOTCH_PTHREAD)) */
++#else /* not SCOTCH_PTHREAD */
++  printf ("Scotch not compiled with SCOTCH_PTHREAD\n");
++#endif /* not SCOTCH_PTHREAD */
+ 
+   return (0);
+ }
-- 
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]