Zoltan2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TaskMappingProblemTest.cpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Zoltan2: A package of combinatorial algorithms for scientific computing
4 //
5 // Copyright 2012 NTESS and the Zoltan2 contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #include "Zoltan2_TaskMapping.hpp"
12 #include <Zoltan2_TestHelpers.hpp>
13 
14 #include <string>
15 
16 #include <Teuchos_RCP.hpp>
17 #include <Teuchos_Array.hpp>
18 #include <Teuchos_ParameterList.hpp>
19 #include "Teuchos_XMLParameterListHelpers.hpp"
20 
21 #include "Tpetra_MultiVector.hpp"
22 #include <Tpetra_CrsGraph.hpp>
23 #include <Tpetra_Map.hpp>
24 
27 #include <Zoltan2_TimerManager.hpp>
32 
33 typedef Tpetra::CrsGraph<zlno_t, zgno_t, znode_t> mytest_tcrsGraph_t;
34 typedef Tpetra::MultiVector<zscalar_t, zlno_t, zgno_t, znode_t>
38 typedef Tpetra::Map<>::node_type mytest_znode_t;
39 typedef Tpetra::Map<zlno_t, zgno_t, mytest_znode_t> mytest_map_t;
41 
46 };
47 
51 };
52 
53 RCP<mytest_tcrsGraph_t> create_tpetra_input_matrix(
54  int nx, int ny, int nz,
55  int numProcs, Teuchos::RCP<const Teuchos::Comm<int> > tcomm,
56  RCP<Zoltan2::Environment> env, zscalar_t ** &partCenters, zgno_t & myTasks) {
57 
58  int rank = tcomm->getRank();
59  using namespace Teuchos;
60 
61  int coordDim = 3;
62  zgno_t numGlobalTasks = nx*ny*nz;
63 
64  //int rank = tcomm->getRank();
65  myTasks = numGlobalTasks / numProcs;
66  zgno_t taskLeftOver = numGlobalTasks % numProcs;
67  if (zgno_t(rank) < taskLeftOver ) ++myTasks;
68 
69  zgno_t myTaskBegin = (numGlobalTasks / numProcs) * rank;
70  myTaskBegin += (taskLeftOver < zgno_t(rank) ? taskLeftOver : rank);
71  zgno_t myTaskEnd = myTaskBegin + myTasks;
72 
73  //zscalar_t **partCenters = NULL;
74  partCenters = new zscalar_t * [coordDim];
75  for(int i = 0; i < coordDim; ++i) {
76  partCenters[i] = new zscalar_t[myTasks];
77  }
78 
79  zgno_t *task_communication_xadj_ = new zgno_t [myTasks + 1];
80  zgno_t *task_communication_adj_ = new zgno_t [myTasks * 6];
81 
82  env->timerStart(Zoltan2::MACRO_TIMERS, "TaskGraphCreate");
83  zlno_t prevNCount = 0;
84  task_communication_xadj_[0] = 0;
85  for (zgno_t i = myTaskBegin; i < myTaskEnd; ++i) {
86  int x = i % nx;
87  int y = (i / (nx)) % ny;
88  int z = (i / (nx)) / ny;
89  partCenters[0][i - myTaskBegin] = x;
90  partCenters[1][i - myTaskBegin] = y;
91  partCenters[2][i - myTaskBegin] = z;
92 
93  if (x > 0) {
94  task_communication_adj_[prevNCount++] = i - 1;
95  }
96  if (x < nx - 1) {
97  task_communication_adj_[prevNCount++] = i + 1;
98  }
99  if (y > 0) {
100  task_communication_adj_[prevNCount++] = i - nx;
101  }
102  if (y < ny - 1) {
103  task_communication_adj_[prevNCount++] = i + nx;
104  }
105  if (z > 0) {
106  task_communication_adj_[prevNCount++] = i - nx * ny;
107  }
108  if (z < nz - 1) {
109  task_communication_adj_[prevNCount++] = i + nx * ny;
110  }
111 
112  task_communication_xadj_[i + 1 - myTaskBegin] = prevNCount;
113  }
114 
115  env->timerStop(Zoltan2::MACRO_TIMERS, "TaskGraphCreate");
116 
117  using namespace Teuchos;
118  RCP<const mytest_map_t> map = rcp (new mytest_map_t (numGlobalTasks,
119  myTasks, 0, tcomm));
120 
121  Teuchos::Array<size_t> adjPerTask(myTasks);
122  for (zgno_t lclRow = 0; lclRow < myTasks; ++lclRow)
123  adjPerTask[lclRow] = task_communication_xadj_[lclRow+1]
124  - task_communication_xadj_[lclRow];
125  RCP<mytest_tcrsGraph_t> TpetraCrsGraph(new mytest_tcrsGraph_t(map,
126  adjPerTask()));
127 
128  env->timerStart(Zoltan2::MACRO_TIMERS, "TpetraGraphCreate");
129 
130  for (zgno_t lclRow = 0; lclRow < myTasks; ++lclRow) {
131  const zgno_t gblRow = map->getGlobalElement (lclRow);
132  zgno_t begin = task_communication_xadj_[lclRow];
133  zgno_t end = task_communication_xadj_[lclRow + 1];
134  const ArrayView< const zgno_t > indices(task_communication_adj_ + begin,
135  end - begin);
136  TpetraCrsGraph->insertGlobalIndices(gblRow, indices);
137  }
138  TpetraCrsGraph->fillComplete ();
139 
140  delete [] task_communication_xadj_;
141  delete [] task_communication_adj_;
142 
143  env->timerStop(Zoltan2::MACRO_TIMERS, "TpetraGraphCreate");
144  return TpetraCrsGraph;
145 }
146 
147 
148 RCP<Zoltan2::XpetraMultiVectorAdapter<mytest_tMVector_t> >
149 create_multi_vector_adapter(RCP<const mytest_map_t> map,
150  zscalar_t **partCenters,
151  zgno_t myTasks) {
152 
153  const int coord_dim = 3;
154  Teuchos::Array<Teuchos::ArrayView<const zscalar_t> > coordView(coord_dim);
155 
156  if(myTasks > 0) {
157  Teuchos::ArrayView<const zscalar_t> a(partCenters[0], myTasks);
158  coordView[0] = a;
159  Teuchos::ArrayView<const zscalar_t> b(partCenters[1], myTasks);
160  coordView[1] = b;
161  Teuchos::ArrayView<const zscalar_t> c(partCenters[2], myTasks);
162  coordView[2] = c;
163  }
164  else {
165  Teuchos::ArrayView<const zscalar_t> a;
166  coordView[0] = a;
167  coordView[1] = a;
168  coordView[2] = a;
169  }
170 
171  // = set multivector;
172  RCP<mytest_tMVector_t> coords(
173  new mytest_tMVector_t(map, coordView.view(0, coord_dim), coord_dim));
174  RCP<const mytest_tMVector_t> const_coords =
175  rcp_const_cast<const mytest_tMVector_t>(coords);
176  RCP <Zoltan2::XpetraMultiVectorAdapter<mytest_tMVector_t> > adapter(
178  return adapter;
179 }
180 
181 
183  int nx, int ny, int nz,
184  Teuchos::RCP<const Teuchos::Comm<int> > global_tcomm)
185 {
186  Teuchos::RCP<const Teuchos::Comm<int> > tcomm = global_tcomm;
187  //Teuchos::createSerialComm<int>();
188 
189  mytest_part_t numProcs = tcomm->getSize();
190  Teuchos::ParameterList distributed_problemParams;
191 
192  // Create mapping problem parameters
193  distributed_problemParams.set("Machine_Optimization_Level", 10);
194  distributed_problemParams.set("mapping_algorithm", "geometric");
195  distributed_problemParams.set("distributed_input_adapter", true);
196  distributed_problemParams.set("mj_enable_rcb", true);
197  distributed_problemParams.set("algorithm", "multijagged");
198  distributed_problemParams.set("num_global_parts", numProcs);
199 
200  RCP<Zoltan2::Environment> env(
201  new Zoltan2::Environment(distributed_problemParams, global_tcomm));
202  RCP<Zoltan2::TimerManager> timer(
203  new Zoltan2::TimerManager(global_tcomm, &std::cout,
205  env->setTimer(timer);
206 
207  //------------------CREATE DISTRIBUTED INPUT ADAPTER--------------------//
208  zscalar_t **partCenters;
209  zgno_t myTasks ;
210  // Create tpetra input graph
211  RCP<mytest_tcrsGraph_t> distributed_tpetra_graph =
212  create_tpetra_input_matrix(nx, ny, nz, numProcs,
213  tcomm, env, partCenters,
214  myTasks);
215  RCP<const mytest_map_t> distributed_map =
216  distributed_tpetra_graph->getMap();
217  global_tcomm->barrier();
218 
219  // Create input adapter from tpetra graph
220  env->timerStart(Zoltan2::MACRO_TIMERS, "AdapterCreate");
221  RCP<const mytest_tcrsGraph_t> const_tpetra_graph =
222  rcp_const_cast<const mytest_tcrsGraph_t>(distributed_tpetra_graph);
223  RCP<mytest_adapter_t> ia (new mytest_adapter_t(const_tpetra_graph));
224 
225  // Create multivector for coordinates
226  RCP<Zoltan2::XpetraMultiVectorAdapter<mytest_tMVector_t> >
227  distributed_adapter = create_multi_vector_adapter(distributed_map,
228  partCenters, myTasks);
229  ia->setCoordinateInput(distributed_adapter.getRawPtr());
230  env->timerStop(Zoltan2::MACRO_TIMERS, "AdapterCreate");
231  global_tcomm->barrier();
232  //---------------DISTRIBUTED INPUT ADAPTER IS CREATED-------------------//
233 
234 
235  // Now we have 3 ways to create mapping problem.
236  // First, run a partitioning algorithm on the input adapter. Then run task
237  // mapping at the result of this partitioning.
238  //
239  // Second, run mapping algorithm directly. Mapping algorithm will assume
240  // that the tasks within the same processors are in the same partition,
241  // such as they are migrated as a result of a partitioning.
242  //
243  // Third, you can create your own partitioning solution without running a
244  // partitioning algorithm. This option can be used to make the task
245  // mapping to perform partitioning as well. That is, create a partitioning
246  // solution where each element is a part itself, then task mapping
247  // algorithm will map each of these tasks to a processor. As a result of
248  // this mapping, it will perform partitioning as well.
249 
250  // First create a partitioning problem.
252  ia.getRawPtr(), &distributed_problemParams, global_tcomm);
253 
254  partitioning_problem.solve();
255 
257  partitioning_problem.getSolution();
258 
259  // For the second case, we do not need a solution.
260 
261  // For the third case we create our own solution and set unique parts to
262  // each element.
263  // Basically each element has its global id as part number.
265  single_phase_mapping_solution(env, global_tcomm, 0);
266  Teuchos::ArrayView< const zgno_t> gids =
267  distributed_map->getLocalElementList();
268 
269  ArrayRCP<int> initial_part_ids(myTasks);
270  for (zgno_t i = 0; i < myTasks; ++i) {
271  initial_part_ids[i] = gids[i];
272  }
273  single_phase_mapping_solution.setParts(initial_part_ids);
274 
275  env->timerStart(Zoltan2::MACRO_TIMERS, "Problem Create");
276  // Create mapping problem for the first case, provide the partition
277  // solution by MJ.
278  Zoltan2::MappingProblem<mytest_adapter_t> distributed_map_problem_1(
279  ia.getRawPtr(), &distributed_problemParams,
280  global_tcomm, &partition_solution);
281 
282  // Create mapping problem for the second case. We don't provide a
283  // solution in this case.
284  // Mapping assumes that the elements in the current processor is attached
285  // together and are in the same part.
286  Zoltan2::MappingProblem<mytest_adapter_t> distributed_map_problem_2(
287  ia.getRawPtr(), &distributed_problemParams, global_tcomm);
288 
289  // Create a mapping problem for the third case. We provide a solution in
290  // which all elements belong to unique part.
291  Zoltan2::MappingProblem<mytest_adapter_t> distributed_map_problem_3(
292  ia.getRawPtr(), &distributed_problemParams,
293  global_tcomm, &single_phase_mapping_solution);
294 
295  env->timerStop(Zoltan2::MACRO_TIMERS, "Problem Create");
296  //solve mapping problem.
297  env->timerStart(Zoltan2::MACRO_TIMERS, "Problem Solve");
298 
299  distributed_map_problem_1.solve(true);
300 
301  distributed_map_problem_2.solve(true);
302 
303  distributed_map_problem_3.solve(true);
304 
305  env->timerStop(Zoltan2::MACRO_TIMERS, "Problem Solve");
306 
307  //get the solution.
308 
310  distributed_map_problem_1.getSolution();
311 
313  distributed_map_problem_2.getSolution();
314 
316  distributed_map_problem_3.getSolution();
317 
318  timer->printAndResetToZero();
319 
320  //typedef Zoltan2::EvaluatePartition<my_adapter_t> quality_t;
321  //typedef Zoltan2::EvaluatePartition<my_adapter_t> quality_t;
323 
324  RCP<quality_t> metricObject_1 =
325  rcp(new quality_t(ia.getRawPtr(), &distributed_problemParams,
326  global_tcomm, msoln1,
327  distributed_map_problem_1.getMachine().getRawPtr()));
328  //metricObject_1->evaluate();
329 
330  RCP<quality_t> metricObject_2 =
331  rcp(new quality_t(ia.getRawPtr(), &distributed_problemParams,
332  global_tcomm, msoln2,
333  distributed_map_problem_2.getMachine().getRawPtr()));
334 
335  //metricObject_2->evaluate();
336  RCP<quality_t> metricObject_3 =
337  rcp(new quality_t(ia.getRawPtr(), &distributed_problemParams,
338  global_tcomm, msoln3,
339  distributed_map_problem_3.getMachine().getRawPtr()));
340 // metricObject_3->evaluate();
341 
342  if (global_tcomm->getRank() == 0) {
343  std::cout << "METRICS FOR THE FIRST CASE - TWO PHASE MAPPING"
344  << std::endl;
345  metricObject_1->printMetrics(std::cout);
346  std::cout << "METRICS FOR THE SECOND CASE - TWO PHASE MAPPING"
347  << " - INITIAL ASSIGNMENT ARE ASSUMED TO BE A PART" << std::endl;
348  metricObject_2->printMetrics(std::cout);
349  std::cout << "METRICS FOR THE THIRD CASE - ONE PHASE MAPPING"
350  << " - EACH ELEMENT IS ASSUMED TO BE IN UNIQUE PART AT THE BEGINNING"
351  << std::endl;
352  metricObject_3->printMetrics(std::cout);
353  }
354 
355  for (int i = 0; i < 3; i++)
356  delete [] partCenters[i];
357  delete [] partCenters;
358 }
359 
360 
361 
363  int nx, int ny, int nz,
364  Teuchos::RCP<const Teuchos::Comm<int> > global_tcomm)
365 {
366  // All processors have the all input in this case.
367  Teuchos::RCP<const Teuchos::Comm<int> > serial_comm =
368  Teuchos::createSerialComm<int>();
369 
370  // For the input creation, let processor think that it is the only
371  // processor.
372  mytest_part_t numProcs = serial_comm->getSize();
373  Teuchos::ParameterList serial_problemParams;
374  // Create mapping problem parameters
375  serial_problemParams.set("Machine_Optimization_Level", 10);
376  serial_problemParams.set("mapping_algorithm", "geometric");
377  serial_problemParams.set("distributed_input_adapter", false);
378  serial_problemParams.set("algorithm", "multijagged");
379  serial_problemParams.set("num_global_parts", numProcs);
380 
381  RCP<Zoltan2::Environment> env(
382  new Zoltan2::Environment(serial_problemParams, global_tcomm));
383  RCP<Zoltan2::TimerManager> timer(
384  new Zoltan2::TimerManager(global_tcomm, &std::cout,
386  env->setTimer(timer);
387 
388  //-------------------CREATE SERIAL INPUT ADAPTER-------------------------//
389  zscalar_t **partCenters;
390  zgno_t myTasks ;
391  // Create tpetra input graph
392  RCP<mytest_tcrsGraph_t> serial_tpetra_graph =
393  create_tpetra_input_matrix(nx, ny, nz, numProcs, serial_comm,
394  env, partCenters, myTasks);
395  RCP<const mytest_map_t> serial_map = serial_tpetra_graph->getMap();
396  global_tcomm->barrier();
397 
398  // Create input adapter from tpetra graph
399  env->timerStart(Zoltan2::MACRO_TIMERS, "AdapterCreate");
400  RCP<const mytest_tcrsGraph_t> const_tpetra_graph =
401  rcp_const_cast<const mytest_tcrsGraph_t>(serial_tpetra_graph);
402  RCP<mytest_adapter_t> ia (new mytest_adapter_t(const_tpetra_graph));
403 
404  // Create multivector for coordinates
405  RCP <Zoltan2::XpetraMultiVectorAdapter<mytest_tMVector_t>> serial_adapter =
406  create_multi_vector_adapter(serial_map, partCenters, myTasks);
407  ia->setCoordinateInput(serial_adapter.getRawPtr());
408  env->timerStop(Zoltan2::MACRO_TIMERS, "AdapterCreate");
409  global_tcomm->barrier();
410  //------------------SERIAL INPUT ADAPTER IS CREATED----------------------//
411 
412  // NOW, it only makes sense to map them serially. This is a case for the
413  // applications, where they already have the whole graph in all processes,
414  // and they want to do the mapping.
415  // Basically it will same time mapping algorithm, if that is the case.
416 
417  // First case from the distributed case does not really make sense and it
418  // is errornous.
419  // Zoltan partitioning algorithms require distributed input. One still can
420  // do that in two phases, but needs to make sure that distributed and
421  // serial input adapters matches correctly.
422 
423  // Second case does not make sense and errornous. All elements are within
424  // the same node and they should not be assumed to be in the same part,
425  // since it will result only a single part.
426 
427  // If input adapter is not distributed, we are only interested in the
428  // third case.
429  // Each element will be its own unique part at the beginning of the mapping.
430 
431  // For the third case we create our own solution and set unique parts to
432  // each element.
433  // Basically each element has its global id as part number.
434  // It global ids are same as local ids here because each processors owns
435  // the whole thing.
437  single_phase_mapping_solution(env, global_tcomm, 0);
438  Teuchos::ArrayView< const zgno_t> gids = serial_map->getLocalElementList();
439 
440  ArrayRCP<int> initial_part_ids(myTasks);
441  for (zgno_t i = 0; i < myTasks; ++i) {
442  initial_part_ids[i] = gids[i];
443  }
444  single_phase_mapping_solution.setParts(initial_part_ids);
445 
446  env->timerStart(Zoltan2::MACRO_TIMERS, "Problem Create");
447  // Create a mapping problem for the third case. We provide a solution in
448  // which all elements belong to unique part.
449  // Even the input is not distributed, we still provide the global_tcomm
450  // because processors will calculate different mappings and the best one
451  // will be chosen.
452 
454  ia.getRawPtr(), &serial_problemParams,
455  global_tcomm, &single_phase_mapping_solution);
456 
457  env->timerStop(Zoltan2::MACRO_TIMERS, "Problem Create");
458  // Solve mapping problem.
459 
460  env->timerStart(Zoltan2::MACRO_TIMERS, "Problem Solve");
461  serial_map_problem.solve(true);
462  env->timerStop(Zoltan2::MACRO_TIMERS, "Problem Solve");
463 
464  // Get the solution.
466  serial_map_problem.getSolution();
467 
468  timer->printAndResetToZero();
469 
470 // typedef Zoltan2::EvaluatePartition<my_adapter_t> quality_t;
472 
473  // Input is not distributed in this case.
474  // Metric object should be given the serial comm so that it can calculate
475  // the correct metrics without global communication.
476  RCP<quality_t> metricObject_3 =
477  rcp(new quality_t(ia.getRawPtr(),
478  &serial_problemParams, serial_comm,msoln3,
479  serial_map_problem.getMachine().getRawPtr()));
480 
481  if (global_tcomm->getRank() == 0) {
482  std::cout << "METRICS FOR THE SERIAL CASE - ONE PHASE MAPPING "
483  << "- EACH ELEMENT IS ASSUMED TO BE IN UNIQUE PART AT THE BEGINNING"
484  << std::endl;
485  metricObject_3->printMetrics(std::cout);
486  }
487 
488  for (int i = 0; i < 3; i++)
489  delete [] partCenters[i];
490  delete [] partCenters;
491 }
492 
493 int main(int narg, char *arg[]) {
494 
495  Tpetra::ScopeGuard tscope(&narg, &arg);
496  Teuchos::RCP<const Teuchos::Comm<int> > global_tcomm =
497  Tpetra::getDefaultComm();
498 
499  int nx = 16, ny = 16, nz = 16;
500  for (int i = 1 ; i < narg ; ++i) {
501  if (0 == strcasecmp(arg[i] , "NX")) {
502  nx = atoi( arg[++i] );
503  }
504  else if (0 == strcasecmp( arg[i] , "NY")) {
505  ny = atoi( arg[++i] );
506  }
507  else if (0 == strcasecmp( arg[i] , "NZ")) {
508  nz = atoi( arg[++i] );
509  }
510  else{
511  std::cerr << "Unrecognized command line argument #"
512  << i << ": " << arg[i] << std::endl ;
513  return 1;
514  }
515  }
516 
517  try{
518 
519  Teuchos::RCP<const Teuchos::Comm<int> > serial_comm =
520  Teuchos::createSerialComm<int>();
521  test_distributed_input_adapter(nx, ny, nz, global_tcomm);
522  test_serial_input_adapter(nx, ny, nz, global_tcomm);
523 
524 #if 0
525  {
526  part_t my_parts = 0, *my_result_parts;
527  //const part_t *local_element_to_rank = msoln1->getPartListView();
528 
529  std::cout << "me:" << global_tcomm->getRank()
530  << " my_parts:" << my_parts
531  << " myTasks:" << myTasks << std::endl;
532  if (global_tcomm->getRank() == 0) {
533 
534  //zscalar_t **dots = partCenters;
535  //int i = 0, j =0;
536  FILE *f2 = fopen("plot.gnuplot", "w");
537  for (int i = 0; i< global_tcomm->getSize(); ++i) {
538  char str[20];
539  sprintf(str, "coords%d.txt", i);
540  if (i == 0) {
541  fprintf(f2,"splot \"%s\"\n", str);
542  }
543  else {
544  fprintf(f2,"replot \"%s\"\n", str);
545  }
546  }
547  fprintf(f2,"pause-1\n");
548  fclose(f2);
549  }
550  char str[20];
551  int myrank = global_tcomm->getRank();
552  sprintf(str, "coords%d.txt", myrank);
553  FILE *coord_files = fopen(str, "w");
554 
555 
556  for (int j = 0; j < my_parts; ++j) {
557  int findex = my_result_parts[j];
558  std::cout << "findex " << findex << std::endl;
559  fprintf(coord_files, "%lf %lf %lf\n",
560  partCenters[0][findex],
561  partCenters[1][findex],
562  partCenters[2][findex]);
563  }
564  fclose(coord_files);
565  }
566 #endif
567 
568  if (global_tcomm->getRank() == 0) {
569  std::cout << "PASS" << std::endl;
570  }
571  }
572  catch(std::string &s) {
573  std::cerr << s << std::endl;
574  }
575 
576  catch(char * s) {
577  std::cerr << s << std::endl;
578  }
579 }
580 
RCP< Zoltan2::XpetraMultiVectorAdapter< mytest_tMVector_t > > create_multi_vector_adapter(RCP< const mytest_map_t > map, zscalar_t **partCenters, zgno_t myTasks)
Time an algorithm (or other entity) as a whole.
Zoltan2::XpetraCrsGraphAdapter< mytest_tcrsGraph_t, mytest_tMVector_t > mytest_adapter_t
MappingInputDistributution
Tpetra::CrsGraph< zlno_t, zgno_t, znode_t > mytest_tcrsGraph_t
PartitionMapping maps a solution or an input distribution to ranks.
void solve(bool updateInputData=true)
Direct the problem to create a solution.
mytest_adapter_t::part_t mytest_part_t
Provides access for Zoltan2 to Xpetra::CrsGraph data.
Zoltan2::EvaluatePartition< matrixAdapter_t > quality_t
int main(int narg, char **arg)
Definition: coloring1.cpp:164
common code used by tests
typename InputTraits< User >::part_t part_t
Tpetra::Map::node_type mytest_znode_t
void test_distributed_input_adapter(int nx, int ny, int nz, Teuchos::RCP< const Teuchos::Comm< int > > global_tcomm)
Tpetra::Map< zlno_t, zgno_t, mytest_znode_t > mytest_map_t
Defines the XpetraMultiVectorAdapter.
Defines XpetraCrsGraphAdapter class.
SparseMatrixAdapter_t::part_t part_t
void test_serial_input_adapter(int nx, int ny, int nz, Teuchos::RCP< const Teuchos::Comm< int > > global_tcomm)
A PartitioningSolution is a solution to a partitioning problem.
Defines the EvaluatePartition class.
The user parameters, debug, timing and memory profiling output objects, and error checking methods...
An adapter for Xpetra::MultiVector.
Tpetra::Map::local_ordinal_type zlno_t
void setParts(ArrayRCP< part_t > &partList)
The algorithm uses setParts to set the solution.
Tpetra::MultiVector< zscalar_t, zlno_t, zgno_t, znode_t > mytest_tMVector_t
Defines the MappingSolution class.
PartitioningProblem sets up partitioning problems for the user.
RCP< mytest_tcrsGraph_t > create_tpetra_input_matrix(int nx, int ny, int nz, int numProcs, Teuchos::RCP< const Teuchos::Comm< int > > tcomm, RCP< Zoltan2::Environment > env, zscalar_t **&partCenters, zgno_t &myTasks)
Defines the PartitioningProblem class.
MappingProblem enables mapping of a partition (either computed or input) to MPI ranks.
float zscalar_t
A class that computes and returns quality metrics.
Tpetra::Map::global_ordinal_type zgno_t
void solve(bool updateInputData=true)
Direct the problem to create a solution.
Declarations for TimerManager.
Defines the MappingProblem class.