#include #include #include #include #define N 30 shared [(N+2)*(N+2)/THREADS] double grid[N+2][N+2]; shared [(N+2)*(N+2)/THREADS] double new_grid[N+2][N+2]; shared double runtimes[THREADS]; shared double dTmax_local[THREADS]; /* ----------------------------------------------------------------- */ /* Declare two new arrays of shared pointers, having same block sizes as grid[][] and new_grid[][] - The dimension of each pointer can be only N+2 since each pointer only needs to point to the beginning of each row of grid[][] or new_grid[][]. A single shared pointer can also be declared for temporary use in the pointer swapping operation (we mean by shared arrays of pointers here private arrays of pointers, each element pointing to a shared area)*/ shared [(N+2)*(N+2)/THREADS] double *ptr[N+2], *new_ptr[N+2], *tmp_ptr; /* ----------------------------------------------------------------- */ void initialize(void) { int j; for( j=1; j