10 #ifndef _ZOLTAN2_MACHINEFORTESTING_HPP_
11 #define _ZOLTAN2_MACHINEFORTESTING_HPP_
13 #include <Teuchos_Comm.hpp>
14 #include <Teuchos_CommHelpers.hpp>
23 template <
typename pcoord_t,
typename part_t>
38 procCoords =
new pcoord_t *[networkDim];
39 for (
int i = 0; i < networkDim; ++i){
40 procCoords[i] =
new pcoord_t[this->
numRanks];
41 memset(procCoords[i], 0,
sizeof(pcoord_t) * this->
numRanks);
45 pcoord_t *xyz =
new pcoord_t[networkDim];
47 for (
int i = 0; i < networkDim; i++)
48 procCoords[i][this->
myRank] = xyz[i];
52 gatherMachineCoordinates(comm);
61 procCoords =
new pcoord_t *[networkDim];
62 for (
int i = 0; i < networkDim; ++i){
63 procCoords[i] =
new pcoord_t[this->
numRanks];
64 memset(procCoords[i], 0,
sizeof(pcoord_t) * this->
numRanks);
68 pcoord_t *xyz =
new pcoord_t[networkDim];
70 for (
int i = 0; i < networkDim; i++)
71 procCoords[i][this->
myRank] = xyz[i];
75 gatherMachineCoordinates(comm);
79 for (
int i = 0; i < networkDim; i++){
80 delete [] procCoords[i];
122 allCoords = procCoords;
130 pcoord_t **procCoords;
132 void gatherMachineCoordinates(
const Teuchos::Comm<int> &comm) {
134 pcoord_t *tmpVect =
new pcoord_t [this->
numRanks];
136 for (
int i = 0; i < networkDim; i++) {
137 Teuchos::reduceAll<int, pcoord_t>(comm, Teuchos::REDUCE_SUM,
138 this->
numRanks, procCoords[i], tmpVect);
139 pcoord_t *tmp = tmpVect;
140 tmpVect = procCoords[i];
bool hasMachineCoordinates() const
A Machine Class for testing only A more realistic machine should be used for task mapping...
bool getMachineCoordinate(const char *nodename, pcoord_t *xyz)
MachineClass Base class for representing machine coordinates, networks, etc.
MachineForTesting(const Teuchos::Comm< int > &comm)
Constructor: A default machine description used only for testing; it does not contain actual machine ...
SparseMatrixAdapter_t::part_t part_t
int getMachineDim() const
bool getAllMachineCoordinatesView(pcoord_t **&allCoords) const
virtual ~MachineForTesting()
bool getMachineCoordinate(const int rank, pcoord_t *xyz)
bool getMachineExtent(int *nxyz) const
bool getMyMachineCoordinate(pcoord_t *xyz)
MachineForTesting(const Teuchos::Comm< int > &comm, const Teuchos::ParameterList &pl)