48 #include <Kokkos_Core.hpp>
49 #include <Teuchos_DefaultComm.hpp>
50 #include <Teuchos_RCP.hpp>
51 #include <Teuchos_CommHelpers.hpp>
55 int main(
int narg,
char *arg[]) {
57 Tpetra::ScopeGuard tscope(&narg, &arg);
58 Teuchos::RCP<const Teuchos::Comm<int> > comm = Tpetra::getDefaultComm();
63 int rank = comm->getRank();
64 int nprocs = comm->getSize();
65 int fail = 0, gfail = 0;
69 const int nWeights = 2;
71 Kokkos::View<zgno_t *> myIds(
"myIds", numLocalIds);
72 zgno_t myFirstId = rank * numLocalIds * numLocalIds;
73 Kokkos::View<zscalar_t **, Layout>
weights(
"weights", numLocalIds, nWeights);
75 for (
zlno_t i = 0; i < numLocalIds; i++) {
76 myIds(i) =
zgno_t(myFirstId + i);
78 weights(i, 1) = (nprocs - rank) / (i + 1);
90 Kokkos::View<zgno_t *> globalIdsIn;
91 Kokkos::View<zscalar_t *> weightsIn[nWeights];
95 for (
int w = 0; !fail && w < nWeights; w++) {
99 Kokkos::View<zscalar_t *> w0 = weightsIn[0];
100 Kokkos::View<zscalar_t *> w1 = weightsIn[1];
102 for (
zlno_t i = 0; !fail && i < numLocalIds; i++){
103 if (globalIdsIn(i) !=
zgno_t(myFirstId + i)) {
106 if (!fail && w0(i) != 1.0) {
109 if (!fail && w1(i) !=
weights(i, 1)) {
119 std::cout <<
"PASS" << std::endl;
void printFailureCode(const Comm< int > &comm, int fail)
void getIDsKokkosView(Kokkos::View< gno_t * > &ids) const
Provide a pointer to this process' identifiers.
int main(int narg, char *arg[])
common code used by tests
void getWeightsKokkosView(Kokkos::View< scalar_t * > &wgt, int idx=0) const
Provide pointer to a weight View.
This class represents a collection of global Identifiers and their associated weights, if any.
size_t getLocalNumIDs() const
Returns the number of objects on this process.
Defines the BasicKokkosIdentifierAdapter class.
static const std::string fail
int globalFail(const Comm< int > &comm, int fail)
int getNumWeightsPerID() const
Returns the number of weights per object. Number of weights per object should be zero or greater...
Kokkos::LayoutLeft weight_layout_t