51 #include <Teuchos_GlobalMPISession.hpp>
52 #include <Teuchos_DefaultComm.hpp>
53 #include <Teuchos_RCP.hpp>
54 #include <Teuchos_CommHelpers.hpp>
58 using Teuchos::DefaultComm;
60 int main(
int argc,
char *argv[])
62 Teuchos::GlobalMPISession session(&argc, &argv);
63 RCP<const Comm<int> > comm = DefaultComm<int>::getComm();
64 int rank = comm->getRank();
65 int nprocs = comm->getSize();
66 int fail = 0, gfail=0;
70 lno_t numLocalIds = 10;
75 gno_t base = rank * numLocalIds * numLocalIds;
77 for (
lno_t i=0; i < numLocalIds; i++){
79 weights[i*weightDim] = 1.0;
80 weights[i*weightDim + 1] = (nprocs-rank) / (i+1);
87 std::vector<const scalar_t *> weightValues;
88 std::vector<int> strides;
90 weightValues.push_back(weights);
91 weightValues.push_back(weights + 1);
96 weightValues, strides);
108 const gno_t *globalIdsIn;
110 int weightStridesIn[2];
115 for (
int w=0; !fail && w < weightDim; w++){
117 size_t(numLocalIds * weightStridesIn[w]))
123 int incr1 = weightStridesIn[0];
124 int incr2 = weightStridesIn[1];
126 for (
lno_t i=0; !fail && i < numLocalIds; i++){
128 if (globalIdsIn[i] != base+i)
131 if (!fail && w1[i*incr1] != 1.0)
134 if (!fail && w2[i*incr2] != weights[i*weightDim+1])
146 std::cout <<
"PASS" << std::endl;
int globalFail(const RCP< const Comm< int > > &comm, int fail)
A simple class that can be the User template argument for an InputAdapter.
common code used by tests
int main(int argc, char *argv[])
void printFailureCode(const RCP< const Comm< int > > &comm, int fail)