From 52f017d8a1042f78e97778bd4da8c3d2ca7a3041 Mon Sep 17 00:00:00 2001 From: Stan Moore Date: Wed, 14 Mar 2018 10:41:12 -0600 Subject: [PATCH] Fix MPI overlapping buffer issue --- src/comm_types/comm_mpi.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/comm_types/comm_mpi.cpp b/src/comm_types/comm_mpi.cpp index 27562ca..45628df 100644 --- a/src/comm_types/comm_mpi.cpp +++ b/src/comm_types/comm_mpi.cpp @@ -149,44 +149,44 @@ void CommMPI::create_domain_decomposition() { void CommMPI::scan_int(T_INT* vals, T_INT count) { if(std::is_same::value) { - MPI_Scan(vals,vals,count,MPI_INT,MPI_SUM,MPI_COMM_WORLD); + MPI_Scan(MPI_IN_PLACE,vals,count,MPI_INT,MPI_SUM,MPI_COMM_WORLD); } } void CommMPI::reduce_int(T_INT* vals, T_INT count) { if(std::is_same::value) { - MPI_Allreduce(vals,vals,count,MPI_INT,MPI_SUM,MPI_COMM_WORLD); + MPI_Allreduce(MPI_IN_PLACE,vals,count,MPI_INT,MPI_SUM,MPI_COMM_WORLD); } } void CommMPI::reduce_float(T_FLOAT* vals, T_INT count) { if(std::is_same::value) { // This generates MPI_ERR_BUFFER for count>1 - MPI_Allreduce(vals,vals,count,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD); + MPI_Allreduce(MPI_IN_PLACE,vals,count,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD); } } void CommMPI::reduce_max_int(T_INT* vals, T_INT count) { if(std::is_same::value) { - MPI_Allreduce(vals,vals,count,MPI_INT,MPI_MAX,MPI_COMM_WORLD); + MPI_Allreduce(MPI_IN_PLACE,vals,count,MPI_INT,MPI_MAX,MPI_COMM_WORLD); } } void CommMPI::reduce_max_float(T_FLOAT* vals, T_INT count) { if(std::is_same::value) { - MPI_Allreduce(vals,vals,count,MPI_DOUBLE,MPI_MAX,MPI_COMM_WORLD); + MPI_Allreduce(MPI_IN_PLACE,vals,count,MPI_DOUBLE,MPI_MAX,MPI_COMM_WORLD); } } void CommMPI::reduce_min_int(T_INT* vals, T_INT count) { if(std::is_same::value) { - MPI_Allreduce(vals,vals,count,MPI_INT,MPI_MAX,MPI_COMM_WORLD); + MPI_Allreduce(MPI_IN_PLACE,vals,count,MPI_INT,MPI_MAX,MPI_COMM_WORLD); } } void CommMPI::reduce_min_float(T_FLOAT* vals, T_INT count) { if(std::is_same::value) { - MPI_Allreduce(vals,vals,count,MPI_DOUBLE,MPI_MAX,MPI_COMM_WORLD); + MPI_Allreduce(MPI_IN_PLACE,vals,count,MPI_DOUBLE,MPI_MAX,MPI_COMM_WORLD); } }