forked from ahmadia/homebrew-science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscotch.rb
186 lines (147 loc) · 5.66 KB
/
scotch.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
require 'formula'
class Scotch < Formula
homepage 'https://gforge.inria.fr/projects/scotch'
url 'https://gforge.inria.fr/frs/download.php/31831/scotch_6.0.0.tar.gz'
sha1 'eb32d846bb14449245b08c81e740231f7883fea6'
option 'without-check', 'skip build-time tests (not recommended)'
depends_on :mpi => :cc
patch :DATA # See http://goo.gl/NY4MOy
def install
cd "src" do
ln_s "Make.inc/Makefile.inc.i686_mac_darwin8", "Makefile.inc"
make_args = ["CCS=#{ENV['CC']}",
"CCP=#{ENV['MPICC']}",
"CCD=#{ENV['MPICC']}",
"LIB=.dylib",
"AR=libtool",
"ARFLAGS=-dynamic -install_name #{lib}/$(notdir $@) -undefined dynamic_lookup -o ",
"RANLIB=echo"]
inreplace "Makefile.inc" do |s|
# OS X doesn't implement pthread_barriers required by Scotch
s.slice! "-DCOMMON_PTHREAD"
s.slice! "-DSCOTCH_PTHREAD"
s.gsub! "-O3", "-O3 -fPIC"
end
system "make", "scotch", "VERBOSE=ON", *make_args
system "make", "ptscotch", "VERBOSE=ON", *make_args
system "make", "install", "prefix=#{prefix}", *make_args
system "make", "check", "ptcheck", "EXECP=mpirun -np 2", *make_args if build.with? "check"
end
end
end
__END__
diff --git a/src/check/Makefile b/src/check/Makefile
index 2b3283a..73ee4ba 100644
--- a/src/check/Makefile
+++ b/src/check/Makefile
@@ -110,7 +110,7 @@ check_common_thread : test_common_thread
$(EXECS) ./test_common_thread
test_common_thread : test_common_thread.c \
- $(SCOTCHLIBDIR)/libscotch.a
+ $(SCOTCHLIBDIR)/libscotch$(LIB)
##
@@ -118,7 +118,7 @@ check_graph_color : test_scotch_graph_color
$(EXECS) ./test_scotch_graph_color data/bump.grf
test_graph_color : test_scotch_graph_color.c \
- $(SCOTCHLIBDIR)/libscotch.a
+ $(SCOTCHLIBDIR)/libscotch$(LIB)
##
@@ -126,7 +126,7 @@ check_strat_seq : test_strat_seq
$(EXECS) ./test_strat_seq
test_strat_seq : test_strat_seq.c \
- $(SCOTCHLIBDIR)/libscotch.a
+ $(SCOTCHLIBDIR)/libscotch$(LIB)
##
@@ -134,7 +134,7 @@ check_strat_par : test_strat_par
$(EXECS) ./test_strat_par
test_strat_par : test_strat_par.c \
- $(SCOTCHLIBDIR)/libptscotch.a
+ $(SCOTCHLIBDIR)/libptscotch$(LIB)
##
@@ -142,7 +142,7 @@ check_scotch_dgraph_band : test_scotch_dgraph_band
$(EXECP) ./test_scotch_dgraph_band data/bump.grf
test_scotch_dgraph_band : test_scotch_dgraph_band.c \
- $(SCOTCHLIBDIR)/libptscotch.a
+ $(SCOTCHLIBDIR)/libptscotch$(LIB)
##
@@ -150,4 +150,4 @@ check_scotch_dgraph_grow : test_scotch_dgraph_grow
$(EXECP) ./test_scotch_dgraph_grow data/bump.grf
test_scotch_dgraph_grow : test_scotch_dgraph_grow.c \
- $(SCOTCHLIBDIR)/libptscotch.a
+ $(SCOTCHLIBDIR)/libptscotch$(LIB)
diff --git a/src/check/test_scotch_dgraph_band.c b/src/check/test_scotch_dgraph_band.c
index 9dbd966..2edece6 100644
--- a/src/check/test_scotch_dgraph_band.c
+++ b/src/check/test_scotch_dgraph_band.c
@@ -99,10 +99,12 @@ char * argv[])
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 @@ char * argv[])
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
if (MPI_Barrier (proccomm) != MPI_SUCCESS) { /* Synchronize for debug */
errorPrint ("main: cannot communicate");
diff --git a/src/check/test_scotch_dgraph_grow.c b/src/check/test_scotch_dgraph_grow.c
index e074f83..56a5ebb 100644
--- a/src/check/test_scotch_dgraph_grow.c
+++ b/src/check/test_scotch_dgraph_grow.c
@@ -103,10 +103,12 @@ char * argv[])
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 @@ char * argv[])
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
if (MPI_Barrier (proccomm) != MPI_SUCCESS) { /* Synchronize for debug */
errorPrint ("main: cannot communicate");
diff --git a/src/check/test_scotch_dgraph_redist.c b/src/check/test_scotch_dgraph_redist.c
index 3c1d2e0..84f17e3 100644
--- a/src/check/test_scotch_dgraph_redist.c
+++ b/src/check/test_scotch_dgraph_redist.c
@@ -98,10 +98,12 @@ char * argv[])
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 @@ char * argv[])
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;