add functions to copy send / recv list from ScaLBL
This commit is contained in:
parent
4661cbdce4
commit
2894b740d0
|
@ -474,6 +474,164 @@ void ScaLBL_Communicator::wait( std::vector<std::shared_ptr<MPI_Request>>& reque
|
|||
}
|
||||
|
||||
|
||||
/********************************************************
|
||||
* Get send/recv lists *
|
||||
********************************************************/
|
||||
int ScaLBL_Communicator::copyRecvList(const char *dir, int *buffer) {
|
||||
if (dir[0] == 'x') {
|
||||
if (dir[1] == 0){
|
||||
int *TempBuffer = new int [recvCount_x];
|
||||
ScaLBL_CopyToHost(TempBuffer,dvcRecvList_x,recvCount_x*sizeof(int));
|
||||
ScaLBL_AllocateZeroCopy((void **) &buffer, recvCount_x*sizeof(int));
|
||||
ScaLBL_CopyToZeroCopy(buffer,TempBuffer,recvCount_x*sizeof(int));
|
||||
return recvCount_x;
|
||||
}
|
||||
else if (dir[1] == 'y')
|
||||
return recvCount_xy;
|
||||
else if (dir[1] == 'Y')
|
||||
return recvCount_xY;
|
||||
else if (dir[1] == 'z')
|
||||
return recvCount_xz;
|
||||
else if (dir[1] == 'Z')
|
||||
return recvCount_xZ;
|
||||
} else if (dir[0] == 'y') {
|
||||
if (dir[1] == 0){
|
||||
int *TempBuffer = new int [recvCount_y];
|
||||
ScaLBL_CopyToHost(TempBuffer,dvcRecvList_y,recvCount_y*sizeof(int));
|
||||
ScaLBL_AllocateZeroCopy((void **) &buffer, recvCount_y*sizeof(int));
|
||||
ScaLBL_CopyToZeroCopy(buffer,TempBuffer,recvCount_y*sizeof(int));
|
||||
return recvCount_y;
|
||||
}
|
||||
else if (dir[1] == 'z')
|
||||
return recvCount_yz;
|
||||
else if (dir[1] == 'Z')
|
||||
return recvCount_yZ;
|
||||
} else if (dir[0] == 'z') {
|
||||
if (dir[1] == 0){
|
||||
int *TempBuffer = new int [recvCount_z];
|
||||
ScaLBL_CopyToHost(TempBuffer,dvcRecvList_z,recvCount_z*sizeof(int));
|
||||
ScaLBL_AllocateZeroCopy((void **) &buffer, recvCount_z*sizeof(int));
|
||||
ScaLBL_CopyToZeroCopy(buffer,TempBuffer,recvCount_z*sizeof(int));
|
||||
return recvCount_z;
|
||||
}
|
||||
} else if (dir[0] == 'X') {
|
||||
if (dir[1] == 0){
|
||||
int *TempBuffer = new int [recvCount_X];
|
||||
ScaLBL_CopyToHost(TempBuffer,dvcRecvList_X,recvCount_X*sizeof(int));
|
||||
ScaLBL_AllocateZeroCopy((void **) &buffer, recvCount_X*sizeof(int));
|
||||
ScaLBL_CopyToZeroCopy(buffer,TempBuffer,recvCount_X*sizeof(int));
|
||||
return recvCount_X;
|
||||
}
|
||||
else if (dir[1] == 'y')
|
||||
return recvCount_Xy;
|
||||
else if (dir[1] == 'Y')
|
||||
return recvCount_XY;
|
||||
else if (dir[1] == 'z')
|
||||
return recvCount_Xz;
|
||||
else if (dir[1] == 'Z')
|
||||
return recvCount_XZ;
|
||||
} else if (dir[0] == 'Y') {
|
||||
if (dir[1] == 0){
|
||||
int *TempBuffer = new int [recvCount_Y];
|
||||
ScaLBL_CopyToHost(TempBuffer,dvcRecvList_Y,recvCount_Y*sizeof(int));
|
||||
ScaLBL_AllocateZeroCopy((void **) &buffer, recvCount_Y*sizeof(int));
|
||||
ScaLBL_CopyToZeroCopy(buffer,TempBuffer,recvCount_Y*sizeof(int));
|
||||
return recvCount_Y;
|
||||
}
|
||||
else if (dir[1] == 'z')
|
||||
return recvCount_Yz;
|
||||
else if (dir[1] == 'Z')
|
||||
return recvCount_YZ;
|
||||
} else if (dir[0] == 'Z') {
|
||||
if (dir[1] == 0){
|
||||
int *TempBuffer = new int [recvCount_Z];
|
||||
ScaLBL_CopyToHost(TempBuffer,dvcRecvList_Z,recvCount_Z*sizeof(int));
|
||||
ScaLBL_AllocateZeroCopy((void **) &buffer, recvCount_Z*sizeof(int));
|
||||
ScaLBL_CopyToZeroCopy(buffer,TempBuffer,recvCount_Z*sizeof(int));
|
||||
return recvCount_Z;
|
||||
}
|
||||
}
|
||||
throw std::logic_error("Internal error");
|
||||
}
|
||||
|
||||
int ScaLBL_Communicator::copySendList(const char *dir, int *buffer) {
|
||||
if (dir[0] == 'x') {
|
||||
if (dir[1] == 0){
|
||||
int *TempBuffer = new int [sendCount_x];
|
||||
ScaLBL_CopyToHost(TempBuffer,dvcSendList_x,sendCount_x*sizeof(int));
|
||||
ScaLBL_AllocateZeroCopy((void **) &buffer, sendCount_x*sizeof(int));
|
||||
ScaLBL_CopyToZeroCopy(buffer,TempBuffer,sendCount_x*sizeof(int));
|
||||
return sendCount_x;
|
||||
}
|
||||
else if (dir[1] == 'y')
|
||||
return sendCount_xy;
|
||||
else if (dir[1] == 'Y')
|
||||
return sendCount_xY;
|
||||
else if (dir[1] == 'z')
|
||||
return sendCount_xz;
|
||||
else if (dir[1] == 'Z')
|
||||
return sendCount_xZ;
|
||||
} else if (dir[0] == 'y') {
|
||||
if (dir[1] == 0){
|
||||
int *TempBuffer = new int [sendCount_y];
|
||||
ScaLBL_CopyToHost(TempBuffer,dvcSendList_y,sendCount_y*sizeof(int));
|
||||
ScaLBL_AllocateZeroCopy((void **) &buffer, sendCount_y*sizeof(int));
|
||||
ScaLBL_CopyToZeroCopy(buffer,TempBuffer,sendCount_y*sizeof(int));
|
||||
return sendCount_y;
|
||||
}
|
||||
else if (dir[1] == 'z')
|
||||
return sendCount_yz;
|
||||
else if (dir[1] == 'Z')
|
||||
return sendCount_yZ;
|
||||
} else if (dir[0] == 'z') {
|
||||
if (dir[1] == 0){
|
||||
int *TempBuffer = new int [sendCount_z];
|
||||
ScaLBL_CopyToHost(TempBuffer,dvcSendList_z,sendCount_z*sizeof(int));
|
||||
ScaLBL_AllocateZeroCopy((void **) &buffer, sendCount_z*sizeof(int));
|
||||
ScaLBL_CopyToZeroCopy(buffer,TempBuffer,sendCount_z*sizeof(int));
|
||||
return sendCount_z;
|
||||
}
|
||||
} else if (dir[0] == 'X') {
|
||||
if (dir[1] == 0){
|
||||
int *TempBuffer = new int [sendCount_X];
|
||||
ScaLBL_CopyToHost(TempBuffer,dvcSendList_X,sendCount_X*sizeof(int));
|
||||
ScaLBL_AllocateZeroCopy((void **) &buffer, sendCount_X*sizeof(int));
|
||||
ScaLBL_CopyToZeroCopy(buffer,TempBuffer,sendCount_X*sizeof(int));
|
||||
return sendCount_X;
|
||||
}
|
||||
else if (dir[1] == 'y')
|
||||
return sendCount_Xy;
|
||||
else if (dir[1] == 'Y')
|
||||
return sendCount_XY;
|
||||
else if (dir[1] == 'z')
|
||||
return sendCount_Xz;
|
||||
else if (dir[1] == 'Z')
|
||||
return sendCount_XZ;
|
||||
} else if (dir[0] == 'Y') {
|
||||
if (dir[1] == 0){
|
||||
int *TempBuffer = new int [sendCount_Y];
|
||||
ScaLBL_CopyToHost(TempBuffer,dvcSendList_Y,sendCount_Y*sizeof(int));
|
||||
ScaLBL_AllocateZeroCopy((void **) &buffer, sendCount_Y*sizeof(int));
|
||||
ScaLBL_CopyToZeroCopy(buffer,TempBuffer,sendCount_Y*sizeof(int));
|
||||
return sendCount_Y;
|
||||
}
|
||||
else if (dir[1] == 'z')
|
||||
return sendCount_Yz;
|
||||
else if (dir[1] == 'Z')
|
||||
return sendCount_YZ;
|
||||
} else if (dir[0] == 'Z') {
|
||||
if (dir[1] == 0){
|
||||
int *TempBuffer = new int [sendCount_Z];
|
||||
ScaLBL_CopyToHost(TempBuffer,dvcSendList_Z,sendCount_Z*sizeof(int));
|
||||
ScaLBL_AllocateZeroCopy((void **) &buffer, sendCount_Z*sizeof(int));
|
||||
ScaLBL_CopyToZeroCopy(buffer,TempBuffer,sendCount_Z*sizeof(int));
|
||||
return sendCount_Z;
|
||||
}
|
||||
}
|
||||
throw std::logic_error("Internal error");
|
||||
}
|
||||
|
||||
|
||||
double ScaLBL_Communicator::GetPerformance(int *NeighborList, double *fq, int Np){
|
||||
/* EACH MPI PROCESS GETS ITS OWN MEASUREMENT*/
|
||||
/* use MRT kernels to check performance without communication / synchronization */
|
||||
|
|
|
@ -744,6 +744,8 @@ public:
|
|||
int LastExterior();
|
||||
int FirstInterior();
|
||||
int LastInterior();
|
||||
int copySendList(const char *dir, int *buffer);
|
||||
int copyRecvList(const char *dir, int *buffer);
|
||||
|
||||
double GetPerformance(int *NeighborList, double *fq, int Np);
|
||||
int MemoryOptimizedLayoutAA(IntArray &Map, int *neighborList, signed char *id, int Np, int width);
|
||||
|
@ -830,7 +832,6 @@ private:
|
|||
int rank_xz,rank_XZ,rank_xZ,rank_Xz;
|
||||
int rank_yz,rank_YZ,rank_yZ,rank_Yz;
|
||||
//......................................................................................
|
||||
//......................................................................................
|
||||
int sendCount_x, sendCount_y, sendCount_z, sendCount_X, sendCount_Y, sendCount_Z;
|
||||
int sendCount_xy, sendCount_yz, sendCount_xz, sendCount_Xy, sendCount_Yz, sendCount_xZ;
|
||||
int sendCount_xY, sendCount_yZ, sendCount_Xz, sendCount_XY, sendCount_YZ, sendCount_XZ;
|
||||
|
@ -851,6 +852,8 @@ private:
|
|||
int *dvcRecvDist_x, *dvcRecvDist_y, *dvcRecvDist_z, *dvcRecvDist_X, *dvcRecvDist_Y, *dvcRecvDist_Z;
|
||||
int *dvcRecvDist_xy, *dvcRecvDist_yz, *dvcRecvDist_xz, *dvcRecvDist_Xy, *dvcRecvDist_Yz, *dvcRecvDist_xZ;
|
||||
int *dvcRecvDist_xY, *dvcRecvDist_yZ, *dvcRecvDist_Xz, *dvcRecvDist_XY, *dvcRecvDist_YZ, *dvcRecvDist_XZ;
|
||||
//......................................................................................
|
||||
|
||||
// MPI requests for persistent communications
|
||||
std::vector<std::shared_ptr<MPI_Request>> req_D3Q19AA;
|
||||
std::vector<std::shared_ptr<MPI_Request>> req_BiD3Q19AA;
|
||||
|
|
Loading…
Reference in New Issue
Block a user