15 #include <Zoltan2_config.h>
25 typedef Tpetra::MultiVector<zscalar_t, zlno_t, zgno_t, znode_t>
tMVector_t;
38 const RCP<
const Teuchos::Comm<int> > & comm,
44 int me = comm->getRank();
46 std::cout <<
"Parallel partitioning of " << filename <<
".mtx: "
47 << nParts <<
" parts." << std::endl;
49 std::string
fname(filename);
54 std::cout <<
"Multivector length = " << coords->getGlobalLength()
55 <<
" Num vectors = " << coords->getNumVectors() << std::endl;
57 RCP<const tMVector_t> coordsConst = rcp_const_cast<
const tMVector_t>(coords);
60 inputAdapter_t ia(coordsConst);
62 std::cout <<
"Adapter constructed" << std::endl;
64 Teuchos::ParameterList params(
"test params");
65 params.set(
"debug_level",
"basic_status");
66 params.set(
"num_global_parts", nParts);
67 params.set(
"algorithm",
"rcb");
68 params.set(
"imbalance_tolerance", 1.1);
69 if (doRemap) params.set(
"remap_parts",
true);
71 #ifdef HAVE_ZOLTAN2_MPI
78 std::cout <<
"Problem constructed" << std::endl;
83 std::cout <<
"Problem solved" << std::endl;
91 std::cout <<
"Serial partitioning: " << numParts <<
" parts." << std::endl;
95 throw std::bad_alloc();
96 for (
int i=0; i < numCoords; i++)
98 ArrayRCP<zgno_t> globalIds(ids, 0, numCoords,
true);
100 Array<ArrayRCP<zscalar_t> > randomCoords(3);
102 randomCoords.view(0,3));
106 inputAdapter_t ia(numCoords, ids,
107 randomCoords[0].getRawPtr(), randomCoords[1].getRawPtr(),
108 randomCoords[2].getRawPtr(), 1,1,1);
110 Teuchos::ParameterList params(
"test params");
111 params.set(
"debug_level",
"basic_status");
112 params.set(
"num_global_parts", numParts);
113 params.set(
"algorithm",
"rcb");
114 params.set(
"imbalance_tolerance", 1.1);
115 if (doRemap) params.set(
"remap_parts",
true);
117 #ifdef HAVE_ZOLTAN2_MPI
119 &ia, ¶ms, MPI_COMM_SELF);
124 serialProblem.
solve();
132 UserInputForTests uinput(xdim, ydim, zdim,
string(
"Laplace3D"), comm,
true,
true);
136 size_t localCount = coords->getLocalLength();
139 x = coords->getDataNonConst(0).getRawPtr();
140 y = coords->getDataNonConst(1).getRawPtr();
141 z = coords->getDataNonConst(2).getRawPtr();
143 const zgno_t *globalIds = coords->getMap()->getLocalElementList().getRawPtr();
146 inputAdapter_t ia(localCount, globalIds, x, y, z, 1, 1, 1);
148 Teuchos::ParameterList params(
"test params");
149 params.set(
"rectilinear",
true);
151 #ifdef HAVE_ZOLTAN2_MPI
160 int main(
int narg,
char *arg[])
162 Tpetra::ScopeGuard tscope(&narg, &arg);
163 Teuchos::RCP<const Teuchos::Comm<int> > tcomm = Tpetra::getDefaultComm();
165 int rank = tcomm->getRank();
166 int nParts = tcomm->getSize();
167 bool doRemap =
false;
168 string filename =
"USAir97";
171 Teuchos::CommandLineProcessor cmdp (
false,
false);
172 cmdp.setOption(
"file", &filename,
"Name of the Matrix Market file to read");
173 cmdp.setOption(
"nparts", &nParts,
"Number of parts.");
174 cmdp.setOption(
"remap",
"no-remap", &doRemap,
"Remap part numbers.");
175 cmdp.parse(narg, arg);
185 std::cout <<
"PASS" << std::endl;
void meshCoordinatesTest(const RCP< const Teuchos::Comm< int > > &comm)
int main(int narg, char **arg)
Defines the PartitioningSolution class.
common code used by tests
Defines the XpetraMultiVectorAdapter.
int testFromDataFile(RCP< const Teuchos::Comm< int > > &comm, int numTeams, int numParts, float imbalance, std::string fname, std::string pqParts, std::string pfname, int k, int migration_check_option, int migration_all_to_all_type, zscalar_t migration_imbalance_cut_off, int migration_processor_assignment_type, int migration_doMigration_type, bool uvm, bool print_details, bool test_boxes, bool rectilinear, int mj_premigration_option, int mj_premigration_coordinate_cutoff)
Zoltan2::BasicUserTypes< zscalar_t, zlno_t, zgno_t > myTypes_t
BasicVectorAdapter represents a vector (plus optional weights) supplied by the user as pointers to st...
An adapter for Xpetra::MultiVector.
PartitioningProblem sets up partitioning problems for the user.
void serialTest(int numParts, bool doRemap)
Defines the PartitioningProblem class.
Defines the BasicVectorAdapter class.
Tpetra::MultiVector< zscalar_t, zlno_t, zgno_t, znode_t > tMVector_t
Tpetra::Map::global_ordinal_type zgno_t
void solve(bool updateInputData=true)
Direct the problem to create a solution.
std::string testDataFilePath(".")