47 CommGrid(MPI_Comm world,
int nrowproc,
int ncolproc);
51 MPI_Comm_free(&commWorld);
52 MPI_Comm_free(&rowWorld);
53 MPI_Comm_free(&colWorld);
54 if(diagWorld != MPI_COMM_NULL) MPI_Comm_free(&diagWorld);
57 myprocrow(rhs.myprocrow), myproccol(rhs.myproccol), myrank(rhs.myrank)
59 MPI_Comm_dup(rhs.commWorld, &commWorld);
60 MPI_Comm_dup(rhs.rowWorld, &rowWorld);
61 MPI_Comm_dup(rhs.colWorld, &colWorld);
65 if(rhs.diagWorld == MPI_COMM_NULL)
66 diagWorld = MPI_COMM_NULL;
68 MPI_Comm_dup(rhs.diagWorld,&diagWorld);
75 MPI_Comm_free(&commWorld);
76 MPI_Comm_free(&rowWorld);
77 MPI_Comm_free(&colWorld);
82 myprocrow = rhs.myprocrow;
83 myproccol = rhs.myproccol;
85 MPI_Comm_dup(rhs.commWorld, &commWorld);
86 MPI_Comm_dup(rhs.rowWorld, &rowWorld);
87 MPI_Comm_dup(rhs.colWorld, &colWorld);
89 if(rhs.diagWorld == MPI_COMM_NULL) diagWorld = MPI_COMM_NULL;
90 else MPI_Comm_dup(rhs.diagWorld,&diagWorld);
99 return (! (*
this == rhs));
104 int GetRank(
int rowrank,
int colrank) {
return rowrank * grcols + colrank; }
105 int GetRank(
int diagrank) {
return diagrank * grcols + diagrank; }
112 MPI_Comm_rank(diagWorld, &rank);
124 return ((grcols * myproccol) + myprocrow);
142 MPI_Comm_size(diagWorld, &size);
146 void OpenDebugFile(std::string prefix, std::ofstream & output)
const;
151 MPI_Comm commWorld, rowWorld, colWorld, diagWorld;
159 template <
class IT,
class NT,
class DER>
162 template <
class IT,
class NT>
int GetRank(int diagrank)
void OpenDebugFile(std::string prefix, std::ofstream &output) const
MPI_Comm GetRowWorld() const
MPI_Comm & GetDiagWorld()
CommGrid(MPI_Comm world, int nrowproc, int ncolproc)
friend std::shared_ptr< CommGrid > ProductGrid(CommGrid *gridA, CommGrid *gridB, int &innerdim, int &Aoffset, int &Boffset)
bool operator!=(const CommGrid &rhs) const
MPI_Comm GetColWorld() const
bool OnSameProcCol(int rhsrank)
MPI_Comm GetDiagWorld() const
CommGrid(const CommGrid &rhs)
bool OnSameProcRow(int rhsrank)
CommGrid & operator=(const CommGrid &rhs)
bool operator==(const CommGrid &rhs) const
int GetRank(int rowrank, int colrank)
MPI_Comm GetWorld() const