#ifndef STENCIL_H #define STENCIL_H #include #define NB_THREADS 4 #define N 50 /* matrix size */ #define NB_STEPS 20 /* number of iterations */ struct shared_memory_t { double cur_step[N*N]; double next_step[N*N]; sem_t step_produced; sem_t step_consumed; }; #define SHM_SIZE sizeof(struct shared_memory_t) #define KEY "/key_stencil" /* access tab[i][j] if tab is a 1-D array */ #define GET(tab, i, j) (tab[ ( (i) * N ) + (j)]) void compute_boundaries(int *i_min, int *i_max, int *j_min, int *j_max, int nb_threads, int my_id); void print_matrix(double* matrix); #define GET_TIME(t) gettimeofday(&(t), NULL) /* time difference in micro seconds */ #define TIME_DIFF(t1, t2) ((t2.tv_sec-t1.tv_sec)*1e6 + (t2.tv_usec - t1.tv_usec))/1e6 #endif /* TOOLS_H */