source: soft/giet_vm/applications/ocean/decs.h

Last change on this file was 799, checked in by alain, 8 years ago

Introducing a port of ocean application without macros.

File size: 6.9 KB
Line 
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#include <user_barrier.h>
31#include <user_lock.h>
32
33// macro to use a shared TTY with the GIET_VM
34#define printf(...);    { lock_acquire( &tty_lock ); \
35                          giet_tty_printf(__VA_ARGS__);  \
36                          lock_release( &tty_lock ); }
37
38///////////////////////////////////////////////////////////////////////
39//             structures definition
40///////////////////////////////////////////////////////////////////////
41
42struct multi_struct
43{
44    double err_multi;
45};
46
47struct global_struct
48{
49    double psiai;
50    double psibi;
51};
52
53struct Global_Private
54{
55    long *     rel_num_x;        // array[numlev]
56    long *     rel_num_y;        // array[numlev]
57    long *     eist;             // array[numlev]
58    long *     ejst;             // array[numlev]
59    long *     oist;             // array[numlev]
60    long *     ojst;             // array[numlev]
61    long *     rlist;            // array[numlev]
62    long *     rljst;            // array[numlev]
63    long *     rlien;            // array[numlev]
64    long *     rljen;            // array[numlev]
65    long       rownum;
66    long       colnum;
67    long       neighbors[8];
68    long       total_time;       // total number of cyles in slave()
69    long       multi_time;       // number of cycles in multig()
70    long       sync_time;        // number of cycles waiting barriers
71    long       steps_time[10];   // number of cycles in phases of slave2()
72};
73
74///////////////////////////////////////////////////////////////////////
75//        extern global variables
76///////////////////////////////////////////////////////////////////////
77
78extern struct multi_struct *    multi;
79extern struct global_struct *   global;
80extern struct Global_Private ** gps;
81
82extern user_lock_t              tty_lock;
83
84extern giet_sqt_barrier_t       barrier;
85
86extern sqt_lock_t               id_lock;
87extern sqt_lock_t               psiai_lock;
88extern sqt_lock_t               psibi_lock;
89extern sqt_lock_t               done_lock;
90extern sqt_lock_t               error_lock;
91extern sqt_lock_t               bar_lock;
92
93extern double                   eig2;
94extern double                   ysca;
95extern long                     jmm1;
96extern const double             pi;
97extern const double             dt0;
98
99extern double ****              psi;
100extern double ****              psim;
101extern double ***               psium;
102extern double ***               psilm;
103extern double ***               psib;
104extern double ***               ga;
105extern double ***               gb;
106extern double ****              work1;
107extern double ***               work2;
108extern double ***               work3;
109extern double ****              work4;
110extern double ****              work5;
111extern double ***               work6;
112extern double ****              work7;
113extern double ****              temparray;
114extern double ***               tauz;
115extern double ***               oldga;
116extern double ***               oldgb;
117extern double *                 f;
118extern double ****              q_multi;
119extern double ****              rhs_multi;
120
121extern double                   factjacob;
122extern double                   factlap;
123
124extern double *                 i_int_coeff;
125extern double *                 j_int_coeff;
126
127extern long                     xprocs;
128extern long                     yprocs;
129
130extern long                     numlev;
131
132extern long *                   imx;
133extern long *                   jmx;
134extern double                   tolerance;
135extern double *                 lev_res;
136extern double *                 lev_tol;
137extern const double             maxwork;
138extern long *                   xpts_per_proc;
139extern long *                   ypts_per_proc;
140extern long                     minlevel;
141extern const double             outday0;
142extern const double             outday1;
143extern const double             outday2;
144extern const double             outday3;
145
146extern long                     nprocs;
147
148extern const double             h1;
149extern const double             h3;
150extern const double             h;
151extern const double             lf;
152extern double                   res;
153extern double                   dtau;
154extern const double             f0;
155extern const double             beta;
156extern const double             gpr;
157extern long                     oim;
158extern long                     im;
159extern long                     jm;
160
161/*
162 * jacobcalc.C
163 */
164void jacobcalc (double ***x, double ***y, double ***z, long pid, long firstrow, long lastrow, long firstcol, long lastcol);
165
166/*
167 * jacobcalc2.C
168 */
169void jacobcalc2 (double ****x, double ****y, double ****z, long psiindex, long pid, long firstrow, long lastrow, long firstcol, long lastcol);
170
171/*
172 * laplacalc.C
173 */
174void laplacalc (long procid, double ****x, double ****z, long psiindex, long firstrow, long lastrow, long firstcol, long lastcol);
175
176/*
177 * linkup.C
178 */
179void link_all (void);
180void linkup (double **row_ptr);
181void link_multi (void);
182
183/*
184 * main.C
185 */
186long log_2 (long number);
187void printerr (char *s);
188
189/*
190 * multi.C
191 */
192void multig (long my_id);
193void relax (long k, double *err, long color, long my_num);
194void rescal (long kf, long my_num);
195void intadd (long kc, long my_num);
196void putz (long k, long my_num);
197void copy_borders (long k, long pid);
198void copy_rhs_borders (long k, long procid);
199void copy_red (long k, long procid);
200void copy_black (long k, long procid);
201
202/*
203 * slave1.C
204 */
205void slave (long *ptr_procid);
206
207/*
208 * slave2.C
209 */
210void slave2 (long procid, long firstrow, long lastrow, long numrows, long firstcol, long lastcol, long numcols);
211
212/*
213 * subblock.C
214 */
215void subblock (void);
Note: See TracBrowser for help on using the repository browser.