70 const RCP<
const Comm<int> > &comm)
72 int rank = comm->getRank();
73 int fail = 0, gfail = 0;
75 std::bitset<Zoltan2::NUM_MODEL_FLAGS> modelFlags = 0;
82 typedef Tpetra::CrsMatrix<zscalar_t, zlno_t, zgno_t>
tcrsMatrix_t;
90 RCP<tcrsMatrix_t > M = uinput->getUITpetraCrsMatrix();
91 zlno_t nLocalIds = M->getLocalNumRows();
92 zgno_t nGlobalIds = M->getGlobalNumRows();
94 ArrayView<const zgno_t> idList = M->getRowMap()->getLocalElementList();
95 std::set<zgno_t> idSet(idList.begin(), idList.end());
105 RCP<const adapter_t> ia = Teuchos::rcp(
new adapter_t(M));
108 RCP<const base_adapter_t> base_ia =
109 Teuchos::rcp_dynamic_cast<const base_adapter_t>(ia);
113 base_ia, env, comm, modelFlags);
115 catch (std::exception &e){
116 std::cerr << rank <<
") " << e.what() << std::endl;
128 std::cerr << rank <<
") getLocalNumIdentifiers "
130 << nLocalIds << std::endl;
135 std::cerr << rank <<
") getGlobalNumIdentifiers "
137 << nGlobalIds << std::endl;
146 ArrayView<const zgno_t> gids;
147 ArrayView<input_t> wgts;
151 if (!
fail && gids.size() != nLocalIds) {
152 std::cerr << rank <<
") getIdentifierList IDs "
153 << gids.size() <<
" "
154 << nLocalIds << std::endl;
158 if (!
fail && wgts.size() != 0) {
159 std::cerr << rank <<
") getIdentifierList Weights "
160 << wgts.size() <<
" "
165 for (
zlno_t i=0; !
fail && i < nLocalIds; i++){
166 std::set<zgno_t>::iterator next = idSet.find(gids[i]);
167 if (next == idSet.end()) {
168 std::cerr << rank <<
") getIdentifierList gid not found "
169 << gids[i] << std::endl;
174 Kokkos::View<const zgno_t*, typename tcrsMatrix_t::device_type> gidsKokkos;
175 Kokkos::View<zscalar_t **, typename tcrsMatrix_t::device_type> wgtsKokkos;
179 auto gidsKokkosHost = Kokkos::create_mirror_view(gidsKokkos);
180 Kokkos::deep_copy(gidsKokkosHost, gidsKokkos);
181 auto wgtsKokkosHost = Kokkos::create_mirror_view(wgtsKokkos);
182 Kokkos::deep_copy(wgtsKokkosHost, wgtsKokkos);
185 if (!
fail && gidsKokkosHost.extent(0) !=
static_cast<size_t>(nLocalIds)) {
186 std::cerr << rank <<
") getIdentifierList IDs "
187 << gidsKokkosHost.extent(0) <<
" "
188 << nLocalIds << std::endl;
192 if (!
fail && wgtsKokkosHost.extent(1) != 0) {
193 std::cerr << rank <<
") getIdentifierList Weights "
194 << wgtsKokkosHost.extent(1) <<
" "
199 for (
zlno_t i=0; !
fail && i < nLocalIds; i++){
200 std::set<zgno_t>::iterator next = idSet.find(gidsKokkosHost(i));
201 if (next == idSet.end()) {
202 std::cerr << rank <<
") getIdentifierList gid not found "
203 << gidsKokkosHost(i) << std::endl;