15#include <Teuchos_DefaultComm.hpp>
17template <
typename nCoord_t,
typename part_t>
26 const int failval = 100000000;
28 int np = comm.getSize();
29 int me = comm.getRank();
32 int *nxyz =
new int[dim];
34 nCoord_t *xyz =
new nCoord_t[dim];
43 for (
int i = 0; i < np; i++) {
45 if (me == 0) std::cout <<
"RANK " << i <<
" COORD ";
46 for (
int d = 0; d < dim; d++) {
47 if (me == 0) std::cout <<
" " << xyz[d];
48 if (xyz[d] != allCoords[d][i])
fail = failval;
49 if (haveExtent && (xyz[d] < 0 || xyz[d] >= nxyz[d]))
fail = failval;
51 if (me == 0) std::cout << std::endl;
54 std::cout <<
"Rank " << me
55 <<
" getMachineCoordinate failed " << std::endl;
59 if (
fail == failval) {
60 std::cout <<
"Rank " << me
61 <<
" Invalid coordinates from getAllMachineCoordinatesView or "
62 <<
"getMachineCoordinate" << std::endl;
67 for (
int d = 0; d < dim; d++)
68 if (xyz[d] != allCoords[d][me])
fail = failval;
72 std::cout <<
"Rank " << me
73 <<
"getMyMachineCoordinates failed" << std::endl;
78 std::cout <<
"Rank " << me
79 <<
"couldn't retrieve coordinates with "
80 <<
"getAllMachineCoordinatesView" << std::endl;
92 int rank = comm.getRank();
94 std::cerr <<
"Proc " << rank <<
" error: " << code << std::endl;
107 Tpetra::ScopeGuard tscope(&narg, &arg);
108 Teuchos::RCP<const Teuchos::Comm<int> > comm = Tpetra::getDefaultComm();
110 int me = comm->getRank();
111 int np = comm->getSize();
113 char node0[6] = {
'n',
'o',
'd',
'e',
'0',
'\0'};
120 Teuchos::ParameterList pl;
128 fail += checkAllCoords<ncoord_t,part_t>(*comm, mach);
133#if defined(HAVE_ZOLTAN2_LDMS)
135 if (me == 0 ) std::cout <<
"LDMS Topology" << std::endl;
139#elif defined(HAVE_ZOLTAN2_RCALIB)
141 if (me == 0 ) std::cout <<
"RCALIB Topology" << std::endl;
146#elif defined(HAVE_ZOLTAN2_TOPOMANAGER)
148 if (me == 0 ) std::cout <<
"TOPOMANAGER Topology" << std::endl;
153#elif defined(HAVE_ZOLTAN2_BGQTEST)
155 if (me == 0 ) std::cout <<
"BGQTEST Topology" << std::endl;
162 if (me == 0 ) std::cout <<
"TEST Topology" << std::endl;
165 std::cout <<
"Error: Dimension != 3" << std::endl;
171 std::cout <<
"Error: getMachineExtent failed" << std::endl;
174 if (nxyz[0] != np || nxyz[1] != 2*np || nxyz[2] != 3*np) {
176 std::cout <<
"Error: incorrect MachineExtent" << std::endl;
183 ncoord_t xyz_expected[3] = {me, np, np+1};
186 std::cout <<
"Error: getMyMachineCoordinate failed" << std::endl;
190 if ((xyz[0] != xyz_expected[0]) ||
191 (xyz[1] != xyz_expected[1]) ||
192 (xyz[2] != xyz_expected[2])) {
193 std::cout <<
"Error: incorrect MyMachineCoordinate" << std::endl;
199 std::cout <<
"Error: getMachineCoordinate failed" << std::endl;
208 if (me == 0) std::cout <<
"PASS" << std::endl;
#define TEST_FAIL_AND_RETURN_VALUE(comm, ok, s, rc)
int checkAllCoords(const Teuchos::Comm< int > &comm, const Zoltan2::MachineRepresentation< nCoord_t, part_t > &mach)
int checkErrorCode(const Teuchos::Comm< int > &comm, int code)
common code used by tests
Tpetra::Map ::local_ordinal_type zlno_t
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 hasMachineCoordinates() const
indicates whether or not the machine has coordinates
int getMachineDim() const
returns the dimension (number of coords per node) in the machine
bool getMachineExtent(int *nxyz) const
sets the number of unique coordinates in each machine dimension
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 ...
static const std::string fail
SparseMatrixAdapter_t::part_t part_t