#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]; shared [(N+2)*(N+2)/THREADS] double *ptr[N+2], *new_ptr[N+2], *tmp_ptr; /* ----------------------------------------------------------------- */ /* duplicate the previous pointers, by declaring them private. The size of *ptr_priv[] and *new_ptr_priv[] is only the number of "local" rows, not the total number of rows */ #define PRIV_SIZE ((N+2)/THREADS) double *ptr_priv[PRIV_SIZE], *new_ptr_priv[PRIV_SIZE], *tmp_ptr_priv; /* ----------------------------------------------------------------- */ void initialize(void) { int j; for( j=1; j