48 #include <Zoltan2_config.h> 51 #include <Teuchos_ParameterList.hpp> 52 #include <Teuchos_DefaultComm.hpp> 53 #include <Teuchos_Array.hpp> 54 #include <Teuchos_ParameterEntryValidator.hpp> 58 int main(
int argc,
char *argv[])
60 Teuchos::GlobalMPISession session(&argc, &argv);
61 Teuchos::RCP<const Teuchos::Comm<int> > comm =
62 Teuchos::DefaultComm<int>::getComm();
64 int rank = comm->getRank();
71 Teuchos::ParameterList validParameters;
73 Teuchos::ParameterList myParams(
"testParameterList");
75 myParams.set(
"debug_level",
"detailed_status");
76 myParams.set(
"debug_procs",
"all");
77 myParams.set(
"debug_output_stream",
"std::cout");
79 myParams.set(
"timer_output_file",
"appPerformance.txt");
89 myParams.validateParametersAndSetDefaults(validParameters);
92 catch(std::exception &e){
93 std::cerr <<
"Validate parameters generated an error:" << std::endl;
94 std::cerr << e.what() << std::endl;
95 std::cerr <<
"FAIL" << std::endl;
99 validParameters = Teuchos::ParameterList();
101 std::cout << std::endl;
102 std::cout <<
"A few parameters after validation: " << std::endl;
103 std::cout << myParams << std::endl;
106 std::cout <<
"debug_procs translation: ";
108 std::cout << std::endl;
113 Teuchos::ParameterList faultyParams(
"badParameterList");
114 faultyParams.set(
"debug_procs",
"not-even-remotely-an-integer-range");
118 faultyParams.validateParametersAndSetDefaults(validParameters);
120 catch(std::exception &e){
121 std::cout << std::endl;
122 std::cout <<
"Invalid parameter correctly generated an error:" << std::endl;
123 std::cout << e.what() << std::endl;
127 validParameters = Teuchos::ParameterList();
130 std::cerr <<
"Bad parameter was not detected in parameter list." << std::endl;
136 Teuchos::ParameterList all(
"setAllParametersList");
137 all.set(
"debug_level",
"basic_status");
139 all.set(
"debug_procs",
"1,2,5-10,2");
140 all.set(
"memory_procs",
"1,2,3,4,all");
142 all.set(
"debug_output_stream",
"std::cerr");
143 all.set(
"timer_output_stream",
"std::cout");
144 all.set(
"memory_output_stream",
"/dev/null");
147 all.set(
"debug_output_file",
"/home/me/debug.txt");
148 all.set(
"timer_output_file",
"/home/me/performance.txt");
149 all.set(
"memory_output_file",
"/home/me/memoryUsed.txt");
151 all.set(
"speed_versus_quality",
"speed");
152 all.set(
"memory_versus_speed",
"memory");
154 all.set(
"error_check_level",
"basic_assertions");
156 all.set(
"random_seed", .12121212);
158 all.set(
"topology",
"2,6,6");
160 all.set(
"randomize_input",
"true");
162 all.set(
"partitioning_objective",
"minimize_cut_edge_weight");
164 all.set(
"imbalance_tolerance", 1.2);
166 all.set(
"num_global_parts", 12);
167 all.set(
"num_local_parts", 2);
169 all.set(
"partitioning_approach",
"partition");
171 all.set(
"objects_to_partition",
"graph_vertices");
173 all.set(
"model",
"hypergraph");
175 all.set(
"algorithm",
"phg");
177 all.set(
"symmetrize_input",
"no");
178 all.set(
"subset_graph",
"false");
182 all.validateParametersAndSetDefaults(validParameters);
185 catch(std::exception &e){
186 std::cerr <<
"Validate parameters generated an error:" << std::endl;
187 std::cerr << e.what() << std::endl;
188 std::cerr <<
"FAIL" << std::endl;
192 std::cout << std::endl;
193 std::cout <<
"All parameters validated and modified: ";
194 std::cout << all << std::endl;
197 std::cout <<
"debug_procs translation: ";
199 std::cout << std::endl;
202 std::cout <<
"memory_procs translation: ";
204 std::cout << std::endl;
208 std::cout << std::endl;
209 std::cout <<
"Parameter documentation:" << std::endl;
212 std::cout <<
"PASS" << std::endl;
void createValidatorList(const Teuchos::ParameterList &plIn, Teuchos::ParameterList &plOut)
Create a list by adding validators to the users parameter list.
static void convertStringToInt(Teuchos::ParameterList ¶ms)
Convert parameters of type Teuchos::StringToIntegralParameterEntryValidator<int> to integer...
void printListDocumentation(const Teuchos::ParameterList &pl, std::ostream &os, std::string listNames)
Teuchos::Array< int > rangeList_t
Define IntegerRangeList validator.
Defines the Environment class.
void printIntegralRangeList(std::ostream &os, Teuchos::Array< Integral > &irl)
A helper function that prints the meaning of an encoded integer range list.
int main(int argc, char *argv[])