Zoltan2
Zoltan2_MachineRepresentation.hpp
Go to the documentation of this file.
1 #ifndef _ZOLTAN2_MACHINEREPRESENTATION_HPP_
2 #define _ZOLTAN2_MACHINEREPRESENTATION_HPP_
3 
4 #include <Teuchos_Comm.hpp>
8 #include <Teuchos_StandardParameterEntryValidators.hpp>
9 
10 #include <Teuchos_ParameterList.hpp>
11 #include <Zoltan2_MachineRCA.hpp>
13 #include <Zoltan2_Environment.hpp>
14 
15 //#define HAVE_ZOLTAN2_BGQTEST
16 namespace Zoltan2{
17 
21 template <typename pcoord_t, typename part_t>
23 
24 public:
25  typedef pcoord_t machine_pcoord_t;
27 #if defined(HAVE_ZOLTAN2_LDMS)
28  typedef MachineLDMS<pcoord_t,part_t> machine_t;
29 #elif defined(HAVE_ZOLTAN2_RCALIB)
31 #elif defined(HAVE_ZOLTAN2_TOPOMANAGER)
33 #elif defined(HAVE_ZOLTAN2_BGQTEST)
35 #else
37  //typedef MachineBGQTest<pcoord_t,part_t> machine_t;
38  //typedef MachineRCATest<pcoord_t,part_t> machine_t;
39 #endif
40 
45  MachineRepresentation(const Teuchos::Comm<int> &comm) :
46  machine(new machine_t(comm)) {
47  }
48 
49 
50 
51  MachineRepresentation(const Teuchos::Comm<int> &comm, const Teuchos::ParameterList &pl) :
52  machine(new machine_t(comm, pl)) { }
53 
54  ~MachineRepresentation() {delete machine;}
55 
56  // Interface functions follow.
57  // They are just wrappers around the specific machine's functions.
58 
61  inline bool hasMachineCoordinates() const {
62  return machine->hasMachineCoordinates();
63  }
64 
67  inline int getMachineDim() const { return machine->getMachineDim(); }
68 
72  inline bool getMachineExtent(int *nxyz) const {
73  return machine->getMachineExtent(nxyz);
74  }
75 
79  bool getMachineExtentWrapArounds(bool *wrap_around) const {
80  return machine->getMachineExtentWrapArounds(wrap_around);
81  }
82 
83 
88  inline bool getMyMachineCoordinate(pcoord_t *xyz) const {
89  return machine->getMyMachineCoordinate(xyz);
90  }
91 
96  inline bool getMachineCoordinate(const int rank,
97  pcoord_t *xyz) const {
98  return machine->getMachineCoordinate(rank, xyz);
99  }
100 
105  inline bool getMachineCoordinate(const char *nodename,
106  pcoord_t *xyz) const {
107  return machine->getMachineCoordinate(nodename, xyz);
108  }
109 
116  inline bool getAllMachineCoordinatesView(pcoord_t **&allCoords) const {
117  return machine->getAllMachineCoordinatesView(allCoords);
118  }
119 
122  inline int getNumRanks() const { return machine->getNumRanks(); }
123 
124 
125  inline bool getHopCount(int rank1, int rank2, pcoord_t &hops) const {
126  return machine->getHopCount(rank1, rank2, hops);
127  }
128 
131  static void getValidParameters(Teuchos::ParameterList & pl)
132  {
133  //TODO: This should be positive integer validator.
134  pl.set("Machine_Optimization_Level", 10,
135  "Machine Coordinate Transformation Method",
137 
138  // validator for file does not have to exist
139  RCP<Teuchos::FileNameValidator> file_not_required_validator =
140  Teuchos::rcp( new Teuchos::FileNameValidator(false) );
141 
142  // bool parameter
143  pl.set("Input_RCA_Machine_Coords", "", "Input File for input machine coordinates",
144  file_not_required_validator);
145  }
146 
147 
148  // KDD TODO: Add Graph interface and methods supporting full LDMS interface.
149 
150 private:
151  machine_t *machine;
152 };
153 }
154 #endif
Zoltan2::MachineRepresentation::getMachineExtent
bool getMachineExtent(int *nxyz) const
sets the number of unique coordinates in each machine dimension return true if coordinates are availa...
Definition: Zoltan2_MachineRepresentation.hpp:72
Zoltan2::MachineForTesting::hasMachineCoordinates
bool hasMachineCoordinates() const
Definition: Zoltan2_MachineForTesting.hpp:76
Zoltan2::MachineRepresentation::machine_t
MachineForTesting< pcoord_t, part_t > machine_t
Definition: Zoltan2_MachineRepresentation.hpp:36
Zoltan2::MachineRCA
A Machine Class for testing only A more realistic machine should be used for task mapping.
Definition: Zoltan2_MachineRCA.hpp:22
Zoltan2::MachineForTesting::getMyMachineCoordinate
bool getMyMachineCoordinate(pcoord_t *xyz)
Definition: Zoltan2_MachineForTesting.hpp:88
Zoltan2::MachineRepresentation::getHopCount
bool getHopCount(int rank1, int rank2, pcoord_t &hops) const
Definition: Zoltan2_MachineRepresentation.hpp:125
Zoltan2_MachineRCA.hpp
Zoltan2::MachineForTesting::getMachineDim
int getMachineDim() const
Definition: Zoltan2_MachineForTesting.hpp:78
Zoltan2_MachineTopoMgr.hpp
Zoltan2::Machine::getNumRanks
int getNumRanks() const
return the number of ranks.
Definition: Zoltan2_Machine.hpp:91
Zoltan2::MachineRepresentation::getNumRanks
int getNumRanks() const
return the number of ranks.
Definition: Zoltan2_MachineRepresentation.hpp:122
Zoltan2::MachineRepresentation::~MachineRepresentation
~MachineRepresentation()
Definition: Zoltan2_MachineRepresentation.hpp:54
Zoltan2::MachineRepresentation::getMachineExtentWrapArounds
bool getMachineExtentWrapArounds(bool *wrap_around) const
if the machine has a wrap-around tourus link in each dimension. return true if the information is ava...
Definition: Zoltan2_MachineRepresentation.hpp:79
part_t
SparseMatrixAdapter_t::part_t part_t
Definition: partitioningTree.cpp:74
Zoltan2::MachineRepresentation::machine_part_t
part_t machine_part_t
Definition: Zoltan2_MachineRepresentation.hpp:26
Zoltan2_MachineRCAForTest.hpp
Zoltan2_MachineForTesting.hpp
Zoltan2::MachineRepresentation::getMachineCoordinate
bool getMachineCoordinate(const char *nodename, pcoord_t *xyz) const
getCoordinate function set the machine coordinate xyz of any node by nodename return true if coordina...
Definition: Zoltan2_MachineRepresentation.hpp:105
Zoltan2::Machine::getMachineExtentWrapArounds
bool getMachineExtentWrapArounds(bool *wrap_around) const
if the machine has a wrap-around tourus link in each dimension. return true if the information is ava...
Definition: Zoltan2_Machine.hpp:51
Zoltan2::MachineRepresentation
MachineRepresentation Class Base class for representing machine coordinates, networks,...
Definition: Zoltan2_MachineRepresentation.hpp:22
Zoltan2::Environment::getAnyIntValidator
static RCP< Teuchos::AnyNumberParameterEntryValidator > getAnyIntValidator()
Exists to make setting up validators less cluttered.
Definition: Zoltan2_Environment.cpp:169
Zoltan2::MachineRepresentation::getMachineDim
int getMachineDim() const
returns the dimension (number of coords per node) in the machine
Definition: Zoltan2_MachineRepresentation.hpp:67
Zoltan2::MachineForTesting::getMachineCoordinate
bool getMachineCoordinate(const int rank, pcoord_t *xyz)
Definition: Zoltan2_MachineForTesting.hpp:92
Zoltan2::MachineRepresentation::hasMachineCoordinates
bool hasMachineCoordinates() const
indicates whether or not the machine has coordinates
Definition: Zoltan2_MachineRepresentation.hpp:61
Zoltan2::MachineRepresentation::getValidParameters
static void getValidParameters(Teuchos::ParameterList &pl)
Set up validators specific to this Problem.
Definition: Zoltan2_MachineRepresentation.hpp:131
Zoltan2::MachineRepresentation::getMachineCoordinate
bool getMachineCoordinate(const int rank, pcoord_t *xyz) const
getCoordinate function set the machine coordinate xyz of any rank process return true if coordinates ...
Definition: Zoltan2_MachineRepresentation.hpp:96
Zoltan2_MachineTopoMgrForTest.hpp
Zoltan2::Machine::getHopCount
virtual bool getHopCount(int rank1, int rank2, pcoord_t &hops)
Definition: Zoltan2_Machine.hpp:93
Zoltan2::MachineRepresentation::getMyMachineCoordinate
bool getMyMachineCoordinate(pcoord_t *xyz) const
getMyCoordinate function set the machine coordinate xyz of the current process return true if current...
Definition: Zoltan2_MachineRepresentation.hpp:88
Zoltan2::MachineForTesting::getMachineExtent
bool getMachineExtent(int *nxyz) const
Definition: Zoltan2_MachineForTesting.hpp:80
Zoltan2::MachineForTesting::getAllMachineCoordinatesView
bool getAllMachineCoordinatesView(pcoord_t **&allCoords) const
Definition: Zoltan2_MachineForTesting.hpp:112
Zoltan2::MachineRepresentation::getAllMachineCoordinatesView
bool getAllMachineCoordinatesView(pcoord_t **&allCoords) const
getProcDim function set the coordinates of all ranks allCoords[i][j], i=0,...,getMachineDim(),...
Definition: Zoltan2_MachineRepresentation.hpp:116
Zoltan2::MachineForTesting
A Machine Class for testing only A more realistic machine should be used for task mapping.
Definition: Zoltan2_MachineForTesting.hpp:15
Zoltan2::MachineRepresentation::MachineRepresentation
MachineRepresentation(const Teuchos::Comm< int > &comm)
Constructor MachineRepresentation Class.
Definition: Zoltan2_MachineRepresentation.hpp:45
Zoltan2::MachineBGQTest
A Machine Class for testing only A more realistic machine should be used for task mapping.
Definition: Zoltan2_MachineTopoMgrForTest.hpp:16
Zoltan2
Definition: Zoltan2_AlgSerialGreedy.hpp:56
Zoltan2_Environment.hpp
Defines the Environment class.
Zoltan2::MachineRepresentation::machine_pcoord_t
pcoord_t machine_pcoord_t
Definition: Zoltan2_MachineRepresentation.hpp:25
Zoltan2::MachineRepresentation::MachineRepresentation
MachineRepresentation(const Teuchos::Comm< int > &comm, const Teuchos::ParameterList &pl)
Definition: Zoltan2_MachineRepresentation.hpp:51
Zoltan2::MachineTopoMgr
A Machine Class for testing only A more realistic machine should be used for task mapping.
Definition: Zoltan2_MachineTopoMgr.hpp:19