35 const RCP<
const Comm<int> > &comm)
37 int rank = comm->getRank();
38 int fail = 0, gfail = 0;
40 std::bitset<Zoltan2::NUM_MODEL_FLAGS> modelFlags = 0;
47 typedef Tpetra::CrsMatrix<zscalar_t, zlno_t, zgno_t>
tcrsMatrix_t;
56 zlno_t nLocalIds = M->getLocalNumRows();
57 zgno_t nGlobalIds = M->getGlobalNumRows();
59 ArrayView<const zgno_t> idList = M->getRowMap()->getLocalElementList();
60 std::set<zgno_t> idSet(idList.begin(), idList.end());
70 RCP<const adapter_t> ia = Teuchos::rcp(
new adapter_t(M));
73 RCP<const base_adapter_t> base_ia =
74 Teuchos::rcp_dynamic_cast<const base_adapter_t>(ia);
78 base_ia, env, comm, modelFlags);
80 catch (std::exception &e){
81 std::cerr << rank <<
") " << e.what() << std::endl;
93 std::cerr << rank <<
") getLocalNumIdentifiers "
95 << nLocalIds << std::endl;
100 std::cerr << rank <<
") getGlobalNumIdentifiers "
102 << nGlobalIds << std::endl;
111 ArrayView<const zgno_t> gids;
112 ArrayView<input_t> wgts;
116 if (!
fail && gids.size() != nLocalIds) {
117 std::cerr << rank <<
") getIdentifierList IDs "
118 << gids.size() <<
" "
119 << nLocalIds << std::endl;
123 if (!
fail && wgts.size() != 0) {
124 std::cerr << rank <<
") getIdentifierList Weights "
125 << wgts.size() <<
" "
130 for (
zlno_t i=0; !
fail && i < nLocalIds; i++){
131 std::set<zgno_t>::iterator next = idSet.find(gids[i]);
132 if (next == idSet.end()) {
133 std::cerr << rank <<
") getIdentifierList gid not found "
134 << gids[i] << std::endl;
139 Kokkos::View<const zgno_t*, typename tcrsMatrix_t::device_type> gidsKokkos;
140 Kokkos::View<zscalar_t **, typename tcrsMatrix_t::device_type> wgtsKokkos;
144 auto gidsKokkosHost = Kokkos::create_mirror_view(gidsKokkos);
145 Kokkos::deep_copy(gidsKokkosHost, gidsKokkos);
146 auto wgtsKokkosHost = Kokkos::create_mirror_view(wgtsKokkos);
147 Kokkos::deep_copy(wgtsKokkosHost, wgtsKokkos);
150 if (!
fail && gidsKokkosHost.extent(0) !=
static_cast<size_t>(nLocalIds)) {
151 std::cerr << rank <<
") getIdentifierList IDs "
152 << gidsKokkosHost.extent(0) <<
" "
153 << nLocalIds << std::endl;
157 if (!
fail && wgtsKokkosHost.extent(1) != 0) {
158 std::cerr << rank <<
") getIdentifierList Weights "
159 << wgtsKokkosHost.extent(1) <<
" "
164 for (
zlno_t i=0; !
fail && i < nLocalIds; i++){
165 std::set<zgno_t>::iterator next = idSet.find(gidsKokkosHost(i));
166 if (next == idSet.end()) {
167 std::cerr << rank <<
") getIdentifierList gid not found "
168 << gidsKokkosHost(i) << std::endl;