Skip to content
Snippets Groups Projects
Commit 624fdbdb authored by Nandhana Sakhtivel's avatar Nandhana Sakhtivel
Browse files

NUMA awarness

parent f5ab873e
No related branches found
No related tags found
No related merge requests found
...@@ -30,7 +30,7 @@ endif ...@@ -30,7 +30,7 @@ endif
#OPT += -DNVIDIA #OPT += -DNVIDIA
# perform one-side communication (suggested) instead of reduce (only if MPI is active) # perform one-side communication (suggested) instead of reduce (only if MPI is active)
#OPT += -DONE_SIDE OPT += -DONE_SIDE
# write the full 3D cube of gridded visibilities and its FFT transform # write the full 3D cube of gridded visibilities and its FFT transform
#OPT += -DWRITE_DATA #OPT += -DWRITE_DATA
# write the final image # write the final image
...@@ -39,8 +39,8 @@ OPT += -DWRITE_IMAGE ...@@ -39,8 +39,8 @@ OPT += -DWRITE_IMAGE
OPT += -DPHASE_ON OPT += -DPHASE_ON
DEPS = w-stacking.h main.c w-stacking.cu phase_correction.cu allvars.h init.c gridding.c fourier_transform.c result.c DEPS = w-stacking.h main.c w-stacking.cu phase_correction.cu allvars.h init.c gridding.c fourier_transform.c result.c numa.h
COBJ = w-stacking.o main.o phase_correction.o allvars.o init.o gridding.o fourier_transform.o result.o COBJ = w-stacking.o main.o phase_correction.o allvars.o init.o gridding.o fourier_transform.o result.o numa.o
w-stacking.c: w-stacking.cu w-stacking.c: w-stacking.cu
cp w-stacking.cu w-stacking.c cp w-stacking.cu w-stacking.c
......
...@@ -27,6 +27,7 @@ long * histo_send, size_of_grid; ...@@ -27,6 +27,7 @@ long * histo_send, size_of_grid;
double * grid, *gridss, *gridss_real, *gridss_img, *gridss_w; double * grid, *gridss, *gridss_real, *gridss_img, *gridss_w;
#ifdef USE_MPI #ifdef USE_MPI
MPI_Comm MYMPI_COMM_WORLD;
MPI_Win slabwin; MPI_Win slabwin;
#endif #endif
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#include <math.h> #include <math.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "numa.h"
extern struct io extern struct io
{ {
...@@ -128,6 +130,7 @@ extern long * histo_send, size_of_grid; ...@@ -128,6 +130,7 @@ extern long * histo_send, size_of_grid;
extern double * grid, *gridss, *gridss_real, *gridss_img, *gridss_w; extern double * grid, *gridss, *gridss_real, *gridss_img, *gridss_w;
#ifdef USE_MPI #ifdef USE_MPI
extern MPI_Comm MYMPI_COMM_WORLD;
extern MPI_Win slabwin; extern MPI_Win slabwin;
#endif #endif
......
...@@ -248,6 +248,7 @@ void gridding_data(){ ...@@ -248,6 +248,7 @@ void gridding_data(){
#ifdef ONE_SIDE #ifdef ONE_SIDE
printf("One Side communication active\n"); printf("One Side communication active\n");
memcpy(Me.win.ptr, gridss, size_of_grid);
MPI_Win_lock(MPI_LOCK_SHARED,target_rank,0,slabwin); 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_Accumulate(gridss,size_of_grid,MPI_DOUBLE,target_rank,0,size_of_grid,MPI_DOUBLE,MPI_SUM,slabwin);
MPI_Win_unlock(target_rank,slabwin); MPI_Win_unlock(target_rank,slabwin);
......
...@@ -30,6 +30,10 @@ void init(int index) ...@@ -30,6 +30,10 @@ void init(int index)
xaxis = local_grid_size_x; xaxis = local_grid_size_x;
yaxis = local_grid_size_y; yaxis = local_grid_size_y;
#ifdef USE_MPI
init_numa( rank, size, &MYMPI_COMM_WORLD, &Me );
#endif
clock_gettime(CLOCK_MONOTONIC, &begin); clock_gettime(CLOCK_MONOTONIC, &begin);
start = clock(); start = clock();
......
...@@ -28,6 +28,7 @@ int main(int argc, char * argv[]) ...@@ -28,6 +28,7 @@ int main(int argc, char * argv[])
#ifdef USE_FFTW #ifdef USE_FFTW
fftw_mpi_init(); fftw_mpi_init();
#endif #endif
MPI_Comm_dup(MPI_COMM_WORLD, &MYMPI_COMM_WORLD);
#else #else
rank = 0; rank = 0;
size = 1; size = 1;
......
/* function declaration */ /* function declaration */
/* numa.c */
int init_numa( int, int, MPI_Comm *, map_t *);
int shutdown_numa( int, int, MPI_Comm *, map_t *);
/* init.c */ /* init.c */
void init(int i); void init(int i);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment