Trying to fix bug with MPI communication
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
inline void PackID(int *list, int count, char *sendbuf, char *ID){
|
||||
inline void PackID(const int *list, int count, char *sendbuf, char *ID){
|
||||
// Fill in the phase ID values from neighboring processors
|
||||
// This packs up the values that need to be sent from one processor to another
|
||||
int idx,n;
|
||||
@@ -32,7 +32,7 @@ inline void PackID(int *list, int count, char *sendbuf, char *ID){
|
||||
}
|
||||
//***************************************************************************************
|
||||
|
||||
inline void UnpackID(int *list, int count, char *recvbuf, char *ID){
|
||||
inline void UnpackID(const int *list, int count, char *recvbuf, char *ID){
|
||||
// Fill in the phase ID values from neighboring processors
|
||||
// This unpacks the values once they have been recieved from neighbors
|
||||
int idx,n;
|
||||
@@ -91,44 +91,44 @@ inline void MorphOpen(DoubleArray SignDist, char *id, Domain &Dm, int nx, int ny
|
||||
char *recvID_xy, *recvID_yz, *recvID_xz, *recvID_Xy, *recvID_Yz, *recvID_xZ;
|
||||
char *recvID_xY, *recvID_yZ, *recvID_Xz, *recvID_XY, *recvID_YZ, *recvID_XZ;
|
||||
// send buffers
|
||||
sendID_x = new char [Dm.sendCount_x];
|
||||
sendID_y = new char [Dm.sendCount_y];
|
||||
sendID_z = new char [Dm.sendCount_z];
|
||||
sendID_X = new char [Dm.sendCount_X];
|
||||
sendID_Y = new char [Dm.sendCount_Y];
|
||||
sendID_Z = new char [Dm.sendCount_Z];
|
||||
sendID_xy = new char [Dm.sendCount_xy];
|
||||
sendID_yz = new char [Dm.sendCount_yz];
|
||||
sendID_xz = new char [Dm.sendCount_xz];
|
||||
sendID_Xy = new char [Dm.sendCount_Xy];
|
||||
sendID_Yz = new char [Dm.sendCount_Yz];
|
||||
sendID_xZ = new char [Dm.sendCount_xZ];
|
||||
sendID_xY = new char [Dm.sendCount_xY];
|
||||
sendID_yZ = new char [Dm.sendCount_yZ];
|
||||
sendID_Xz = new char [Dm.sendCount_Xz];
|
||||
sendID_XY = new char [Dm.sendCount_XY];
|
||||
sendID_YZ = new char [Dm.sendCount_YZ];
|
||||
sendID_XZ = new char [Dm.sendCount_XZ];
|
||||
sendID_x = new char [Dm.sendCount("x")];
|
||||
sendID_y = new char [Dm.sendCount("y")];
|
||||
sendID_z = new char [Dm.sendCount("z")];
|
||||
sendID_X = new char [Dm.sendCount("X")];
|
||||
sendID_Y = new char [Dm.sendCount("Y")];
|
||||
sendID_Z = new char [Dm.sendCount("Z")];
|
||||
sendID_xy = new char [Dm.sendCount("xy")];
|
||||
sendID_yz = new char [Dm.sendCount("yz")];
|
||||
sendID_xz = new char [Dm.sendCount("xz")];
|
||||
sendID_Xy = new char [Dm.sendCount("Xy")];
|
||||
sendID_Yz = new char [Dm.sendCount("Yz")];
|
||||
sendID_xZ = new char [Dm.sendCount("xZ")];
|
||||
sendID_xY = new char [Dm.sendCount("xY")];
|
||||
sendID_yZ = new char [Dm.sendCount("yZ")];
|
||||
sendID_Xz = new char [Dm.sendCount("Xz")];
|
||||
sendID_XY = new char [Dm.sendCount("XY")];
|
||||
sendID_YZ = new char [Dm.sendCount("YZ")];
|
||||
sendID_XZ = new char [Dm.sendCount("XZ")];
|
||||
//......................................................................................
|
||||
// recv buffers
|
||||
recvID_x = new char [Dm.recvCount_x];
|
||||
recvID_y = new char [Dm.recvCount_y];
|
||||
recvID_z = new char [Dm.recvCount_z];
|
||||
recvID_X = new char [Dm.recvCount_X];
|
||||
recvID_Y = new char [Dm.recvCount_Y];
|
||||
recvID_Z = new char [Dm.recvCount_Z];
|
||||
recvID_xy = new char [Dm.recvCount_xy];
|
||||
recvID_yz = new char [Dm.recvCount_yz];
|
||||
recvID_xz = new char [Dm.recvCount_xz];
|
||||
recvID_Xy = new char [Dm.recvCount_Xy];
|
||||
recvID_xZ = new char [Dm.recvCount_xZ];
|
||||
recvID_xY = new char [Dm.recvCount_xY];
|
||||
recvID_yZ = new char [Dm.recvCount_yZ];
|
||||
recvID_Yz = new char [Dm.recvCount_Yz];
|
||||
recvID_Xz = new char [Dm.recvCount_Xz];
|
||||
recvID_XY = new char [Dm.recvCount_XY];
|
||||
recvID_YZ = new char [Dm.recvCount_YZ];
|
||||
recvID_XZ = new char [Dm.recvCount_XZ];
|
||||
recvID_x = new char [Dm.recvCount("x")];
|
||||
recvID_y = new char [Dm.recvCount("y")];
|
||||
recvID_z = new char [Dm.recvCount("z")];
|
||||
recvID_X = new char [Dm.recvCount("X")];
|
||||
recvID_Y = new char [Dm.recvCount("Y")];
|
||||
recvID_Z = new char [Dm.recvCount("Z")];
|
||||
recvID_xy = new char [Dm.recvCount("xy")];
|
||||
recvID_yz = new char [Dm.recvCount("yz")];
|
||||
recvID_xz = new char [Dm.recvCount("xz")];
|
||||
recvID_Xy = new char [Dm.recvCount("Xy")];
|
||||
recvID_xZ = new char [Dm.recvCount("xZ")];
|
||||
recvID_xY = new char [Dm.recvCount("xY")];
|
||||
recvID_yZ = new char [Dm.recvCount("yZ")];
|
||||
recvID_Yz = new char [Dm.recvCount("Yz")];
|
||||
recvID_Xz = new char [Dm.recvCount("Xz")];
|
||||
recvID_XY = new char [Dm.recvCount("XY")];
|
||||
recvID_YZ = new char [Dm.recvCount("YZ")];
|
||||
recvID_XZ = new char [Dm.recvCount("XZ")];
|
||||
//......................................................................................
|
||||
int sendtag,recvtag;
|
||||
sendtag = recvtag = 7;
|
||||
@@ -194,62 +194,62 @@ inline void MorphOpen(DoubleArray SignDist, char *id, Domain &Dm, int nx, int ny
|
||||
|
||||
|
||||
// Pack and send the updated ID values
|
||||
PackID(Dm.sendList_x, Dm.sendCount_x ,sendID_x, id);
|
||||
PackID(Dm.sendList_X, Dm.sendCount_X ,sendID_X, id);
|
||||
PackID(Dm.sendList_y, Dm.sendCount_y ,sendID_y, id);
|
||||
PackID(Dm.sendList_Y, Dm.sendCount_Y ,sendID_Y, id);
|
||||
PackID(Dm.sendList_z, Dm.sendCount_z ,sendID_z, id);
|
||||
PackID(Dm.sendList_Z, Dm.sendCount_Z ,sendID_Z, id);
|
||||
PackID(Dm.sendList_xy, Dm.sendCount_xy ,sendID_xy, id);
|
||||
PackID(Dm.sendList_Xy, Dm.sendCount_Xy ,sendID_Xy, id);
|
||||
PackID(Dm.sendList_xY, Dm.sendCount_xY ,sendID_xY, id);
|
||||
PackID(Dm.sendList_XY, Dm.sendCount_XY ,sendID_XY, id);
|
||||
PackID(Dm.sendList_xz, Dm.sendCount_xz ,sendID_xz, id);
|
||||
PackID(Dm.sendList_Xz, Dm.sendCount_Xz ,sendID_Xz, id);
|
||||
PackID(Dm.sendList_xZ, Dm.sendCount_xZ ,sendID_xZ, id);
|
||||
PackID(Dm.sendList_XZ, Dm.sendCount_XZ ,sendID_XZ, id);
|
||||
PackID(Dm.sendList_yz, Dm.sendCount_yz ,sendID_yz, id);
|
||||
PackID(Dm.sendList_Yz, Dm.sendCount_Yz ,sendID_Yz, id);
|
||||
PackID(Dm.sendList_yZ, Dm.sendCount_yZ ,sendID_yZ, id);
|
||||
PackID(Dm.sendList_YZ, Dm.sendCount_YZ ,sendID_YZ, id);
|
||||
PackID(Dm.sendList("x"), Dm.sendCount("x") ,sendID_x, id);
|
||||
PackID(Dm.sendList("X"), Dm.sendCount("X") ,sendID_X, id);
|
||||
PackID(Dm.sendList("y"), Dm.sendCount("y") ,sendID_y, id);
|
||||
PackID(Dm.sendList("Y"), Dm.sendCount("Y") ,sendID_Y, id);
|
||||
PackID(Dm.sendList("z"), Dm.sendCount("z") ,sendID_z, id);
|
||||
PackID(Dm.sendList("Z"), Dm.sendCount("Z") ,sendID_Z, id);
|
||||
PackID(Dm.sendList("xy"), Dm.sendCount("xy") ,sendID_xy, id);
|
||||
PackID(Dm.sendList("Xy"), Dm.sendCount("Xy") ,sendID_Xy, id);
|
||||
PackID(Dm.sendList("xY"), Dm.sendCount("xY") ,sendID_xY, id);
|
||||
PackID(Dm.sendList("XY"), Dm.sendCount("XY") ,sendID_XY, id);
|
||||
PackID(Dm.sendList("xz"), Dm.sendCount("xz") ,sendID_xz, id);
|
||||
PackID(Dm.sendList("Xz"), Dm.sendCount("Xz") ,sendID_Xz, id);
|
||||
PackID(Dm.sendList("xZ"), Dm.sendCount("xZ") ,sendID_xZ, id);
|
||||
PackID(Dm.sendList("XZ"), Dm.sendCount("XZ") ,sendID_XZ, id);
|
||||
PackID(Dm.sendList("yz"), Dm.sendCount("yz") ,sendID_yz, id);
|
||||
PackID(Dm.sendList("Yz"), Dm.sendCount("Yz") ,sendID_Yz, id);
|
||||
PackID(Dm.sendList("yZ"), Dm.sendCount("yZ") ,sendID_yZ, id);
|
||||
PackID(Dm.sendList("YZ"), Dm.sendCount("YZ") ,sendID_YZ, id);
|
||||
//......................................................................................
|
||||
Dm.Comm.sendrecv(sendID_x,Dm.sendCount_x,Dm.rank_x(),sendtag,recvID_X,Dm.recvCount_X,Dm.rank_X(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_X,Dm.sendCount_X,Dm.rank_X(),sendtag,recvID_x,Dm.recvCount_x,Dm.rank_x(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_y,Dm.sendCount_y,Dm.rank_y(),sendtag,recvID_Y,Dm.recvCount_Y,Dm.rank_Y(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_Y,Dm.sendCount_Y,Dm.rank_Y(),sendtag,recvID_y,Dm.recvCount_y,Dm.rank_y(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_z,Dm.sendCount_z,Dm.rank_z(),sendtag,recvID_Z,Dm.recvCount_Z,Dm.rank_Z(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_Z,Dm.sendCount_Z,Dm.rank_Z(),sendtag,recvID_z,Dm.recvCount_z,Dm.rank_z(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_xy,Dm.sendCount_xy,Dm.rank_xy(),sendtag,recvID_XY,Dm.recvCount_XY,Dm.rank_XY(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_XY,Dm.sendCount_XY,Dm.rank_XY(),sendtag,recvID_xy,Dm.recvCount_xy,Dm.rank_xy(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_Xy,Dm.sendCount_Xy,Dm.rank_Xy(),sendtag,recvID_xY,Dm.recvCount_xY,Dm.rank_xY(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_xY,Dm.sendCount_xY,Dm.rank_xY(),sendtag,recvID_Xy,Dm.recvCount_Xy,Dm.rank_Xy(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_xz,Dm.sendCount_xz,Dm.rank_xz(),sendtag,recvID_XZ,Dm.recvCount_XZ,Dm.rank_XZ(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_XZ,Dm.sendCount_XZ,Dm.rank_XZ(),sendtag,recvID_xz,Dm.recvCount_xz,Dm.rank_xz(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_Xz,Dm.sendCount_Xz,Dm.rank_Xz(),sendtag,recvID_xZ,Dm.recvCount_xZ,Dm.rank_xZ(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_xZ,Dm.sendCount_xZ,Dm.rank_xZ(),sendtag,recvID_Xz,Dm.recvCount_Xz,Dm.rank_Xz(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_yz,Dm.sendCount_yz,Dm.rank_yz(),sendtag,recvID_YZ,Dm.recvCount_YZ,Dm.rank_YZ(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_YZ,Dm.sendCount_YZ,Dm.rank_YZ(),sendtag,recvID_yz,Dm.recvCount_yz,Dm.rank_yz(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_Yz,Dm.sendCount_Yz,Dm.rank_Yz(),sendtag,recvID_yZ,Dm.recvCount_yZ,Dm.rank_yZ(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_yZ,Dm.sendCount_yZ,Dm.rank_yZ(),sendtag,recvID_Yz,Dm.recvCount_Yz,Dm.rank_Yz(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_x,Dm.sendCount("x"),Dm.rank_x(),sendtag,recvID_X,Dm.recvCount("X"),Dm.rank_X(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_X,Dm.sendCount("X"),Dm.rank_X(),sendtag,recvID_x,Dm.recvCount("x"),Dm.rank_x(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_y,Dm.sendCount("y"),Dm.rank_y(),sendtag,recvID_Y,Dm.recvCount("Y"),Dm.rank_Y(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_Y,Dm.sendCount("Y"),Dm.rank_Y(),sendtag,recvID_y,Dm.recvCount("y"),Dm.rank_y(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_z,Dm.sendCount("z"),Dm.rank_z(),sendtag,recvID_Z,Dm.recvCount("Z"),Dm.rank_Z(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_Z,Dm.sendCount("Z"),Dm.rank_Z(),sendtag,recvID_z,Dm.recvCount("z"),Dm.rank_z(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_xy,Dm.sendCount("xy"),Dm.rank_xy(),sendtag,recvID_XY,Dm.recvCount("XY"),Dm.rank_XY(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_XY,Dm.sendCount("XY"),Dm.rank_XY(),sendtag,recvID_xy,Dm.recvCount("xy"),Dm.rank_xy(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_Xy,Dm.sendCount("Xy"),Dm.rank_Xy(),sendtag,recvID_xY,Dm.recvCount("xY"),Dm.rank_xY(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_xY,Dm.sendCount("xY"),Dm.rank_xY(),sendtag,recvID_Xy,Dm.recvCount("Xy"),Dm.rank_Xy(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_xz,Dm.sendCount("xz"),Dm.rank_xz(),sendtag,recvID_XZ,Dm.recvCount("XZ"),Dm.rank_XZ(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_XZ,Dm.sendCount("XZ"),Dm.rank_XZ(),sendtag,recvID_xz,Dm.recvCount("xz"),Dm.rank_xz(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_Xz,Dm.sendCount("Xz"),Dm.rank_Xz(),sendtag,recvID_xZ,Dm.recvCount("xZ"),Dm.rank_xZ(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_xZ,Dm.sendCount("xZ"),Dm.rank_xZ(),sendtag,recvID_Xz,Dm.recvCount("Xz"),Dm.rank_Xz(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_yz,Dm.sendCount("yz"),Dm.rank_yz(),sendtag,recvID_YZ,Dm.recvCount("YZ"),Dm.rank_YZ(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_YZ,Dm.sendCount("YZ"),Dm.rank_YZ(),sendtag,recvID_yz,Dm.recvCount("yz"),Dm.rank_yz(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_Yz,Dm.sendCount("Yz"),Dm.rank_Yz(),sendtag,recvID_yZ,Dm.recvCount("yZ"),Dm.rank_yZ(),recvtag);
|
||||
Dm.Comm.sendrecv(sendID_yZ,Dm.sendCount("yZ"),Dm.rank_yZ(),sendtag,recvID_Yz,Dm.recvCount("Yz"),Dm.rank_Yz(),recvtag);
|
||||
//......................................................................................
|
||||
UnpackID(Dm.recvList_x, Dm.recvCount_x ,recvID_x, id);
|
||||
UnpackID(Dm.recvList_X, Dm.recvCount_X ,recvID_X, id);
|
||||
UnpackID(Dm.recvList_y, Dm.recvCount_y ,recvID_y, id);
|
||||
UnpackID(Dm.recvList_Y, Dm.recvCount_Y ,recvID_Y, id);
|
||||
UnpackID(Dm.recvList_z, Dm.recvCount_z ,recvID_z, id);
|
||||
UnpackID(Dm.recvList_Z, Dm.recvCount_Z ,recvID_Z, id);
|
||||
UnpackID(Dm.recvList_xy, Dm.recvCount_xy ,recvID_xy, id);
|
||||
UnpackID(Dm.recvList_Xy, Dm.recvCount_Xy ,recvID_Xy, id);
|
||||
UnpackID(Dm.recvList_xY, Dm.recvCount_xY ,recvID_xY, id);
|
||||
UnpackID(Dm.recvList_XY, Dm.recvCount_XY ,recvID_XY, id);
|
||||
UnpackID(Dm.recvList_xz, Dm.recvCount_xz ,recvID_xz, id);
|
||||
UnpackID(Dm.recvList_Xz, Dm.recvCount_Xz ,recvID_Xz, id);
|
||||
UnpackID(Dm.recvList_xZ, Dm.recvCount_xZ ,recvID_xZ, id);
|
||||
UnpackID(Dm.recvList_XZ, Dm.recvCount_XZ ,recvID_XZ, id);
|
||||
UnpackID(Dm.recvList_yz, Dm.recvCount_yz ,recvID_yz, id);
|
||||
UnpackID(Dm.recvList_Yz, Dm.recvCount_Yz ,recvID_Yz, id);
|
||||
UnpackID(Dm.recvList_yZ, Dm.recvCount_yZ ,recvID_yZ, id);
|
||||
UnpackID(Dm.recvList_YZ, Dm.recvCount_YZ ,recvID_YZ, id);
|
||||
UnpackID(Dm.recvList("x"), Dm.recvCount("x") ,recvID_x, id);
|
||||
UnpackID(Dm.recvList("X"), Dm.recvCount("X") ,recvID_X, id);
|
||||
UnpackID(Dm.recvList("y"), Dm.recvCount("y") ,recvID_y, id);
|
||||
UnpackID(Dm.recvList("Y"), Dm.recvCount("Y") ,recvID_Y, id);
|
||||
UnpackID(Dm.recvList("z"), Dm.recvCount("z") ,recvID_z, id);
|
||||
UnpackID(Dm.recvList("Z"), Dm.recvCount("Z") ,recvID_Z, id);
|
||||
UnpackID(Dm.recvList("xy"), Dm.recvCount("xy") ,recvID_xy, id);
|
||||
UnpackID(Dm.recvList("Xy"), Dm.recvCount("Xy") ,recvID_Xy, id);
|
||||
UnpackID(Dm.recvList("xY"), Dm.recvCount("xY") ,recvID_xY, id);
|
||||
UnpackID(Dm.recvList("XY"), Dm.recvCount("XY") ,recvID_XY, id);
|
||||
UnpackID(Dm.recvList("xz"), Dm.recvCount("xz") ,recvID_xz, id);
|
||||
UnpackID(Dm.recvList("Xz"), Dm.recvCount("Xz") ,recvID_Xz, id);
|
||||
UnpackID(Dm.recvList("xZ"), Dm.recvCount("xZ") ,recvID_xZ, id);
|
||||
UnpackID(Dm.recvList("XZ"), Dm.recvCount("XZ") ,recvID_XZ, id);
|
||||
UnpackID(Dm.recvList("yz"), Dm.recvCount("yz") ,recvID_yz, id);
|
||||
UnpackID(Dm.recvList("Yz"), Dm.recvCount("Yz") ,recvID_Yz, id);
|
||||
UnpackID(Dm.recvList("yZ"), Dm.recvCount("yZ") ,recvID_yZ, id);
|
||||
UnpackID(Dm.recvList("YZ"), Dm.recvCount("YZ") ,recvID_YZ, id);
|
||||
//......................................................................................
|
||||
|
||||
//double GlobalNumber = Dm.Comm.sumReduce( LocalNumber );
|
||||
|
||||
Reference in New Issue
Block a user