mirror of
https://github.com/paboyle/Grid.git
synced 2026-09-05 01:09:35 +01:00
IO updates for AllToAllV aggregation of contiguous chunks.
May finally clean up the poor MPI2 IO performance issue that has been persistent.
This commit is contained in:
@@ -238,6 +238,16 @@ public:
|
||||
}
|
||||
void AllToAll(int dim ,void *in,void *out,uint64_t words,uint64_t bytes);
|
||||
void AllToAll(void *in,void *out,uint64_t words ,uint64_t bytes);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Variable count all to all. Counts and displacements are in units of
|
||||
// "bytes" sized words and are indexed by rank within this communicator.
|
||||
// For exchanges that are a permutation but do not divide evenly between
|
||||
// ranks; AllToAll above is the uniform count special case.
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
void AllToAllV(void *in ,const std::vector<int> &sendcounts,const std::vector<int> &senddispls,
|
||||
void *out,const std::vector<int> &recvcounts,const std::vector<int> &recvdispls,
|
||||
uint64_t bytes);
|
||||
|
||||
template<class obj> void Broadcast(int root,obj &data)
|
||||
{
|
||||
|
||||
@@ -945,5 +945,25 @@ void CartesianCommunicator::AllToAll(void *in,void *out,uint64_t words,uint64_t
|
||||
MPI_Alltoall(in,iwords,object,out,iwords,object,communicator);
|
||||
MPI_Type_free(&object);
|
||||
}
|
||||
void CartesianCommunicator::AllToAllV(void *in ,const std::vector<int> &sendcounts,const std::vector<int> &senddispls,
|
||||
void *out,const std::vector<int> &recvcounts,const std::vector<int> &recvdispls,
|
||||
uint64_t bytes)
|
||||
{
|
||||
FlightRecorder::StepLog("AllToAllV");
|
||||
GRID_ASSERT(sendcounts.size()==(size_t)_Nprocessors);
|
||||
GRID_ASSERT(senddispls.size()==(size_t)_Nprocessors);
|
||||
GRID_ASSERT(recvcounts.size()==(size_t)_Nprocessors);
|
||||
GRID_ASSERT(recvdispls.size()==(size_t)_Nprocessors);
|
||||
// MPI counts are "int"; the caller sizes the word to keep them in range
|
||||
int ibytes = bytes;
|
||||
GRID_ASSERT(bytes == (uint64_t)ibytes);
|
||||
MPI_Datatype object;
|
||||
MPI_Type_contiguous(ibytes,MPI_BYTE,&object);
|
||||
MPI_Type_commit(&object);
|
||||
int ierr = MPI_Alltoallv(in ,(int *)&sendcounts[0],(int *)&senddispls[0],object,
|
||||
out,(int *)&recvcounts[0],(int *)&recvdispls[0],object,communicator);
|
||||
GRID_ASSERT(ierr==0);
|
||||
MPI_Type_free(&object);
|
||||
}
|
||||
|
||||
NAMESPACE_END(Grid);
|
||||
|
||||
@@ -113,6 +113,17 @@ void CartesianCommunicator::AllToAll(void *in,void *out,uint64_t words,uint64_t
|
||||
{
|
||||
bcopy(in,out,bytes*words);
|
||||
}
|
||||
void CartesianCommunicator::AllToAllV(void *in ,const std::vector<int> &sendcounts,const std::vector<int> &senddispls,
|
||||
void *out,const std::vector<int> &recvcounts,const std::vector<int> &recvdispls,
|
||||
uint64_t bytes)
|
||||
{
|
||||
// Single rank: the exchange degenerates to a copy of our own segment
|
||||
GRID_ASSERT(sendcounts.size()==1);
|
||||
GRID_ASSERT(recvcounts.size()==1);
|
||||
GRID_ASSERT(sendcounts[0]==recvcounts[0]);
|
||||
bcopy((char *)in +(uint64_t)senddispls[0]*bytes,
|
||||
(char *)out+(uint64_t)recvdispls[0]*bytes,bytes*(uint64_t)sendcounts[0]);
|
||||
}
|
||||
|
||||
int CartesianCommunicator::RankWorld(void){return 0;}
|
||||
void CartesianCommunicator::Barrier(void){}
|
||||
|
||||
Reference in New Issue
Block a user