1 #ifndef _ZOLTAN2_MACHINEREPRESENTATION_HPP_ 2 #define _ZOLTAN2_MACHINEREPRESENTATION_HPP_ 4 #include <Teuchos_Comm.hpp> 5 #include <Teuchos_CommHelpers.hpp> 12 template <
typename pcoord_t>
20 RCP<const Comm<int> >
comm;
26 networkDim(0), numProcs(comm_->getSize()), procCoords(0), comm(
Teuchos::rcp_const_cast<const Comm<int> >(comm_)){
51 procCoords[i] =
new pcoord_t [
numProcs];
52 memset (procCoords[i], 0,
sizeof(pcoord_t) * numProcs);
67 networkDim(0), numProcs(comm_->getSize()), procCoords(0), comm(comm_){
92 procCoords[i] =
new pcoord_t [
numProcs];
93 memset (procCoords[i], 0,
sizeof(pcoord_t) * numProcs);
116 int myRank = comm->getRank();
118 int slice = int (pow(
double(numProcs),
double(1.0 / networkDim)) + 0.5 );
122 procCoords[i][myRank] = m / int(pow(slice,
double(networkDim - i - 1)));
123 m = m % int(pow(
double(slice),
double(networkDim - i - 1)));
131 pcoord_t *tmpVect =
new pcoord_t [
numProcs];
134 reduceAll<int, pcoord_t>(
140 pcoord_t *tmp = tmpVect;
141 tmpVect = procCoords[i];
152 delete [] procCoords[i];
MachineRepresentation(RCP< const Comm< int > > comm_)
Constructor MachineRepresentation Class.
pcoord_t ** getProcCoords() const
getProcDim function returns the coordinates of processors in two dimensional array.
RCP< const Comm< int > > comm
void gatherMachineCoordinates()
gatherMachineCoordinates function reduces and stores all machine coordinates.
MachineRepresentation Class Finds the coordinate of the processor. Used to find the processor coordin...
~MachineRepresentation()
destructor of the class free memory in procCoords.
int getProcDim() const
getProcDim function returns the dimension of the physical processor layout.
int getNumProcs() const
getNumProcs function returns the number of processors.
void getMyCoordinate()
getMyCoordinate function stores the coordinate of the current processor in procCoords[*][rank] ...
MachineRepresentation(RCP< Comm< int > > comm_)
Constructor MachineRepresentation Class.