From ec1c275b539a14881bb8e9093c592cf0c0f7a31f Mon Sep 17 00:00:00 2001 From: David Goz <david.goz@inaf.it> Date: Fri, 21 Jun 2024 08:36:29 +0200 Subject: [PATCH] mpi Makefile bugfix --- jacobi/mpi/SendRecv/Makefile | 5 +- jacobi/mpi/SendRecv/make.def | 2 +- .../mpi/SendRecv/src/jacobi_2D_mpi_sendrecv.c | 26 ++--- jacobi/mpi/Send_Recv_blocking/Makefile | 5 +- jacobi/mpi/Send_Recv_blocking/include/tools.h | 1 + jacobi/mpi/Send_Recv_blocking/make.def | 2 +- .../src/jacobi_2D_mpi_send_recv_blocking.c | 26 ++--- jacobi/mpi/Send_Recv_nonblocking/Makefile | 5 +- jacobi/mpi/Send_Recv_nonblocking/make.def | 2 +- .../src/jacobi_2D_mpi_send_recv_nonblocking.c | 24 ++-- jacobi/mpi/Send_Recv_paired/Makefile | 5 +- jacobi/mpi/Send_Recv_paired/make.def | 2 +- .../src/jacobi_2D_mpi_send_recv_paired.c | 26 ++--- jacobi/mpi/cartesian/Makefile | 5 +- jacobi/mpi/cartesian/make.def | 2 +- jacobi/mpi/comp_comm/make.def | 2 +- .../comp_comm/src/jacobi_2D_mpi_comp_comm.c | 104 ++++-------------- 17 files changed, 99 insertions(+), 145 deletions(-) diff --git a/jacobi/mpi/SendRecv/Makefile b/jacobi/mpi/SendRecv/Makefile index 4d38d38..928007a 100644 --- a/jacobi/mpi/SendRecv/Makefile +++ b/jacobi/mpi/SendRecv/Makefile @@ -12,12 +12,13 @@ include make.def include make_mpi_path ####################################################################### -.PHONY: info mpi valgrind_memcheck valgrind_callgrind valgrind_cachegrind clean +.PHONY: info mpi debug valgrind_memcheck valgrind_callgrind valgrind_cachegrind clean info: @echo ' ' @echo '-----------------------------------------------------------------------------------------' @echo '$$ make ---> compile the mpi application ' + @echo '$$ make debug ---> compile the mpi application for debugger ' @echo '$$ make valgrind_memcheck ---> run the mpi application using Valgrind under Memcheck ' @echo '$$ make valgrind_callgrind ---> run the mpi application using Valgrind under Callgrind ' @echo '$$ make valgrind_cachegrind ---> run the mpi application using Valgrind under Cachegrind ' @@ -28,6 +29,8 @@ info: mpi: $(PROG) +debug: $(PROG_DEBUG) + valgrind_memcheck: $(PROG_MEMCHECK) @echo 'oooOOO... valgrind_memcheck ...OOOooo' mpirun -n 2 valgrind --tool=memcheck -s --default-suppressions=yes --log-file=valgrind_memcheck_log_%p.txt ./$< 5 5 diff --git a/jacobi/mpi/SendRecv/make.def b/jacobi/mpi/SendRecv/make.def index 21f903d..1934487 100644 --- a/jacobi/mpi/SendRecv/make.def +++ b/jacobi/mpi/SendRecv/make.def @@ -21,7 +21,7 @@ $(PROG): $(DEPENDENCIES) @echo ' ' $(PROG_DEBUG): $(DEPENDENCIES) - $(CC) $(CFLAGS) -Og -ggdb3 -fno-omit-frame-pointer -I./include I$(MPI_INC) $(SOURCES) -o $@ -L$(MPI_LIB) $(LIBS) + $(CC) $(CFLAGS) -Og -ggdb3 -DDEBUG -fno-omit-frame-pointer -I./include -I$(MPI_INC) $(SOURCES) -o $@ -L$(MPI_LIB) $(LIBS) @echo ' ' @echo 'Program' $(PROG_DEBUG) 'compiled for' $(SYSTYPE) 'machine' @echo ' ' diff --git a/jacobi/mpi/SendRecv/src/jacobi_2D_mpi_sendrecv.c b/jacobi/mpi/SendRecv/src/jacobi_2D_mpi_sendrecv.c index 9c57baf..2f4fe5b 100644 --- a/jacobi/mpi/SendRecv/src/jacobi_2D_mpi_sendrecv.c +++ b/jacobi/mpi/SendRecv/src/jacobi_2D_mpi_sendrecv.c @@ -409,12 +409,12 @@ void get_domains(MyData **const buffer, { MPI_Status status; MPI_Recv((void *)&boundaries[task], sizeof(myDomain), MPI_BYTE, task, 0, comm, &status); - if ((status.MPI_ERROR != MPI_SUCCESS) || (status.MPI_SOURCE != task)) - { - free(boundaries); - MPI_Abort(comm, EXIT_FAILURE); - exit(EXIT_FAILURE); - } + /* if ((status.MPI_ERROR != MPI_SUCCESS) || (status.MPI_SOURCE != task)) */ + /* { */ + /* free(boundaries); */ + /* MPI_Abort(comm, EXIT_FAILURE); */ + /* exit(EXIT_FAILURE); */ + /* } */ } #if defined(DEBUG) printf("\n\t Diplacements[%d].start = %d - Diplacements[%d].end = %d", @@ -450,12 +450,12 @@ void get_domains(MyData **const buffer, const int nrows = (boundaries[task].end - boundaries[task].start + 1); const int elements = (nrows * (grid_dim + 2)); MPI_Recv((void *)&buffer[boundaries[task].start][0], elements, MPI_MyDatatype, task, 0, comm, &status); - if ((status.MPI_ERROR != MPI_SUCCESS) || (status.MPI_SOURCE != task)) - { - free(boundaries); - MPI_Abort(comm, EXIT_FAILURE); - exit(EXIT_FAILURE); - } + /* if ((status.MPI_ERROR != MPI_SUCCESS) || (status.MPI_SOURCE != task)) */ + /* { */ + /* free(boundaries); */ + /* MPI_Abort(comm, EXIT_FAILURE); */ + /* exit(EXIT_FAILURE); */ + /* } */ } } /* MASTER */ else if (task == rank) @@ -487,7 +487,7 @@ void WriteSolution(MyData **const phi, static int nfile = 0; /* File counter */ - char fname[32]; + char fname[128]; sprintf(fname,"jacobi2D_mpi_sendrecv_%02d.bin", nfile); FILE *fp; diff --git a/jacobi/mpi/Send_Recv_blocking/Makefile b/jacobi/mpi/Send_Recv_blocking/Makefile index 4d38d38..5cac911 100644 --- a/jacobi/mpi/Send_Recv_blocking/Makefile +++ b/jacobi/mpi/Send_Recv_blocking/Makefile @@ -12,12 +12,13 @@ include make.def include make_mpi_path ####################################################################### -.PHONY: info mpi valgrind_memcheck valgrind_callgrind valgrind_cachegrind clean +.PHONY: info mpi debug valgrind_memcheck valgrind_callgrind valgrind_cachegrind clean info: @echo ' ' @echo '-----------------------------------------------------------------------------------------' @echo '$$ make ---> compile the mpi application ' + @echo '$$ make debug ---> compile the mpi application for debugging ' @echo '$$ make valgrind_memcheck ---> run the mpi application using Valgrind under Memcheck ' @echo '$$ make valgrind_callgrind ---> run the mpi application using Valgrind under Callgrind ' @echo '$$ make valgrind_cachegrind ---> run the mpi application using Valgrind under Cachegrind ' @@ -28,6 +29,8 @@ info: mpi: $(PROG) +debug: $(PROG_DEBUG) + valgrind_memcheck: $(PROG_MEMCHECK) @echo 'oooOOO... valgrind_memcheck ...OOOooo' mpirun -n 2 valgrind --tool=memcheck -s --default-suppressions=yes --log-file=valgrind_memcheck_log_%p.txt ./$< 5 5 diff --git a/jacobi/mpi/Send_Recv_blocking/include/tools.h b/jacobi/mpi/Send_Recv_blocking/include/tools.h index 82859ec..066ae34 100644 --- a/jacobi/mpi/Send_Recv_blocking/include/tools.h +++ b/jacobi/mpi/Send_Recv_blocking/include/tools.h @@ -16,3 +16,4 @@ void Show_2DdblArray(const MyData **const A, const char *const string); double seconds(void); + diff --git a/jacobi/mpi/Send_Recv_blocking/make.def b/jacobi/mpi/Send_Recv_blocking/make.def index 27810e9..a1d8f2e 100644 --- a/jacobi/mpi/Send_Recv_blocking/make.def +++ b/jacobi/mpi/Send_Recv_blocking/make.def @@ -21,7 +21,7 @@ $(PROG): $(DEPENDENCIES) @echo ' ' $(PROG_DEBUG): $(DEPENDENCIES) - $(CC) $(CFLAGS) -Og -ggdb3 -fno-omit-frame-pointer -I./include I$(MPI_INC) $(SOURCES) -o $@ -L$(MPI_LIB) $(LIBS) + $(CC) $(CFLAGS) -DDEBUG -Og -ggdb3 -fno-omit-frame-pointer -I./include -I$(MPI_INC) $(SOURCES) -o $@ -L$(MPI_LIB) $(LIBS) @echo ' ' @echo 'Program' $(PROG_DEBUG) 'compiled for' $(SYSTYPE) 'machine' @echo ' ' diff --git a/jacobi/mpi/Send_Recv_blocking/src/jacobi_2D_mpi_send_recv_blocking.c b/jacobi/mpi/Send_Recv_blocking/src/jacobi_2D_mpi_send_recv_blocking.c index 936e663..f8263ae 100644 --- a/jacobi/mpi/Send_Recv_blocking/src/jacobi_2D_mpi_send_recv_blocking.c +++ b/jacobi/mpi/Send_Recv_blocking/src/jacobi_2D_mpi_send_recv_blocking.c @@ -419,12 +419,12 @@ void get_domains(MyData **const buffer, { MPI_Status status; MPI_Recv((void *)&boundaries[task], sizeof(myDomain), MPI_BYTE, task, 0, comm, &status); - if ((status.MPI_ERROR != MPI_SUCCESS) || (status.MPI_SOURCE != task)) - { - free(boundaries); - MPI_Abort(comm, EXIT_FAILURE); - exit(EXIT_FAILURE); - } + /* if ((status.MPI_ERROR != MPI_SUCCESS) || (status.MPI_SOURCE != task)) */ + /* { */ + /* free(boundaries); */ + /* MPI_Abort(comm, EXIT_FAILURE); */ + /* exit(EXIT_FAILURE); */ + /* } */ } #if defined(DEBUG) printf("\n\t Diplacements[%d].start = %d - Diplacements[%d].end = %d", @@ -460,12 +460,12 @@ void get_domains(MyData **const buffer, const int nrows = (boundaries[task].end - boundaries[task].start + 1); const int elements = (nrows * (grid_dim + 2)); MPI_Recv((void *)&buffer[boundaries[task].start][0], elements, MPI_MyDatatype, task, 0, comm, &status); - if ((status.MPI_ERROR != MPI_SUCCESS) || (status.MPI_SOURCE != task)) - { - free(boundaries); - MPI_Abort(comm, EXIT_FAILURE); - exit(EXIT_FAILURE); - } + /* if ((status.MPI_ERROR != MPI_SUCCESS) || (status.MPI_SOURCE != task)) */ + /* { */ + /* free(boundaries); */ + /* MPI_Abort(comm, EXIT_FAILURE); */ + /* exit(EXIT_FAILURE); */ + /* } */ } } /* MASTER */ else if (task == rank) @@ -497,7 +497,7 @@ void WriteSolution(MyData **const phi, static int nfile = 0; /* File counter */ - char fname[32]; + char fname[128]; sprintf(fname,"jacobi2D_mpi_send_recv_blocking_%02d.bin", nfile); FILE *fp; diff --git a/jacobi/mpi/Send_Recv_nonblocking/Makefile b/jacobi/mpi/Send_Recv_nonblocking/Makefile index 4d38d38..928007a 100644 --- a/jacobi/mpi/Send_Recv_nonblocking/Makefile +++ b/jacobi/mpi/Send_Recv_nonblocking/Makefile @@ -12,12 +12,13 @@ include make.def include make_mpi_path ####################################################################### -.PHONY: info mpi valgrind_memcheck valgrind_callgrind valgrind_cachegrind clean +.PHONY: info mpi debug valgrind_memcheck valgrind_callgrind valgrind_cachegrind clean info: @echo ' ' @echo '-----------------------------------------------------------------------------------------' @echo '$$ make ---> compile the mpi application ' + @echo '$$ make debug ---> compile the mpi application for debugger ' @echo '$$ make valgrind_memcheck ---> run the mpi application using Valgrind under Memcheck ' @echo '$$ make valgrind_callgrind ---> run the mpi application using Valgrind under Callgrind ' @echo '$$ make valgrind_cachegrind ---> run the mpi application using Valgrind under Cachegrind ' @@ -28,6 +29,8 @@ info: mpi: $(PROG) +debug: $(PROG_DEBUG) + valgrind_memcheck: $(PROG_MEMCHECK) @echo 'oooOOO... valgrind_memcheck ...OOOooo' mpirun -n 2 valgrind --tool=memcheck -s --default-suppressions=yes --log-file=valgrind_memcheck_log_%p.txt ./$< 5 5 diff --git a/jacobi/mpi/Send_Recv_nonblocking/make.def b/jacobi/mpi/Send_Recv_nonblocking/make.def index 949ebfc..32c1496 100644 --- a/jacobi/mpi/Send_Recv_nonblocking/make.def +++ b/jacobi/mpi/Send_Recv_nonblocking/make.def @@ -21,7 +21,7 @@ $(PROG): $(DEPENDENCIES) @echo ' ' $(PROG_DEBUG): $(DEPENDENCIES) - $(CC) $(CFLAGS) -Og -ggdb3 -fno-omit-frame-pointer -I./include I$(MPI_INC) $(SOURCES) -o $@ -L$(MPI_LIB) $(LIBS) + $(CC) $(CFLAGS) -Og -ggdb3 -DDEBUG -fno-omit-frame-pointer -I./include -I$(MPI_INC) $(SOURCES) -o $@ -L$(MPI_LIB) $(LIBS) @echo ' ' @echo 'Program' $(PROG_DEBUG) 'compiled for' $(SYSTYPE) 'machine' @echo ' ' diff --git a/jacobi/mpi/Send_Recv_nonblocking/src/jacobi_2D_mpi_send_recv_nonblocking.c b/jacobi/mpi/Send_Recv_nonblocking/src/jacobi_2D_mpi_send_recv_nonblocking.c index 8add90d..a03e8cb 100644 --- a/jacobi/mpi/Send_Recv_nonblocking/src/jacobi_2D_mpi_send_recv_nonblocking.c +++ b/jacobi/mpi/Send_Recv_nonblocking/src/jacobi_2D_mpi_send_recv_nonblocking.c @@ -426,12 +426,12 @@ void get_domains(MyData **const buffer, { MPI_Status status; MPI_Recv((void *)&boundaries[task], sizeof(myDomain), MPI_BYTE, task, 0, comm, &status); - if ((status.MPI_ERROR != MPI_SUCCESS) || (status.MPI_SOURCE != task)) - { - free(boundaries); - MPI_Abort(comm, EXIT_FAILURE); - exit(EXIT_FAILURE); - } + /* if ((status.MPI_ERROR != MPI_SUCCESS) || (status.MPI_SOURCE != task)) */ + /* { */ + /* free(boundaries); */ + /* MPI_Abort(comm, EXIT_FAILURE); */ + /* exit(EXIT_FAILURE); */ + /* } */ } #if defined(DEBUG) printf("\n\t Diplacements[%d].start = %d - Diplacements[%d].end = %d", @@ -467,12 +467,12 @@ void get_domains(MyData **const buffer, const int nrows = (boundaries[task].end - boundaries[task].start + 1); const int elements = (nrows * (grid_dim + 2)); MPI_Recv((void *)&buffer[boundaries[task].start][0], elements, MPI_MyDatatype, task, 0, comm, &status); - if ((status.MPI_ERROR != MPI_SUCCESS) || (status.MPI_SOURCE != task)) - { - free(boundaries); - MPI_Abort(comm, EXIT_FAILURE); - exit(EXIT_FAILURE); - } + /* if ((status.MPI_ERROR != MPI_SUCCESS) || (status.MPI_SOURCE != task)) */ + /* { */ + /* free(boundaries); */ + /* MPI_Abort(comm, EXIT_FAILURE); */ + /* exit(EXIT_FAILURE); */ + /* } */ } } /* MASTER */ else if (task == rank) diff --git a/jacobi/mpi/Send_Recv_paired/Makefile b/jacobi/mpi/Send_Recv_paired/Makefile index 4d38d38..928007a 100644 --- a/jacobi/mpi/Send_Recv_paired/Makefile +++ b/jacobi/mpi/Send_Recv_paired/Makefile @@ -12,12 +12,13 @@ include make.def include make_mpi_path ####################################################################### -.PHONY: info mpi valgrind_memcheck valgrind_callgrind valgrind_cachegrind clean +.PHONY: info mpi debug valgrind_memcheck valgrind_callgrind valgrind_cachegrind clean info: @echo ' ' @echo '-----------------------------------------------------------------------------------------' @echo '$$ make ---> compile the mpi application ' + @echo '$$ make debug ---> compile the mpi application for debugger ' @echo '$$ make valgrind_memcheck ---> run the mpi application using Valgrind under Memcheck ' @echo '$$ make valgrind_callgrind ---> run the mpi application using Valgrind under Callgrind ' @echo '$$ make valgrind_cachegrind ---> run the mpi application using Valgrind under Cachegrind ' @@ -28,6 +29,8 @@ info: mpi: $(PROG) +debug: $(PROG_DEBUG) + valgrind_memcheck: $(PROG_MEMCHECK) @echo 'oooOOO... valgrind_memcheck ...OOOooo' mpirun -n 2 valgrind --tool=memcheck -s --default-suppressions=yes --log-file=valgrind_memcheck_log_%p.txt ./$< 5 5 diff --git a/jacobi/mpi/Send_Recv_paired/make.def b/jacobi/mpi/Send_Recv_paired/make.def index 3a66a18..41e5d7b 100644 --- a/jacobi/mpi/Send_Recv_paired/make.def +++ b/jacobi/mpi/Send_Recv_paired/make.def @@ -21,7 +21,7 @@ $(PROG): $(DEPENDENCIES) @echo ' ' $(PROG_DEBUG): $(DEPENDENCIES) - $(CC) $(CFLAGS) -Og -ggdb3 -fno-omit-frame-pointer -I./include I$(MPI_INC) $(SOURCES) -o $@ -L$(MPI_LIB) $(LIBS) + $(CC) $(CFLAGS) -Og -ggdb3 -DDEBUG -fno-omit-frame-pointer -I./include -I$(MPI_INC) $(SOURCES) -o $@ -L$(MPI_LIB) $(LIBS) @echo ' ' @echo 'Program' $(PROG_DEBUG) 'compiled for' $(SYSTYPE) 'machine' @echo ' ' diff --git a/jacobi/mpi/Send_Recv_paired/src/jacobi_2D_mpi_send_recv_paired.c b/jacobi/mpi/Send_Recv_paired/src/jacobi_2D_mpi_send_recv_paired.c index c78c890..5218815 100644 --- a/jacobi/mpi/Send_Recv_paired/src/jacobi_2D_mpi_send_recv_paired.c +++ b/jacobi/mpi/Send_Recv_paired/src/jacobi_2D_mpi_send_recv_paired.c @@ -441,12 +441,12 @@ void get_domains(MyData **const buffer, { MPI_Status status; MPI_Recv((void *)&boundaries[task], sizeof(myDomain), MPI_BYTE, task, 0, comm, &status); - if ((status.MPI_ERROR != MPI_SUCCESS) || (status.MPI_SOURCE != task)) - { - free(boundaries); - MPI_Abort(comm, EXIT_FAILURE); - exit(EXIT_FAILURE); - } + /* if ((status.MPI_ERROR != MPI_SUCCESS) || (status.MPI_SOURCE != task)) */ + /* { */ + /* free(boundaries); */ + /* MPI_Abort(comm, EXIT_FAILURE); */ + /* exit(EXIT_FAILURE); */ + /* } */ } #if defined(DEBUG) printf("\n\t Diplacements[%d].start = %d - Diplacements[%d].end = %d", @@ -482,12 +482,12 @@ void get_domains(MyData **const buffer, const int nrows = (boundaries[task].end - boundaries[task].start + 1); const int elements = (nrows * (grid_dim + 2)); MPI_Recv((void *)&buffer[boundaries[task].start][0], elements, MPI_MyDatatype, task, 0, comm, &status); - if ((status.MPI_ERROR != MPI_SUCCESS) || (status.MPI_SOURCE != task)) - { - free(boundaries); - MPI_Abort(comm, EXIT_FAILURE); - exit(EXIT_FAILURE); - } + /* if ((status.MPI_ERROR != MPI_SUCCESS) || (status.MPI_SOURCE != task)) */ + /* { */ + /* free(boundaries); */ + /* MPI_Abort(comm, EXIT_FAILURE); */ + /* exit(EXIT_FAILURE); */ + /* } */ } } /* MASTER */ else if (task == rank) @@ -519,7 +519,7 @@ void WriteSolution(MyData **const phi, static int nfile = 0; /* File counter */ - char fname[32]; + char fname[128]; sprintf(fname,"jacobi2D_mpi_send_recv_paired_%02d.bin", nfile); FILE *fp; diff --git a/jacobi/mpi/cartesian/Makefile b/jacobi/mpi/cartesian/Makefile index 02695b4..cf2b7db 100644 --- a/jacobi/mpi/cartesian/Makefile +++ b/jacobi/mpi/cartesian/Makefile @@ -12,12 +12,13 @@ include make.def include make_mpi_path ####################################################################### -.PHONY: info mpi valgrind_memcheck valgrind_callgrind valgrind_cachegrind clean +.PHONY: info mpi debug valgrind_memcheck valgrind_callgrind valgrind_cachegrind clean info: @echo ' ' @echo '-----------------------------------------------------------------------------------------' @echo '$$ make ---> compile the mpi application ' + @echo '$$ make debug ---> compile the mpi application for debugger ' @echo '$$ make valgrind_memcheck ---> run the mpi application using Valgrind under Memcheck ' @echo '$$ make valgrind_callgrind ---> run the mpi application using Valgrind under Callgrind ' @echo '$$ make valgrind_cachegrind ---> run the mpi application using Valgrind under Cachegrind ' @@ -28,6 +29,8 @@ info: mpi: $(PROG) +debug: $(PROG_DEBUG) + valgrind_memcheck: $(PROG_MEMCHECK) @echo 'oooOOO... valgrind_memcheck ...OOOooo' mpirun -n 4 valgrind --tool=memcheck -s --default-suppressions=yes --log-file=valgrind_memcheck_log_%p.txt ./$< 9 2 diff --git a/jacobi/mpi/cartesian/make.def b/jacobi/mpi/cartesian/make.def index 9b01186..bafed56 100644 --- a/jacobi/mpi/cartesian/make.def +++ b/jacobi/mpi/cartesian/make.def @@ -21,7 +21,7 @@ $(PROG): $(DEPENDENCIES) @echo ' ' $(PROG_DEBUG): $(DEPENDENCIES) - $(CC) $(CFLAGS) -Og -ggdb3 -fno-omit-frame-pointer -I./include I$(MPI_INC) $(SOURCES) -o $@ -L$(MPI_LIB) $(LIBS) + $(CC) $(CFLAGS) -Og -ggdb3 -DDEBUG -fno-omit-frame-pointer -I./include -I$(MPI_INC) $(SOURCES) -o $@ -L$(MPI_LIB) $(LIBS) @echo ' ' @echo 'Program' $(PROG_DEBUG) 'compiled for' $(SYSTYPE) 'machine' @echo ' ' diff --git a/jacobi/mpi/comp_comm/make.def b/jacobi/mpi/comp_comm/make.def index bacfcdd..02fee4d 100644 --- a/jacobi/mpi/comp_comm/make.def +++ b/jacobi/mpi/comp_comm/make.def @@ -21,7 +21,7 @@ $(PROG): $(DEPENDENCIES) @echo ' ' $(PROG_DEBUG): $(DEPENDENCIES) - $(CC) $(CFLAGS) -Og -ggdb3 -fno-omit-frame-pointer -I./include -I$(MPI_INC) $(SOURCES) -o $@ -L$(MPI_LIB) $(LIBS) + $(CC) $(CFLAGS) -Og -ggdb3 -DDEBUG -fno-omit-frame-pointer -I./include -I$(MPI_INC) $(SOURCES) -o $@ -L$(MPI_LIB) $(LIBS) @echo ' ' @echo 'Program' $(PROG_DEBUG) 'compiled for' $(SYSTYPE) 'machine' @echo ' ' diff --git a/jacobi/mpi/comp_comm/src/jacobi_2D_mpi_comp_comm.c b/jacobi/mpi/comp_comm/src/jacobi_2D_mpi_comp_comm.c index bbd6ffb..0a9dc72 100644 --- a/jacobi/mpi/comp_comm/src/jacobi_2D_mpi_comp_comm.c +++ b/jacobi/mpi/comp_comm/src/jacobi_2D_mpi_comp_comm.c @@ -14,8 +14,6 @@ #include <math.h> #include <string.h> -#define DEBUG - static int NX_GLOB, NY_GLOB; MyData **global_phi; @@ -112,8 +110,6 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } - - /* get the comm size */ MPI_Comm_size(ThisTask.comm2d, &ThisTask.nranks); @@ -476,98 +472,40 @@ void Jacobi_Communication(MyData **const restrict Phi, const int jend = ThisTask->domain.local_end[X] - 1; const int ibeg = ThisTask->domain.local_start[Y] + 1; const int iend = ThisTask->domain.local_end[Y] - 1; - -#if defined(DEBUG) + /* wait the data on the boundaries */ MPI_Waitall(8, request, MPI_STATUSES_IGNORE); - + *error = 0.0; /* JacobiAlgorithm(Phi, Phi0, delta, jbeg, jend, ibeg, iend, error); */ - JacobiAlgorithm(Phi, Phi0, delta, - ThisTask->domain.local_start[X]+1, ThisTask->domain.local_end[X]-1, - ThisTask->domain.local_start[Y] , ThisTask->domain.local_end[Y], - error); - - /* /\* data from nbrbottom have been received *\/ */ - JacobiAlgorithm(Phi, Phi0, delta, - ThisTask->domain.local_start[X], ThisTask->domain.local_start[X], - ThisTask->domain.local_start[Y], ThisTask->domain.local_end[Y], - error); - - /* /\* data from nbrtop have been received *\/ */ - JacobiAlgorithm(Phi, Phi0, delta, - ThisTask->domain.local_end[X], ThisTask->domain.local_end[X], - ThisTask->domain.local_start[Y], ThisTask->domain.local_end[Y], - error); - - /* /\* data from nbrleft have been received *\/ */ + JacobiAlgorithm(Phi, Phi0, delta, jbeg-1, jend+1, ibeg-1, iend+1, error); + + /* /\* wait the data on the boundaries *\/ */ + /* MPI_Waitall(8, request, MPI_STATUSES_IGNORE); */ + + /* /\* nbrbottom *\/ */ + /* JacobiAlgorithm(Phi, Phi0, delta, */ + /* ThisTask->domain.local_start[X], ThisTask->domain.local_start[X], */ + /* ThisTask->domain.local_start[Y], ThisTask->domain.local_end[Y], */ + /* error); */ + + /* /\* nbrtop *\/ */ + /* JacobiAlgorithm(Phi, Phi0, delta, */ + /* ThisTask->domain.local_end[X], ThisTask->domain.local_end[X], */ + /* ThisTask->domain.local_start[Y], ThisTask->domain.local_end[Y], */ + /* error); */ + + /* /\* nbrleft *\/ */ /* JacobiAlgorithm(Phi, Phi0, delta, */ /* ThisTask->domain.local_start[X], ThisTask->domain.local_end[X], */ /* ThisTask->domain.local_start[Y], ThisTask->domain.local_start[Y], */ /* error); */ - /* /\* data from nbrright have been received *\/ */ + /* /\* nbrright *\/ */ /* JacobiAlgorithm(Phi, Phi0, delta, */ /* ThisTask->domain.local_start[X], ThisTask->domain.local_end[X], */ /* ThisTask->domain.local_end[Y], ThisTask->domain.local_end[Y], */ /* error); */ - -#else - - /**********************************************************************************************/ - - *error = 0.0; - JacobiAlgorithm(Phi, Phi0, delta, jbeg, jend, ibeg, iend, error); - - /* waits for any specified MPI Request to complete */ - for (int req=0 ; req<8 ; req++) - { - int idx; - MPI_Status status; - - MPI_Waitany(8, request, &idx, &status); - - switch(status.MPI_TAG) - { - /* communication with tag 0 completed */ - case 0: - /* data from nbrbottom have been received */ - JacobiAlgorithm(Phi, Phi0, delta, - ThisTask->domain.local_start[X], ThisTask->domain.local_start[X], - ThisTask->domain.local_start[Y], ThisTask->domain.local_end[Y], - error); - break; - - /* communication with tag 1 completed */ - case 1: - /* data from nbrtop have been received */ - JacobiAlgorithm(Phi, Phi0, delta, - ThisTask->domain.local_end[X], ThisTask->domain.local_end[X], - ThisTask->domain.local_start[Y], ThisTask->domain.local_end[Y], - error); - break; - - /* communication with tag 2 completed */ - case 2: - /* data from nbrleft have been received */ - JacobiAlgorithm(Phi, Phi0, delta, - ThisTask->domain.local_start[X], ThisTask->domain.local_end[X], - ThisTask->domain.local_start[Y], ThisTask->domain.local_start[Y], - error); - break; - - /* communication with tag 3 completed */ - case 3: - /* data from nbrright have been received */ - JacobiAlgorithm(Phi, Phi0, delta, - ThisTask->domain.local_start[X], ThisTask->domain.local_end[X], - ThisTask->domain.local_end[Y], ThisTask->domain.local_end[Y], - error); - break; - } - } - -#endif /* DEBUG */ MPI_Type_free(&column); -- GitLab