Loading Makefile +5 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,11 @@ OPT += -DWRITE_DATA OPT += -DWRITE_IMAGE # perform w-stacking phase correction OPT += -DPHASE_ON # perform ring reduce OPT += -DRING #perform binomial reduce #OPT += -DBINOMIAL DEPS = w-stacking.h main.c w-stacking.cu phase_correction.cu allvars.h init.c gridding.c fourier_transform.c result.c reduce.c numa.h Loading allvars.c +4 −0 Original line number Diff line number Diff line Loading @@ -41,3 +41,7 @@ blocks_t blocks; MPI_Request *requests; int thid; int Ntasks_local; double **swins = NULL; int **cwins = NULL; int max_level = 0; allvars.h +3 −0 Original line number Diff line number Diff line Loading @@ -265,3 +265,6 @@ extern MPI_Request *requests; extern int thid; extern int Ntasks_local; extern blocks_t blocks; extern double **swins; extern int **cwins; extern int max_level; gridding.c +54 −21 Original line number Diff line number Diff line Loading @@ -108,6 +108,7 @@ void gridding_data() if( Me.Rank[HOSTS] >= 0 ) requests = (MPI_Request *)calloc( Me.Ntasks[WORLD], sizeof(MPI_Request) ); #ifdef RING if( Me.Rank[myHOST] == 0 ) { *((int*)win_ctrl_hostmaster_ptr+CTRL_BARRIER_END) = 0; *((int*)win_ctrl_hostmaster_ptr+CTRL_BARRIER_START) = 0; Loading @@ -129,6 +130,22 @@ void gridding_data() for(int b = 1; b < blocks.Nblocks; b++ ) { blocks.Bstart[b] = blocks.Bstart[b-1]+blocks.Bsize[b-1]; blocks.Bsize[b] = size + (b < rem); } #endif #ifdef BINOMIAL copy_win_ptrs( (void***)&swins, Me.swins, Me.Ntasks[Me.SHMEMl] ); copy_win_ptrs( (void***)&cwins, Me.scwins, Me.Ntasks[Me.SHMEMl] ); int dsize_4 = (size_of_grid/4)*4; double *end_4 = (double*)Me.win.ptr + dsize_4; double *end = (double*)Me.win.ptr + datasize; while( (1<< (++max_level) ) < Me.Ntasks[Me.SHMEMl] ); *(int*)Me.win_ctrl.ptr = DATA_FREE; *((int*)Me.win_ctrl.ptr+1) = FINAL_FREE; MPI_Barrier(*(Me.COMM[myHOST])); #endif #endif Loading Loading @@ -282,10 +299,19 @@ void gridding_data() #ifdef ONE_SIDE printf("One Side communication active\n"); //MPI_Win_lock(MPI_LOCK_SHARED,target_rank,0,slabwin); //MPI_Accumulate(gridss,size_of_grid,MPI_DOUBLE,target_rank,0,size_of_grid,MPI_DOUBLE,MPI_SUM,slabwin); //MPI_Win_unlock(target_rank,slabwin); #ifdef RING int res = reduce_ring(target_rank); #endif #ifdef BINOMIAL int res = reduce_binomial(target_rank); #endif // printf("I'm outside reduce global rank %d target rank %d local_rank %d \n", global_rank, target_rank, Me.Rank[HOSTS]); #else // relates to #ifdef ONE_SIDE Loading Loading @@ -427,5 +453,12 @@ void write_gridded_data() #endif //WRITE_DATA } void copy_win_ptrs( void ***A, win_t *B, int n) { if ( *A == NULL ) *A = (void**)malloc( n*sizeof(void*)); for( int i = 0; i < n; i++ ) (*A)[i] = (void*)B[i].ptr; return; } proto.h +2 −2 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ void gridding(); void initialize_array(); void gridding_data(); void write_gridded_data(); void copy_win_ptrs( void ***, win_t *, int n ); /* fourier_transform.c */ Loading @@ -29,5 +29,5 @@ void write_result(); /* reduce.c */ int reduce_ring (int ); void copy_win_ptrs ( void ***, win_t *, int ); int reduce_binomial (int ); int shmem_reduce_ring ( int, int, int_t, map_t *, double * restrict, blocks_t *); Loading
Makefile +5 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,11 @@ OPT += -DWRITE_DATA OPT += -DWRITE_IMAGE # perform w-stacking phase correction OPT += -DPHASE_ON # perform ring reduce OPT += -DRING #perform binomial reduce #OPT += -DBINOMIAL DEPS = w-stacking.h main.c w-stacking.cu phase_correction.cu allvars.h init.c gridding.c fourier_transform.c result.c reduce.c numa.h Loading
allvars.c +4 −0 Original line number Diff line number Diff line Loading @@ -41,3 +41,7 @@ blocks_t blocks; MPI_Request *requests; int thid; int Ntasks_local; double **swins = NULL; int **cwins = NULL; int max_level = 0;
allvars.h +3 −0 Original line number Diff line number Diff line Loading @@ -265,3 +265,6 @@ extern MPI_Request *requests; extern int thid; extern int Ntasks_local; extern blocks_t blocks; extern double **swins; extern int **cwins; extern int max_level;
gridding.c +54 −21 Original line number Diff line number Diff line Loading @@ -108,6 +108,7 @@ void gridding_data() if( Me.Rank[HOSTS] >= 0 ) requests = (MPI_Request *)calloc( Me.Ntasks[WORLD], sizeof(MPI_Request) ); #ifdef RING if( Me.Rank[myHOST] == 0 ) { *((int*)win_ctrl_hostmaster_ptr+CTRL_BARRIER_END) = 0; *((int*)win_ctrl_hostmaster_ptr+CTRL_BARRIER_START) = 0; Loading @@ -129,6 +130,22 @@ void gridding_data() for(int b = 1; b < blocks.Nblocks; b++ ) { blocks.Bstart[b] = blocks.Bstart[b-1]+blocks.Bsize[b-1]; blocks.Bsize[b] = size + (b < rem); } #endif #ifdef BINOMIAL copy_win_ptrs( (void***)&swins, Me.swins, Me.Ntasks[Me.SHMEMl] ); copy_win_ptrs( (void***)&cwins, Me.scwins, Me.Ntasks[Me.SHMEMl] ); int dsize_4 = (size_of_grid/4)*4; double *end_4 = (double*)Me.win.ptr + dsize_4; double *end = (double*)Me.win.ptr + datasize; while( (1<< (++max_level) ) < Me.Ntasks[Me.SHMEMl] ); *(int*)Me.win_ctrl.ptr = DATA_FREE; *((int*)Me.win_ctrl.ptr+1) = FINAL_FREE; MPI_Barrier(*(Me.COMM[myHOST])); #endif #endif Loading Loading @@ -282,10 +299,19 @@ void gridding_data() #ifdef ONE_SIDE printf("One Side communication active\n"); //MPI_Win_lock(MPI_LOCK_SHARED,target_rank,0,slabwin); //MPI_Accumulate(gridss,size_of_grid,MPI_DOUBLE,target_rank,0,size_of_grid,MPI_DOUBLE,MPI_SUM,slabwin); //MPI_Win_unlock(target_rank,slabwin); #ifdef RING int res = reduce_ring(target_rank); #endif #ifdef BINOMIAL int res = reduce_binomial(target_rank); #endif // printf("I'm outside reduce global rank %d target rank %d local_rank %d \n", global_rank, target_rank, Me.Rank[HOSTS]); #else // relates to #ifdef ONE_SIDE Loading Loading @@ -427,5 +453,12 @@ void write_gridded_data() #endif //WRITE_DATA } void copy_win_ptrs( void ***A, win_t *B, int n) { if ( *A == NULL ) *A = (void**)malloc( n*sizeof(void*)); for( int i = 0; i < n; i++ ) (*A)[i] = (void*)B[i].ptr; return; }
proto.h +2 −2 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ void gridding(); void initialize_array(); void gridding_data(); void write_gridded_data(); void copy_win_ptrs( void ***, win_t *, int n ); /* fourier_transform.c */ Loading @@ -29,5 +29,5 @@ void write_result(); /* reduce.c */ int reduce_ring (int ); void copy_win_ptrs ( void ***, win_t *, int ); int reduce_binomial (int ); int shmem_reduce_ring ( int, int, int_t, map_t *, double * restrict, blocks_t *);