50#include <Teuchos_DefaultComm.hpp>
52template <
typename nCoord_t,
typename part_t>
61 const int failval = 100000000;
63 int np = comm.getSize();
64 int me = comm.getRank();
67 int *nxyz =
new int[dim];
69 nCoord_t *xyz =
new nCoord_t[dim];
78 for (
int i = 0; i < np; i++) {
80 if (me == 0) std::cout <<
"RANK " << i <<
" COORD ";
81 for (
int d = 0; d < dim; d++) {
82 if (me == 0) std::cout <<
" " << xyz[d];
83 if (xyz[d] != allCoords[d][i])
fail = failval;
84 if (haveExtent && (xyz[d] < 0 || xyz[d] >= nxyz[d]))
fail = failval;
86 if (me == 0) std::cout << std::endl;
89 std::cout <<
"Rank " << me
90 <<
" getMachineCoordinate failed " << std::endl;
94 if (
fail == failval) {
95 std::cout <<
"Rank " << me
96 <<
" Invalid coordinates from getAllMachineCoordinatesView or "
97 <<
"getMachineCoordinate" << std::endl;
102 for (
int d = 0; d < dim; d++)
103 if (xyz[d] != allCoords[d][me])
fail = failval;
107 std::cout <<
"Rank " << me
108 <<
"getMyMachineCoordinates failed" << std::endl;
113 std::cout <<
"Rank " << me
114 <<
"couldn't retrieve coordinates with "
115 <<
"getAllMachineCoordinatesView" << std::endl;
127 int rank = comm.getRank();
129 std::cerr <<
"Proc " << rank <<
" error: " << code << std::endl;
142 Tpetra::ScopeGuard tscope(&narg, &arg);
143 Teuchos::RCP<const Teuchos::Comm<int> > comm = Tpetra::getDefaultComm();
145 int me = comm->getRank();
146 int np = comm->getSize();
148 char node0[6] = {
'n',
'o',
'd',
'e',
'0',
'\0'};
155 Teuchos::ParameterList pl;
163 fail += checkAllCoords<ncoord_t,part_t>(*comm, mach);
168#if defined(HAVE_ZOLTAN2_LDMS)
170 if (me == 0 ) std::cout <<
"LDMS Topology" << std::endl;
174#elif defined(HAVE_ZOLTAN2_RCALIB)
176 if (me == 0 ) std::cout <<
"RCALIB Topology" << std::endl;
181#elif defined(HAVE_ZOLTAN2_TOPOMANAGER)
183 if (me == 0 ) std::cout <<
"TOPOMANAGER Topology" << std::endl;
188#elif defined(HAVE_ZOLTAN2_BGQTEST)
190 if (me == 0 ) std::cout <<
"BGQTEST Topology" << std::endl;
197 if (me == 0 ) std::cout <<
"TEST Topology" << std::endl;
200 std::cout <<
"Error: Dimension != 3" << std::endl;
206 std::cout <<
"Error: getMachineExtent failed" << std::endl;
209 if (nxyz[0] != np || nxyz[1] != 2*np || nxyz[2] != 3*np) {
211 std::cout <<
"Error: incorrect MachineExtent" << std::endl;
218 ncoord_t xyz_expected[3] = {me, np, np+1};
221 std::cout <<
"Error: getMyMachineCoordinate failed" << std::endl;
225 if ((xyz[0] != xyz_expected[0]) ||
226 (xyz[1] != xyz_expected[1]) ||
227 (xyz[2] != xyz_expected[2])) {
228 std::cout <<
"Error: incorrect MyMachineCoordinate" << std::endl;
234 std::cout <<
"Error: getMachineCoordinate failed" << std::endl;
243 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