Closed arnaualba closed 3 years ago
We have these code lines that I had written where the recvbuf and sendbuf are the same variable (https://github.com/aryafallahi/mithra/blob/75f5e9f589def2404fe8b3fa350d0d6705910762/src/solver.cpp#L409):
MPI_Allreduce(&zMin, &zMin, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); MPI_Allreduce(&bz, &bz, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); unsigned int Nq = chargeVectorn_.size(); MPI_Allreduce(&Nq, &Nq, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
But apparently this is not good practice and causes some errors. This can be fixed with (https://stackoverflow.com/questions/16507865/can-mpi-sendbuf-and-recvbuf-be-the-same-thing):
MPI_Allreduce(MPI_IN_PLACE, &zMin, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); MPI_Allreduce(MPI_IN_PLACE, &bz, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); unsigned int Nq = chargeVectorn_.size(); MPI_Allreduce(MPI_IN_PLACE, &Nq, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
We have these code lines that I had written where the recvbuf and sendbuf are the same variable (https://github.com/aryafallahi/mithra/blob/75f5e9f589def2404fe8b3fa350d0d6705910762/src/solver.cpp#L409):
But apparently this is not good practice and causes some errors. This can be fixed with (https://stackoverflow.com/questions/16507865/can-mpi-sendbuf-and-recvbuf-be-the-same-thing):