54 #include <Teuchos_ParameterList.hpp> 55 #include <Teuchos_DefaultComm.hpp> 58 using Teuchos::ParameterEntry;
65 int rank = comm->getRank();
67 std::cerr <<
"Proc " << rank <<
" error: " << code << std::endl;
76 int main(
int argc,
char *argv[])
78 Teuchos::GlobalMPISession session(&argc, &argv);
79 Teuchos::RCP<const Comm<int> > comm =
80 Teuchos::DefaultComm<int>::getComm();
82 int rank = comm->getRank();
83 int nprocs = comm->getSize();
94 catch(std::exception &e){
95 std::cerr << e.what() << std::endl;
108 if (!
fail && defEnv->
comm_->getSize() != nprocs)
131 Teuchos::ParameterList myParams(
"testParameterList");
133 myParams.set(
"debug_level",
"detailed_status");
134 myParams.set(
"debug_procs",
"all");
135 myParams.set(
"debug_output_stream",
"std::cout");
138 myParams.set(
"memory_procs",
"0-1,3");
140 myParams.set(
"memory_procs",
"0");
142 myParams.set(
"memory_output_file",
"memInfo.txt");
144 myParams.set(
"partitioning_objective",
"minimize_cut_edge_weight");
145 myParams.set(
"imbalance_tolerance", 1.2);
152 catch(std::exception &e){
153 std::cerr << e.what() << std::endl;
161 catch(std::exception &e){
162 std::cerr << e.what() << std::endl;
169 env->
memory(
"Memory info");
170 env->
memory(
"Memory info next");
171 env->
memory(
"Memory info after");
173 catch(std::exception &e){
174 std::cerr << e.what() << std::endl;
188 if (!
fail && env->
comm_->getSize() != nprocs)
193 const ParameterEntry *dl = pl1.getEntryPtr(
"debug_level");
198 else if (!(dl->isType<
int>())){
203 int &val = dl->getValue<
int>(&value);
216 std::cout <<
"\nA test parameter list" << std::endl;
217 const Teuchos::ParameterList &envParams = env->
getParameters();
221 catch(std::exception &e){
222 std::cerr << e.what() << std::endl;
234 RCP<const Comm<int> > oldComm = env->
comm_;
237 Teuchos::ParameterList newParams = oldParams;
238 newParams.set(
"error_check_level",
"debug_mode_assertions");
239 newParams.remove(
"memory_output_file");
240 newParams.set(
"imbalance_tolerance", 1.05);
241 newParams.set(
"algorithm",
"phg");
242 newParams.set(
"partitioning_objective",
"minimize_cut_edge_weight");
244 RCP<Environment> newEnv;
247 newEnv = Teuchos::rcp(
new Environment(newParams, oldComm));
249 catch(std::exception &e){
250 std::cerr << e.what() << std::endl;
260 if (!
fail && rank==0){
261 std::cout <<
"\nA few changes/additions to the list" << std::endl;
262 const Teuchos::ParameterList &envParams = newEnv->getParameters();
266 catch(std::exception &e){
267 std::cerr << e.what() << std::endl;
278 std::cout <<
"PASS" << std::endl;
void memory(const char *msg) const
Print a message and the kilobytes in use by this process.
fast typical checks for valid arguments
Defines Parameter related enumerators, declares functions.
const Teuchos::ParameterList & getUnvalidatedParameters() const
Returns a const reference to the user's original list.
bool doMemoryProfiling() const
Return true if memory usage output was requested, even if this process is not printing out memory use...
void debug(MessageOutputLevel level, const char *msg) const
Send a message to the debug output manager.
common code used by tests
sub-steps, each method's entry and exit
int checkErrorCode(Teuchos::RCP< const Teuchos::Comm< int > > &comm, int code)
int numProcs_
number of processes (relative to comm_)
int myRank_
mpi rank (relative to comm_)
Comm_t comm_
communicator for environment
The user parameters, debug, timing and memory profiling output objects, and error checking methods...
static const std::string fail
the status at each high level step
#define TEST_FAIL_AND_RETURN_VALUE(comm, ok, s, rc)
Defines the Environment class.
int main(int argc, char *argv[])
bool doTiming() const
Return true if timing was requested, even if this process is not printing out timing messages...
const Teuchos::ParameterList & getParameters() const
Returns a reference to the user's parameter list.
bool doStatus() const
Return true if debug output was requested, even if this process is not printing out debug messages...
AssertionLevel errorCheckLevel_
level of error checking to do