Skip to content
Snippets Groups Projects
Commit d38712c8 authored by Tom Fischer's avatar Tom Fischer
Browse files

[BL/MPI.h] In / out buffers must not be aliased

See https://www.mpi-forum.org/docs/mpi-4.1/mpi41-report.pdf page 10

The following error message on JUWELS is fixed with this commit

vtkMPICommunicator.cxx:60    WARN| MPI had an error
------------------------------------------------
Invalid buffer pointer, error stack:
internal_Allgather(133): MPI_Allgather(sendbuf=0x1233940, sendcount=1, MPI_UNSIGNED_LONG, recvbuf=0x1233840, recvcount=1, MPI_UNSIGNED_LONG, MPI_COMM_WORLD) failed
internal_Allgather(85).: Buffers must not be aliased
parent 69f6c74e
No related branches found
No related tags found
No related merge requests found
......@@ -101,10 +101,8 @@ static std::vector<T> allgather(T const& value, Mpi const& mpi)
{
std::vector<T> result(mpi.size);
result[mpi.rank] = value;
MPI_Allgather(&result[mpi.rank], 1, mpiType<T>(), result.data(), 1,
mpiType<T>(), mpi.communicator);
MPI_Allgather(&value, 1, mpiType<T>(), result.data(), 1, mpiType<T>(),
mpi.communicator);
return result;
}
......@@ -116,10 +114,8 @@ static std::vector<T> allgather(std::vector<T> const& vector, Mpi const& mpi)
// Flat in memory over all ranks;
std::vector<T> result(mpi.size * size);
std::copy_n(vector.begin(), size, &result[mpi.rank * size]);
MPI_Allgather(&result[mpi.rank * size], size, mpiType<T>(), result.data(),
size, mpiType<T>(), mpi.communicator);
MPI_Allgather(vector.data(), size, mpiType<T>(), result.data(), size,
mpiType<T>(), mpi.communicator);
return result;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment