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>
5 #include <Teuchos_StandardParameterEntryValidators.hpp>
6 #include <Teuchos_ParameterList.hpp>
7 
9 //#include <Zoltan2_MachineTorusLDMS.hpp>
16 #include <Zoltan2_Environment.hpp>
17 
18 //#define HAVE_ZOLTAN2_BGQTEST
19 namespace Zoltan2{
20 
24 template <typename pcoord_t, typename part_t>
26 
27 public:
28  typedef pcoord_t machine_pcoord_t;
30 /*
31 #if defined(HAVE_ZOLTAN2_LDMS)
32  #if defined(ZOLTAN2_MACHINE_TORUS)
33  // TODO: Full LDMS Implementation
34  typedef MachineTorusLDMS<pcoord_t, part_t> machine_t;
35  #else
36  typedef MachineForTesting<pcoord_t, part_t> machine_t;
37  #endif
38 */
39 #if defined(HAVE_ZOLTAN2_RCALIB)
40  #if defined(ZOLTAN2_MACHINE_TORUS)
42  #elif defined(ZOLTAN2_MACHINE_DRAGONFLY)
44  #else
46  #endif
47 
48 #elif defined(HAVE_ZOLTAN2_TOPOMANAGER)
49  #if defined(ZOLTAN2_MACHINE_TORUS)
51  #else
53  #endif
54 
55 #elif defined(HAVE_ZOLTAN2_BGQTEST)
56  #if defined(ZOLTAN2_MACHINE_TORUS)
58  #else
60  #endif
61 
62 #else
63  #if defined(ZOLTAN2_MACHINE_TORUS)
65  #elif defined(ZOLTAN2_MACHINE_DRAGONFLY)
67  #else
69 // typedef MachineTorusRCAForTesting<pcoord_t, part_t> machine_t;
70 // typedef MachineDragonflyRCAForTesting<pcoord_t, part_t> machine_t;
71  #endif
72 #endif
73 
77  MachineRepresentation(const Teuchos::Comm<int> &comm) :
78  machine(new machine_t(comm)) {
79  }
80 
81  MachineRepresentation(const Teuchos::Comm<int> &comm,
82  const Teuchos::ParameterList &pl) :
83  machine(new machine_t(comm, pl)) {
84  }
85 
86  ~MachineRepresentation() { delete machine; }
87 
88  // Interface functions follow.
89  // They are just wrappers around the specific machine's functions.
90 
93  inline bool hasMachineCoordinates() const {
94  return machine->hasMachineCoordinates();
95  }
96 
100  inline int getMachineDim() const { return machine->getMachineDim(); }
101 
107  inline bool getMachineExtent(int *nxyz) const {
108  return machine->getMachineExtent(nxyz);
109  }
110 
116  bool getMachineExtentWrapArounds(bool *wrap_around) const {
117  return machine->getMachineExtentWrapArounds(wrap_around);
118  }
119 
124  inline bool getMyMachineCoordinate(pcoord_t *xyz) const {
125  return machine->getMyMachineCoordinate(xyz);
126  }
127 
132  inline bool getMachineCoordinate(const int rank,
133  pcoord_t *xyz) const {
134  return machine->getMachineCoordinate(rank, xyz);
135  }
136 
141  inline bool getMachineCoordinate(const char *nodename,
142  pcoord_t *xyz) const {
143  return machine->getMachineCoordinate(nodename, xyz);
144  }
145 
152  inline bool getAllMachineCoordinatesView(pcoord_t **&allCoords) const {
153  return machine->getAllMachineCoordinatesView(allCoords);
154  }
155 
158  inline int getNumRanks() const { return machine->getNumRanks(); }
159 
162  inline bool getHopCount(int rank1, int rank2, pcoord_t &hops) const {
163  return machine->getHopCount(rank1, rank2, hops);
164  }
165 
173  inline part_t getNumUniqueGroups() const {
174  return machine->getNumUniqueGroups();
175  }
176 
191  inline bool getGroupCount(part_t *grp_count) const {
192  return machine->getGroupCount(grp_count);
193  }
194 
197  static void getValidParameters(Teuchos::ParameterList &pl)
198  {
199  //TODO: This should be positive integer validator.
200  pl.set("Machine_Optimization_Level", 10,
201  "Machine Coordinate Transformation Method",
203 
204  // validator for file does not have to exist
205  RCP<Teuchos::FileNameValidator> file_not_required_validator =
206  Teuchos::rcp( new Teuchos::FileNameValidator(false) );
207 
208  // bool parameter
209  pl.set("Input_RCA_Machine_Coords", "",
210  "Input File for input machine coordinates",
211  file_not_required_validator);
212  }
213 
214  // KDD TODO: Add Graph interface and methods supporting full LDMS
215  // interface.
216 
217 private:
218  machine_t *machine;
219 };
220 
221 } // namespace Zoltan2
222 
223 #endif
Zoltan2::MachineRepresentation::getMachineExtent
bool getMachineExtent(int *nxyz) const
sets the number of unique coordinates in each machine dimension
Definition: Zoltan2_MachineRepresentation.hpp:107
Zoltan2_MachineTorusTopoMgr.hpp
Zoltan2::MachineRepresentation::machine_t
MachineForTesting< pcoord_t, part_t > machine_t
Definition: Zoltan2_MachineRepresentation.hpp:68
Zoltan2::MachineForTesting::hasMachineCoordinates
bool hasMachineCoordinates() const
Definition: Zoltan2_MachineForTesting.hpp:76
Zoltan2::Machine::getGroupCount
virtual bool getGroupCount(part_t *grp_count) const
getGroupCount function return the number of ranks in each group (RCA X-dim, e.g. first dim)
Definition: Zoltan2_Machine.hpp:128
Zoltan2::MachineForTesting::getMyMachineCoordinate
bool getMyMachineCoordinate(pcoord_t *xyz)
Definition: Zoltan2_MachineForTesting.hpp:88
Zoltan2::MachineTorusRCA
An RCA Machine class on Torus Networks.
Definition: Zoltan2_MachineTorusRCA.hpp:21
Zoltan2::MachineRepresentation::getHopCount
bool getHopCount(int rank1, int rank2, pcoord_t &hops) const
return the hop count between rank1 and rank2
Definition: Zoltan2_MachineRepresentation.hpp:162
Zoltan2_MachineDragonflyRCA.hpp
Zoltan2::MachineForTesting::getMachineDim
int getMachineDim() const
Definition: Zoltan2_MachineForTesting.hpp:78
Zoltan2::MachineDragonflyRCA
A Dragonfly (e.g. Cori, Trinity, & Theta) Machine Class for task mapping.
Definition: Zoltan2_MachineDragonflyRCA.hpp:73
Zoltan2::Machine::getNumRanks
int getNumRanks() const
getNumRanks function return the number of ranks.
Definition: Zoltan2_Machine.hpp:92
Zoltan2::MachineTorusBGQTest
A TopoManager Machine Class (Torus Networks) for testing only A more realistic machine should be used...
Definition: Zoltan2_MachineTorusTopoMgrForTesting.hpp:16
Zoltan2::MachineRepresentation::getNumRanks
int getNumRanks() const
return the number of ranks.
Definition: Zoltan2_MachineRepresentation.hpp:158
Zoltan2::MachineRepresentation::~MachineRepresentation
~MachineRepresentation()
Definition: Zoltan2_MachineRepresentation.hpp:86
Zoltan2::MachineRepresentation::getMachineExtentWrapArounds
bool getMachineExtentWrapArounds(bool *wrap_around) const
if the machine has a wrap-around tourus link in each dimension.
Definition: Zoltan2_MachineRepresentation.hpp:116
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:29
Zoltan2_MachineDragonflyRCAForTesting.hpp
Zoltan2::MachineTorusRCAForTesting
An RCA Machine Class (Torus Networks) for testing only A more realistic machine should be used for ta...
Definition: Zoltan2_MachineTorusRCAForTesting.hpp:19
Zoltan2_MachineTorusTopoMgrForTesting.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:141
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:25
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:100
Zoltan2::MachineRepresentation::getNumUniqueGroups
part_t getNumUniqueGroups() const
getNumUniqueGroups function return the number of unique Dragonfly network groups in provided allocati...
Definition: Zoltan2_MachineRepresentation.hpp:173
Zoltan2_MachineTorusRCAForTesting.hpp
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:93
Zoltan2::MachineDragonflyRCAForTesting
A Dragonfly (e.g. Cori, Trinity, Theta) Machine Class for testing only. A more realistic machine shou...
Definition: Zoltan2_MachineDragonflyRCAForTesting.hpp:22
Zoltan2::MachineRepresentation::getValidParameters
static void getValidParameters(Teuchos::ParameterList &pl)
Set up validators specific to this Problem.
Definition: Zoltan2_MachineRepresentation.hpp:197
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:132
Zoltan2::Machine::getHopCount
virtual bool getHopCount(int rank1, int rank2, pcoord_t &hops)
getHopCount function set hops between rank1 and rank2 return true if coordinates are available
Definition: Zoltan2_Machine.hpp:98
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:124
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:152
Zoltan2::MachineRepresentation::getGroupCount
bool getGroupCount(part_t *grp_count) const
return the number of ranks in each group (RCA X-dim, e.g. first dim)
Definition: Zoltan2_MachineRepresentation.hpp:191
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:77
Zoltan2::Machine::getNumUniqueGroups
virtual part_t getNumUniqueGroups() const
getNumUniqueGroups function return the number of unique Dragonfly network groups in provided allocati...
Definition: Zoltan2_Machine.hpp:109
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:28
Zoltan2::MachineTorusTopoMgr
A TopoManager Machine Class on Torus Networks.
Definition: Zoltan2_MachineTorusTopoMgr.hpp:18
Zoltan2::MachineRepresentation::MachineRepresentation
MachineRepresentation(const Teuchos::Comm< int > &comm, const Teuchos::ParameterList &pl)
Definition: Zoltan2_MachineRepresentation.hpp:81
Zoltan2_MachineTorusRCA.hpp