1#ifndef _ZOLTAN2_MACHINEFORTESTING_HPP_
2#define _ZOLTAN2_MACHINEFORTESTING_HPP_
4#include <Teuchos_Comm.hpp>
5#include <Teuchos_CommHelpers.hpp>
14template <
typename pcoord_t,
typename part_t>
29 procCoords =
new pcoord_t *[networkDim];
30 for (
int i = 0; i < networkDim; ++i){
31 procCoords[i] =
new pcoord_t[this->
numRanks];
32 memset(procCoords[i], 0,
sizeof(pcoord_t) * this->
numRanks);
36 pcoord_t *xyz =
new pcoord_t[networkDim];
38 for (
int i = 0; i < networkDim; i++)
39 procCoords[i][this->
myRank] = xyz[i];
43 gatherMachineCoordinates(comm);
52 procCoords =
new pcoord_t *[networkDim];
53 for (
int i = 0; i < networkDim; ++i){
54 procCoords[i] =
new pcoord_t[this->
numRanks];
55 memset(procCoords[i], 0,
sizeof(pcoord_t) * this->
numRanks);
59 pcoord_t *xyz =
new pcoord_t[networkDim];
61 for (
int i = 0; i < networkDim; i++)
62 procCoords[i][this->
myRank] = xyz[i];
66 gatherMachineCoordinates(comm);
70 for (
int i = 0; i < networkDim; i++){
71 delete [] procCoords[i];
113 allCoords = procCoords;
121 pcoord_t **procCoords;
123 void gatherMachineCoordinates(
const Teuchos::Comm<int> &comm) {
125 pcoord_t *tmpVect =
new pcoord_t [this->
numRanks];
127 for (
int i = 0; i < networkDim; i++) {
128 Teuchos::reduceAll<int, pcoord_t>(comm, Teuchos::REDUCE_SUM,
129 this->
numRanks, procCoords[i], tmpVect);
130 pcoord_t *tmp = tmpVect;
131 tmpVect = procCoords[i];
A Machine Class for testing only A more realistic machine should be used for task mapping.
bool getAllMachineCoordinatesView(pcoord_t **&allCoords) const
bool hasMachineCoordinates() const
virtual ~MachineForTesting()
bool getMyMachineCoordinate(pcoord_t *xyz)
bool getMachineCoordinate(const int rank, pcoord_t *xyz)
bool getMachineCoordinate(const char *nodename, pcoord_t *xyz)
MachineForTesting(const Teuchos::Comm< int > &comm, const Teuchos::ParameterList &pl)
bool getMachineExtent(int *nxyz) const
int getMachineDim() const
MachineForTesting(const Teuchos::Comm< int > &comm)
Constructor: A default machine description used only for testing; it does not contain actual machine ...
MachineClass Base class for representing machine coordinates, networks, etc.
Created by mbenlioglu on Aug 31, 2020.
SparseMatrixAdapter_t::part_t part_t