51 #include <Zoltan2_config.h>
61 typedef Tpetra::MultiVector<zscalar_t, zlno_t, zgno_t, znode_t>
tMVector_t;
74 const RCP<
const Teuchos::Comm<int> > & comm,
80 int me = comm->getRank();
82 std::cout <<
"Parallel partitioning of " << filename <<
".mtx: "
83 << nParts <<
" parts." << std::endl;
85 std::string fname(filename);
90 std::cout <<
"Multivector length = " << coords->getGlobalLength()
91 <<
" Num vectors = " << coords->getNumVectors() << std::endl;
93 RCP<const tMVector_t> coordsConst = rcp_const_cast<
const tMVector_t>(coords);
96 inputAdapter_t ia(coordsConst);
98 std::cout <<
"Adapter constructed" << std::endl;
100 Teuchos::ParameterList params(
"test params");
101 params.set(
"debug_level",
"basic_status");
102 params.set(
"num_global_parts", nParts);
103 params.set(
"algorithm",
"rcb");
104 params.set(
"imbalance_tolerance", 1.1);
105 if (doRemap) params.set(
"remap_parts",
true);
107 #ifdef HAVE_ZOLTAN2_MPI
114 std::cout <<
"Problem constructed" << std::endl;
119 std::cout <<
"Problem solved" << std::endl;
124 int numCoords = 1000;
127 std::cout <<
"Serial partitioning: " << numParts <<
" parts." << std::endl;
131 throw std::bad_alloc();
132 for (
int i=0; i < numCoords; i++)
134 ArrayRCP<zgno_t> globalIds(ids, 0, numCoords,
true);
136 Array<ArrayRCP<zscalar_t> > randomCoords(3);
138 randomCoords.view(0,3));
142 inputAdapter_t ia(numCoords, ids,
143 randomCoords[0].getRawPtr(), randomCoords[1].getRawPtr(),
144 randomCoords[2].getRawPtr(), 1,1,1);
146 Teuchos::ParameterList params(
"test params");
147 params.set(
"debug_level",
"basic_status");
148 params.set(
"num_global_parts", numParts);
149 params.set(
"algorithm",
"rcb");
150 params.set(
"imbalance_tolerance", 1.1);
151 if (doRemap) params.set(
"remap_parts",
true);
153 #ifdef HAVE_ZOLTAN2_MPI
155 &ia, ¶ms, MPI_COMM_SELF);
160 serialProblem.
solve();
168 UserInputForTests uinput(xdim, ydim, zdim,
string(
"Laplace3D"), comm,
true,
true);
172 size_t localCount = coords->getLocalLength();
175 x = coords->getDataNonConst(0).getRawPtr();
176 y = coords->getDataNonConst(1).getRawPtr();
177 z = coords->getDataNonConst(2).getRawPtr();
179 const zgno_t *globalIds = coords->getMap()->getNodeElementList().getRawPtr();
182 inputAdapter_t ia(localCount, globalIds, x, y, z, 1, 1, 1);
184 Teuchos::ParameterList params(
"test params");
185 params.set(
"rectilinear",
true);
187 #ifdef HAVE_ZOLTAN2_MPI
196 int main(
int narg,
char *arg[])
198 Tpetra::ScopeGuard tscope(&narg, &arg);
199 Teuchos::RCP<const Teuchos::Comm<int> > tcomm = Tpetra::getDefaultComm();
201 int rank = tcomm->getRank();
202 int nParts = tcomm->getSize();
203 bool doRemap =
false;
204 string filename =
"USAir97";
207 Teuchos::CommandLineProcessor cmdp (
false,
false);
208 cmdp.setOption(
"file", &filename,
"Name of the Matrix Market file to read");
209 cmdp.setOption(
"nparts", &nParts,
"Number of parts.");
210 cmdp.setOption(
"remap",
"no-remap", &doRemap,
"Remap part numbers.");
211 cmdp.parse(narg, arg);
221 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
Zoltan2::BasicUserTypes< zscalar_t, zlno_t, zgno_t > myTypes_t
Defines the XpetraMultiVectorAdapter.
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.
int testFromDataFile(RCP< const Teuchos::Comm< int > > &comm, 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 test_boxes, bool rectilinear, int mj_premigration_option, int mj_premigration_coordinate_cutoff)
Defines the BasicVectorAdapter class.
void solve(bool updateInputData=true)
Direct the problem to create a solution.
std::string testDataFilePath(".")