Zoltan2
Loading...
Searching...
No Matches
Zoltan2_MachineRepresentation.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Zoltan2: A package of combinatorial algorithms for scientific computing
4//
5// Copyright 2012 NTESS and the Zoltan2 contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef _ZOLTAN2_MACHINEREPRESENTATION_HPP_
11#define _ZOLTAN2_MACHINEREPRESENTATION_HPP_
12
13#include <Teuchos_Comm.hpp>
14#include <Teuchos_StandardParameterEntryValidators.hpp>
15#include <Teuchos_ParameterList.hpp>
16
18//#include <Zoltan2_MachineTorusLDMS.hpp>
26
27//#define HAVE_ZOLTAN2_BGQTEST
28namespace Zoltan2{
29
33template <typename pcoord_t, typename part_t>
35
36public:
37 typedef pcoord_t machine_pcoord_t;
39/*
40#if defined(HAVE_ZOLTAN2_LDMS)
41 #if defined(ZOLTAN2_MACHINE_TORUS)
42 // TODO: Full LDMS Implementation
43 typedef MachineTorusLDMS<pcoord_t, part_t> machine_t;
44 #else
45 typedef MachineForTesting<pcoord_t, part_t> machine_t;
46 #endif
47*/
48#if defined(HAVE_ZOLTAN2_RCALIB)
49 #if defined(ZOLTAN2_MACHINE_TORUS)
51 #elif defined(ZOLTAN2_MACHINE_DRAGONFLY)
53 #else
55 #endif
56
57#elif defined(HAVE_ZOLTAN2_TOPOMANAGER)
58 #if defined(ZOLTAN2_MACHINE_TORUS)
60 #else
62 #endif
63
64#elif defined(HAVE_ZOLTAN2_BGQTEST)
65 #if defined(ZOLTAN2_MACHINE_TORUS)
67 #else
69 #endif
70
71#else
72 #if defined(ZOLTAN2_MACHINE_TORUS)
74 #elif defined(ZOLTAN2_MACHINE_DRAGONFLY)
76 #else
78// typedef MachineTorusRCAForTesting<pcoord_t, part_t> machine_t;
79// typedef MachineDragonflyRCAForTesting<pcoord_t, part_t> machine_t;
80 #endif
81#endif
82
86 MachineRepresentation(const Teuchos::Comm<int> &comm) :
87 machine(new machine_t(comm)) {
88 }
89
90 MachineRepresentation(const Teuchos::Comm<int> &comm,
91 const Teuchos::ParameterList &pl) :
92 machine(new machine_t(comm, pl)) {
93 }
94
95 ~MachineRepresentation() { delete machine; }
96
97 // Interface functions follow.
98 // They are just wrappers around the specific machine's functions.
99
102 inline bool hasMachineCoordinates() const {
103 return machine->hasMachineCoordinates();
104 }
105
109 inline int getMachineDim() const { return machine->getMachineDim(); }
110
116 inline bool getMachineExtent(int *nxyz) const {
117 return machine->getMachineExtent(nxyz);
118 }
119
125 bool getMachineExtentWrapArounds(bool *wrap_around) const {
126 return machine->getMachineExtentWrapArounds(wrap_around);
127 }
128
133 inline bool getMyMachineCoordinate(pcoord_t *xyz) const {
134 return machine->getMyMachineCoordinate(xyz);
135 }
136
141 inline bool getMachineCoordinate(const int rank,
142 pcoord_t *xyz) const {
143 return machine->getMachineCoordinate(rank, xyz);
144 }
145
150 inline bool getMachineCoordinate(const char *nodename,
151 pcoord_t *xyz) const {
152 return machine->getMachineCoordinate(nodename, xyz);
153 }
154
161 inline bool getAllMachineCoordinatesView(pcoord_t **&allCoords) const {
162 return machine->getAllMachineCoordinatesView(allCoords);
163 }
164
167 inline int getNumRanks() const { return machine->getNumRanks(); }
168
171 inline bool getHopCount(int rank1, int rank2, pcoord_t &hops) const {
172 return machine->getHopCount(rank1, rank2, hops);
173 }
174
182 inline part_t getNumUniqueGroups() const {
183 return machine->getNumUniqueGroups();
184 }
185
200 inline bool getGroupCount(part_t *grp_count) const {
201 return machine->getGroupCount(grp_count);
202 }
203
206 static void getValidParameters(Teuchos::ParameterList &pl)
207 {
208 //TODO: This should be positive integer validator.
209 pl.set("Machine_Optimization_Level", 10,
210 "Machine Coordinate Transformation Method",
212
213 // validator for file does not have to exist
214 RCP<Teuchos::FileNameValidator> file_not_required_validator =
215 Teuchos::rcp( new Teuchos::FileNameValidator(false) );
216
217 // bool parameter
218 pl.set("Input_RCA_Machine_Coords", "",
219 "Input File for input machine coordinates",
220 file_not_required_validator);
221 }
222
223 // KDD TODO: Add Graph interface and methods supporting full LDMS
224 // interface.
225
226private:
227 machine_t *machine;
228};
229
230} // namespace Zoltan2
231
232#endif
Defines the Environment class.
static RCP< Teuchos::AnyNumberParameterEntryValidator > getAnyIntValidator()
Exists to make setting up validators less cluttered.
A Dragonfly (e.g. Cori, Trinity, Theta) Machine Class for testing only. A more realistic machine shou...
A Dragonfly (e.g. Cori, Trinity, & Theta) Machine Class for task mapping.
A Machine Class for testing only A more realistic machine should be used for task mapping.
MachineRepresentation Class Base class for representing machine coordinates, networks,...
bool getAllMachineCoordinatesView(pcoord_t **&allCoords) const
getProcDim function set the coordinates of all ranks allCoords[i][j], i=0,...,getMachineDim(),...
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...
bool hasMachineCoordinates() const
indicates whether or not the machine has coordinates
int getMachineDim() const
returns the dimension (number of coords per node) in the machine
MachineRepresentation(const Teuchos::Comm< int > &comm)
Constructor MachineRepresentation Class.
part_t getNumUniqueGroups() const
getNumUniqueGroups function return the number of unique Dragonfly network groups in provided allocati...
bool getGroupCount(part_t *grp_count) const
return the number of ranks in each group (RCA X-dim, e.g. first dim)
MachineRepresentation(const Teuchos::Comm< int > &comm, const Teuchos::ParameterList &pl)
bool getMachineExtent(int *nxyz) const
sets the number of unique coordinates in each machine dimension
bool getMachineExtentWrapArounds(bool *wrap_around) const
if the machine has a wrap-around tourus link in each dimension.
MachineForTesting< pcoord_t, part_t > machine_t
bool getHopCount(int rank1, int rank2, pcoord_t &hops) const
return the hop count between rank1 and rank2
static void getValidParameters(Teuchos::ParameterList &pl)
Set up validators specific to this Problem.
int getNumRanks() const
return the number of ranks.
bool getMyMachineCoordinate(pcoord_t *xyz) const
getMyCoordinate function set the machine coordinate xyz of the current process return true if current...
bool getMachineCoordinate(const int rank, pcoord_t *xyz) const
getCoordinate function set the machine coordinate xyz of any rank process return true if coordinates ...
A TopoManager Machine Class (Torus Networks) for testing only A more realistic machine should be used...
An RCA Machine Class (Torus Networks) for testing only A more realistic machine should be used for ta...
An RCA Machine class on Torus Networks.
A TopoManager Machine Class on Torus Networks.
Created by mbenlioglu on Aug 31, 2020.
SparseMatrixAdapter_t::part_t part_t