34 const RCP<
const Comm<int> > &comm,
35 bool nodeZeroHasAll,
bool printInfo)
37 int fail = 0, gfail = 0;
40 std::cout <<
"Test: " << fname << std::endl;
41 std::cout <<
"Num Weights: " << nWeights;
42 std::cout <<
" proc 0 has all: " << nodeZeroHasAll;
43 std::cout << std::endl;
50 typedef Tpetra::MultiVector<zscalar_t, zlno_t, zgno_t, znode_t> mv_t;
52 RCP<UserInputForTests> uinput;
57 catch(std::exception &e){
66 coords = uinput->getUICoordinates();
68 catch(std::exception &e){
74 int coordDim = coords->getNumVectors();
78 const zscalar_t *x=NULL, *y=NULL, *z=NULL;
80 x = coords->getData(0).getRawPtr();
82 y = coords->getData(1).getRawPtr();
84 z = coords->getData(2).getRawPtr();
89 int nLocalIds = coords->getLocalLength();
90 ArrayView<const zgno_t> idList = coords->getMap()->getLocalElementList();
94 if (comm->getRank() > 0){
99 nGlobalIds = nLocalIds;
101 Teuchos::broadcast<int, int>(*comm, 0, &nGlobalIds);
104 nGlobalIds = coords->getGlobalLength();
107 Array<ArrayRCP<const zscalar_t> > coordWeights(nWeights);
110 for (
int wdim=0; wdim < nWeights; wdim++){
112 for (
int i=0; i < nLocalIds; i++){
113 w[i] = ((i%2) + 1) + wdim;
115 coordWeights[wdim] = Teuchos::arcp(w, 0, nLocalIds);
131 ia = rcp(
new ia_t(nLocalIds, idList.getRawPtr(), x, y, z));
133 catch(std::exception &e){
138 std::vector<const zscalar_t *> values,
weights;
139 std::vector<int> valueStrides, weightStrides;
146 for (
int wdim=0; wdim < nWeights; wdim++){
147 weights.push_back(coordWeights[wdim].getRawPtr());
151 ia = rcp(
new ia_t(nLocalIds, idList.getRawPtr(),
152 values, valueStrides,
weights, weightStrides));
154 catch(std::exception &e){
159 RCP<const base_ia_t> base_ia = Teuchos::rcp_dynamic_cast<const base_ia_t>(ia);
168 typedef std::bitset<Zoltan2::NUM_MODEL_FLAGS> modelFlags_t;
170 modelFlags_t modelFlags;
177 model = rcp(
new model_t(base_ia, env, comm, modelFlags));
179 catch (std::exception &e){
187 if (model->getCoordinateDim() != coordDim)
190 if (!
fail && model->getLocalNumCoordinates() !=
size_t(nLocalIds))
193 if (!
fail && model->getGlobalNumCoordinates() !=
size_t(nGlobalIds))
196 if (!
fail && model->getNumWeightsPerCoordinate() != nWeights)
204 ArrayView<const zgno_t> gids;
205 ArrayView<input_t> xyz;
206 ArrayView<input_t> wgts;
208 model->getCoordinates(gids, xyz, wgts);
210 if (!
fail && gids.size() != nLocalIds)
213 for (
int i=0; !
fail && i < nLocalIds; i++){
214 if (gids[i] != idList[i])
218 if (!
fail && wgts.size() != nWeights)
223 for (
int dim=0; !
fail && dim < coordDim; dim++){
224 for (
int i=0; !
fail && i < nLocalIds; i++){
225 if (xyz[dim][i] != vals[dim][i])
230 for (
int wdim=0; !
fail && wdim < nWeights; wdim++){
231 for (
int i=0; !
fail && i < nLocalIds; i++){
232 if (wgts[wdim][i] != coordWeights[wdim][i])
246 Kokkos::View<const zgno_t *, typename znode_t::device_type> gidsKokkos;
248 Kokkos::View<zscalar_t **, Kokkos::LayoutLeft, typename znode_t::device_type> xyzKokkos;
249 Kokkos::View<zscalar_t **, typename znode_t::device_type> wgtsKokkos;
251 model->getCoordinatesKokkos(gidsKokkos, xyzKokkos, wgtsKokkos);
253 if (!
fail && gidsKokkos.extent(0) !=
static_cast<size_t>(nLocalIds))
256 auto gidsKokkos_host = Kokkos::create_mirror_view(gidsKokkos);
257 Kokkos::deep_copy(gidsKokkos_host, gidsKokkos);
259 for (
int i=0; !
fail && i < nLocalIds; i++){
260 if (gidsKokkos_host(i) != idList[i])
264 if (!
fail && wgtsKokkos.extent(1) !=
static_cast<size_t>(nWeights))
267 auto xyzKokkos_host = Kokkos::create_mirror_view(xyzKokkos);
268 Kokkos::deep_copy(xyzKokkos_host, xyzKokkos);
270 for (
int dim=0; !
fail && dim < coordDim; dim++){
271 for (
int i=0; !
fail && i < nLocalIds; i++){
272 if (xyzKokkos_host(i, dim) != vals[dim][i])
277 auto wgtsKokkos_host = Kokkos::create_mirror_view(wgtsKokkos);
278 Kokkos::deep_copy(wgtsKokkos_host, wgtsKokkos);
280 for (
int wdim=0; !
fail && wdim < nWeights; wdim++){
281 for (
int i=0; !
fail && i < nLocalIds; i++){
282 if (wgtsKokkos_host(i, wdim) != coordWeights[wdim][i])