35 const RCP<
const Comm<int> > &comm,
36 bool nodeZeroHasAll,
bool printInfo)
38 int fail = 0, gfail = 0;
41 std::cout <<
"Test: " << fname << std::endl;
42 std::cout <<
"Num Weights: " << nWeights;
43 std::cout <<
" proc 0 has all: " << nodeZeroHasAll;
44 std::cout << std::endl;
51 typedef Tpetra::MultiVector<zscalar_t, zlno_t, zgno_t, znode_t> mv_t;
53 RCP<UserInputForTests> uinput;
58 catch(std::exception &e){
67 coords = uinput->getUICoordinates();
69 catch(std::exception &e){
75 int coordDim = coords->getNumVectors();
79 const zscalar_t *x=NULL, *y=NULL, *z=NULL;
81 x = coords->getData(0).getRawPtr();
83 y = coords->getData(1).getRawPtr();
85 z = coords->getData(2).getRawPtr();
90 int nLocalIds = coords->getLocalLength();
91 ArrayView<const zgno_t> idList = coords->getMap()->getLocalElementList();
95 if (comm->getRank() > 0){
100 nGlobalIds = nLocalIds;
102 Teuchos::broadcast<int, int>(*comm, 0, &nGlobalIds);
105 nGlobalIds = coords->getGlobalLength();
108 Array<ArrayRCP<const zscalar_t> > coordWeights(nWeights);
111 for (
int wdim=0; wdim < nWeights; wdim++){
113 for (
int i=0; i < nLocalIds; i++){
114 w[i] = ((i%2) + 1) + wdim;
116 coordWeights[wdim] = Teuchos::arcp(w, 0, nLocalIds);
132 ia = rcp(
new ia_t(nLocalIds, idList.getRawPtr(), x, y, z));
134 catch(std::exception &e){
139 std::vector<const zscalar_t *> values,
weights;
140 std::vector<int> valueStrides, weightStrides;
147 for (
int wdim=0; wdim < nWeights; wdim++){
148 weights.push_back(coordWeights[wdim].getRawPtr());
152 ia = rcp(
new ia_t(nLocalIds, idList.getRawPtr(),
153 values, valueStrides,
weights, weightStrides));
155 catch(std::exception &e){
160 RCP<const base_ia_t> base_ia = Teuchos::rcp_dynamic_cast<const base_ia_t>(ia);
169 typedef std::bitset<Zoltan2::NUM_MODEL_FLAGS> modelFlags_t;
171 modelFlags_t modelFlags;
178 model = rcp(
new model_t(base_ia, env, comm, modelFlags));
180 catch (std::exception &e){
188 if (model->getCoordinateDim() != coordDim)
191 if (!
fail && model->getLocalNumCoordinates() !=
size_t(nLocalIds))
194 if (!
fail && model->getGlobalNumCoordinates() !=
size_t(nGlobalIds))
197 if (!
fail && model->getNumWeightsPerCoordinate() != nWeights)
205 ArrayView<const zgno_t> gids;
206 ArrayView<input_t> xyz;
207 ArrayView<input_t> wgts;
209 model->getCoordinates(gids, xyz, wgts);
211 if (!
fail && gids.size() != nLocalIds)
214 for (
int i=0; !
fail && i < nLocalIds; i++){
215 if (gids[i] != idList[i])
219 if (!
fail && wgts.size() != nWeights)
224 for (
int dim=0; !
fail && dim < coordDim; dim++){
225 for (
int i=0; !
fail && i < nLocalIds; i++){
226 if (xyz[dim][i] != vals[dim][i])
231 for (
int wdim=0; !
fail && wdim < nWeights; wdim++){
232 for (
int i=0; !
fail && i < nLocalIds; i++){
233 if (wgts[wdim][i] != coordWeights[wdim][i])
247 Kokkos::View<const zgno_t *, typename znode_t::device_type> gidsKokkos;
249 Kokkos::View<zscalar_t **, Kokkos::LayoutLeft, typename znode_t::device_type> xyzKokkos;
250 Kokkos::View<zscalar_t **, typename znode_t::device_type> wgtsKokkos;
252 model->getCoordinatesKokkos(gidsKokkos, xyzKokkos, wgtsKokkos);
254 if (!
fail && gidsKokkos.extent(0) !=
static_cast<size_t>(nLocalIds))
257 auto gidsKokkos_host = Kokkos::create_mirror_view(gidsKokkos);
258 Kokkos::deep_copy(gidsKokkos_host, gidsKokkos);
260 for (
int i=0; !
fail && i < nLocalIds; i++){
261 if (gidsKokkos_host(i) != idList[i])
265 if (!
fail && wgtsKokkos.extent(1) !=
static_cast<size_t>(nWeights))
268 auto xyzKokkos_host = Kokkos::create_mirror_view(xyzKokkos);
269 Kokkos::deep_copy(xyzKokkos_host, xyzKokkos);
271 for (
int dim=0; !
fail && dim < coordDim; dim++){
272 for (
int i=0; !
fail && i < nLocalIds; i++){
273 if (xyzKokkos_host(i, dim) != vals[dim][i])
278 auto wgtsKokkos_host = Kokkos::create_mirror_view(wgtsKokkos);
279 Kokkos::deep_copy(wgtsKokkos_host, wgtsKokkos);
281 for (
int wdim=0; !
fail && wdim < nWeights; wdim++){
282 for (
int i=0; !
fail && i < nLocalIds; i++){
283 if (wgtsKokkos_host(i, wdim) != coordWeights[wdim][i])