13 #include <Zoltan2_config.h>
16 #include <Teuchos_ParameterList.hpp>
17 #include <Teuchos_DefaultComm.hpp>
18 #include <Teuchos_Array.hpp>
19 #include <Teuchos_ParameterEntryValidator.hpp>
23 int main(
int narg,
char *arg[])
25 Tpetra::ScopeGuard tscope(&narg, &arg);
26 Teuchos::RCP<const Teuchos::Comm<int> > comm = Tpetra::getDefaultComm();
28 int rank = comm->getRank();
35 Teuchos::ParameterList validParameters;
37 Teuchos::ParameterList myParams(
"testParameterList");
39 myParams.set(
"debug_level",
"detailed_status");
40 myParams.set(
"debug_procs",
"all");
41 myParams.set(
"debug_output_stream",
"std::cout");
43 myParams.set(
"timer_output_file",
"appPerformance.txt");
53 myParams.validateParametersAndSetDefaults(validParameters);
55 catch(std::exception &e){
56 std::cerr <<
"Validate parameters generated an error:" << std::endl;
57 std::cerr << e.what() << std::endl;
58 std::cerr <<
"FAIL" << std::endl;
62 validParameters = Teuchos::ParameterList();
64 std::cout << std::endl;
65 std::cout <<
"A few parameters after validation: " << std::endl;
66 std::cout << myParams << std::endl;
69 std::cout <<
"debug_procs translation: ";
71 std::cout << std::endl;
76 Teuchos::ParameterList faultyParams(
"badParameterList");
77 faultyParams.set(
"debug_procs",
"not-even-remotely-an-integer-range");
81 faultyParams.validateParametersAndSetDefaults(validParameters);
83 catch(std::exception &e){
84 std::cout << std::endl;
85 std::cout <<
"Invalid parameter correctly generated an error:" << std::endl;
86 std::cout << e.what() << std::endl;
90 validParameters = Teuchos::ParameterList();
93 std::cerr <<
"Bad parameter was not detected in parameter list." << std::endl;
99 Teuchos::ParameterList all(
"setAllParametersList");
100 all.set(
"debug_level",
"basic_status");
102 all.set(
"debug_procs",
"1,2,5-10,2");
103 all.set(
"memory_procs",
"1,2,3,4,all");
105 all.set(
"debug_output_stream",
"std::cerr");
106 all.set(
"timer_output_stream",
"std::cout");
107 all.set(
"memory_output_stream",
"/dev/null");
110 all.set(
"debug_output_file",
"/home/me/debug.txt");
111 all.set(
"timer_output_file",
"/home/me/performance.txt");
112 all.set(
"memory_output_file",
"/home/me/memoryUsed.txt");
114 all.set(
"error_check_level",
"basic_assertions");
116 all.set(
"partitioning_objective",
"minimize_cut_edge_weight");
118 all.set(
"imbalance_tolerance", 1.2);
120 all.set(
"num_global_parts", 12);
121 all.set(
"num_local_parts", 2);
123 all.set(
"partitioning_approach",
"partition");
125 all.set(
"objects_to_partition",
"graph_vertices");
127 all.set(
"model",
"hypergraph");
129 all.set(
"algorithm",
"phg");
131 all.set(
"symmetrize_input",
"no");
132 all.set(
"subset_graph",
false);
136 all.validateParametersAndSetDefaults(validParameters);
138 catch(std::exception &e){
139 std::cerr <<
"Validate parameters generated an error:" << std::endl;
140 std::cerr << e.what() << std::endl;
141 std::cerr <<
"FAIL" << std::endl;
145 std::cout << std::endl;
146 std::cout <<
"All parameters validated and modified: ";
147 std::cout << all << std::endl;
150 std::cout <<
"debug_procs translation: ";
152 std::cout << std::endl;
155 std::cout <<
"memory_procs translation: ";
157 std::cout << std::endl;
161 std::cout << std::endl;
162 std::cout <<
"Parameter documentation:" << std::endl;
165 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.
int main(int narg, char **arg)
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.