61 const int failval = 100000000;
63 int np = comm.getSize();
64 int me = comm.getRank();
66 int dim = mach.getMachineDim();
67 int *nxyz =
new int[dim];
69 nCoord_t *xyz =
new nCoord_t[dim];
73 bool haveExtent = mach.getMachineExtent(nxyz);
75 if (mach.getAllMachineCoordinatesView(allCoords)) {
78 for (
int i = 0; i < np; i++) {
79 if (mach.getMachineCoordinate(i, xyz)) {
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;
101 if (mach.getMyMachineCoordinate(xyz)) {
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;
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;
160 if (mach.getNumRanks() != np)
fail += 1;
162 if (mach.hasMachineCoordinates())
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;
199 if (mach.getMachineDim() != 3) {
200 std::cout <<
"Error: Dimension != 3" << std::endl;
205 if (!mach.getMachineExtent(nxyz)) {
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};
220 if (!mach.getMyMachineCoordinate(xyz)) {
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;
233 if (mach.getMachineCoordinate(name, xyz)) {
234 std::cout <<
"Error: getMachineCoordinate failed" << std::endl;
243 if (me == 0) std::cout <<
"PASS" << std::endl;