1 | /*************************************************************************/ |
---|
2 | /* */ |
---|
3 | /* Copyright (c) 1994 Stanford University */ |
---|
4 | /* */ |
---|
5 | /* All rights reserved. */ |
---|
6 | /* */ |
---|
7 | /* Permission is given to use, copy, and modify this software for any */ |
---|
8 | /* non-commercial purpose as long as this copyright notice is not */ |
---|
9 | /* removed. All other uses, including redistribution in whole or in */ |
---|
10 | /* part, are forbidden without prior written permission. */ |
---|
11 | /* */ |
---|
12 | /* This software is provided with absolutely no warranty and no */ |
---|
13 | /* support. */ |
---|
14 | /* */ |
---|
15 | /*************************************************************************/ |
---|
16 | |
---|
17 | #define MASTER 0 |
---|
18 | #define RED_ITER 0 |
---|
19 | #define BLACK_ITER 1 |
---|
20 | #define UP 0 |
---|
21 | #define DOWN 1 |
---|
22 | #define LEFT 2 |
---|
23 | #define RIGHT 3 |
---|
24 | #define UPLEFT 4 |
---|
25 | #define UPRIGHT 5 |
---|
26 | #define DOWNLEFT 6 |
---|
27 | #define DOWNRIGHT 7 |
---|
28 | #define PAGE_SIZE 4096 |
---|
29 | |
---|
30 | struct multi_struct { |
---|
31 | double err_multi; |
---|
32 | }; |
---|
33 | |
---|
34 | extern struct multi_struct *multi; |
---|
35 | |
---|
36 | struct global_struct { |
---|
37 | //long id; |
---|
38 | unsigned long long starttime; |
---|
39 | unsigned long long trackstart; |
---|
40 | double psiai; |
---|
41 | double psibi; |
---|
42 | }; |
---|
43 | |
---|
44 | extern struct global_struct *global; |
---|
45 | |
---|
46 | extern double eig2; |
---|
47 | extern double ysca; |
---|
48 | extern long jmm1; |
---|
49 | extern const double pi; |
---|
50 | extern const double t0; |
---|
51 | |
---|
52 | extern double ****psi; |
---|
53 | extern double ****psim; |
---|
54 | extern double ***psium; |
---|
55 | extern double ***psilm; |
---|
56 | extern double ***psib; |
---|
57 | extern double ***ga; |
---|
58 | extern double ***gb; |
---|
59 | extern double ****work1; |
---|
60 | extern double ***work2; |
---|
61 | extern double ***work3; |
---|
62 | extern double ****work4; |
---|
63 | extern double ****work5; |
---|
64 | extern double ***work6; |
---|
65 | extern double ****work7; |
---|
66 | extern double ****temparray; |
---|
67 | extern double ***tauz; |
---|
68 | extern double ***oldga; |
---|
69 | extern double ***oldgb; |
---|
70 | extern double *f; |
---|
71 | extern double ****q_multi; |
---|
72 | extern double ****rhs_multi; |
---|
73 | |
---|
74 | struct locks_struct { |
---|
75 | LOCKDEC(idlock) |
---|
76 | LOCKDEC(psiailock) |
---|
77 | LOCKDEC(psibilock) |
---|
78 | LOCKDEC(donelock) |
---|
79 | LOCKDEC(error_lock) |
---|
80 | LOCKDEC(bar_lock) |
---|
81 | }; |
---|
82 | |
---|
83 | extern struct locks_struct *locks; |
---|
84 | |
---|
85 | struct bars_struct { |
---|
86 | #if defined(MULTIPLE_BARRIERS) |
---|
87 | BARDEC(iteration) |
---|
88 | BARDEC(gsudn) |
---|
89 | BARDEC(p_setup) |
---|
90 | BARDEC(p_redph) |
---|
91 | BARDEC(p_soln) |
---|
92 | BARDEC(p_subph) |
---|
93 | BARDEC(sl_prini) |
---|
94 | BARDEC(sl_psini) |
---|
95 | BARDEC(sl_onetime) |
---|
96 | BARDEC(sl_phase_1) |
---|
97 | BARDEC(sl_phase_2) |
---|
98 | BARDEC(sl_phase_3) |
---|
99 | BARDEC(sl_phase_4) |
---|
100 | BARDEC(sl_phase_5) |
---|
101 | BARDEC(sl_phase_6) |
---|
102 | BARDEC(sl_phase_7) |
---|
103 | BARDEC(sl_phase_8) |
---|
104 | BARDEC(sl_phase_9) |
---|
105 | BARDEC(sl_phase_10) |
---|
106 | BARDEC(error_barrier) |
---|
107 | #else |
---|
108 | BARDEC(barrier) |
---|
109 | #endif |
---|
110 | }; |
---|
111 | |
---|
112 | extern struct bars_struct *bars; |
---|
113 | |
---|
114 | extern double factjacob; |
---|
115 | extern double factlap; |
---|
116 | |
---|
117 | struct Global_Private { |
---|
118 | char *pad; //[PAGE_SIZE]; |
---|
119 | long *rel_num_x; |
---|
120 | long *rel_num_y; |
---|
121 | long *eist; |
---|
122 | long *ejst; |
---|
123 | long *oist; |
---|
124 | long *ojst; |
---|
125 | long *rlist; |
---|
126 | long *rljst; |
---|
127 | long *rlien; |
---|
128 | long *rljen; |
---|
129 | long *rownum; |
---|
130 | long *colnum; |
---|
131 | long *neighbors; //[8]; |
---|
132 | long *lpid; |
---|
133 | double *multi_time; |
---|
134 | double *total_time; |
---|
135 | double *sync_time; |
---|
136 | double *process_time; |
---|
137 | double *steps_time; //[10] |
---|
138 | double *step_start; |
---|
139 | }; |
---|
140 | |
---|
141 | extern struct Global_Private *gp; |
---|
142 | |
---|
143 | extern double *i_int_coeff; |
---|
144 | extern double *j_int_coeff; |
---|
145 | extern long xprocs; |
---|
146 | extern long yprocs; |
---|
147 | |
---|
148 | extern long numlev; |
---|
149 | extern long *imx; |
---|
150 | extern long *jmx; |
---|
151 | extern double tolerance; |
---|
152 | extern double *lev_res; |
---|
153 | extern double *lev_tol; |
---|
154 | extern const double maxwork; |
---|
155 | extern long *xpts_per_proc; |
---|
156 | extern long *ypts_per_proc; |
---|
157 | extern long minlevel; |
---|
158 | extern const double outday0; |
---|
159 | extern const double outday1; |
---|
160 | extern const double outday2; |
---|
161 | extern const double outday3; |
---|
162 | |
---|
163 | extern long nprocs; |
---|
164 | extern const double h1; |
---|
165 | extern const double h3; |
---|
166 | extern const double h; |
---|
167 | extern const double lf; |
---|
168 | extern double res; |
---|
169 | extern double dtau; |
---|
170 | extern const double f0; |
---|
171 | extern const double beta; |
---|
172 | extern const double gpr; |
---|
173 | extern long oim; |
---|
174 | extern long im; |
---|
175 | extern long jm; |
---|
176 | extern long do_stats; |
---|
177 | extern long do_output; |
---|
178 | extern long *multi_times; |
---|
179 | extern long *total_times; |
---|
180 | |
---|
181 | /* |
---|
182 | * jacobcalc.C |
---|
183 | */ |
---|
184 | void jacobcalc (double ***x, double ***y, double ***z, long pid, long firstrow, long lastrow, long firstcol, long lastcol); |
---|
185 | |
---|
186 | /* |
---|
187 | * jacobcalc2.C |
---|
188 | */ |
---|
189 | void jacobcalc2 (double ****x, double ****y, double ****z, long psiindex, long pid, long firstrow, long lastrow, long firstcol, long lastcol); |
---|
190 | |
---|
191 | /* |
---|
192 | * laplacalc.C |
---|
193 | */ |
---|
194 | void laplacalc (long procid, double ****x, double ****z, long psiindex, long firstrow, long lastrow, long firstcol, long lastcol); |
---|
195 | |
---|
196 | /* |
---|
197 | * linkup.C |
---|
198 | */ |
---|
199 | void link_all (void); |
---|
200 | void linkup (double **row_ptr); |
---|
201 | void link_multi (void); |
---|
202 | |
---|
203 | /* |
---|
204 | * main.C |
---|
205 | */ |
---|
206 | long log_2 (long number); |
---|
207 | void printerr (char *s); |
---|
208 | |
---|
209 | /* |
---|
210 | * multi.C |
---|
211 | */ |
---|
212 | void multig (long my_id); |
---|
213 | void relax (long k, double *err, long color, long my_num); |
---|
214 | void rescal (long kf, long my_num); |
---|
215 | void intadd (long kc, long my_num); |
---|
216 | void putz (long k, long my_num); |
---|
217 | void copy_borders (long k, long pid); |
---|
218 | void copy_rhs_borders (long k, long procid); |
---|
219 | void copy_red (long k, long procid); |
---|
220 | void copy_black (long k, long procid); |
---|
221 | |
---|
222 | /* |
---|
223 | * slave1.C |
---|
224 | */ |
---|
225 | void slave (long *ptr_procid); |
---|
226 | |
---|
227 | /* |
---|
228 | * slave2.C |
---|
229 | */ |
---|
230 | void slave2 (long procid, long firstrow, long lastrow, long numrows, long firstcol, long lastcol, long numcols); |
---|
231 | |
---|
232 | /* |
---|
233 | * subblock.C |
---|
234 | */ |
---|
235 | void subblock (void); |
---|