19#include <Teuchos_ParameterList.hpp>
20#include <Teuchos_DefaultComm.hpp>
23using Teuchos::ParameterEntry;
30 int rank = comm->getRank();
32 std::cerr <<
"Proc " << rank <<
" error: " << code << std::endl;
41int main(
int narg,
char *arg[])
43 Tpetra::ScopeGuard tscope(&narg, &arg);
44 Teuchos::RCP<const Teuchos::Comm<int> > comm = Tpetra::getDefaultComm();
46 int rank = comm->getRank();
47 int nprocs = comm->getSize();
58 catch(std::exception &e){
59 std::cerr << e.what() << std::endl;
72 if (!
fail && defEnv->
comm_->getSize() != nprocs)
95 Teuchos::ParameterList myParams(
"testParameterList");
97 myParams.set(
"debug_level",
"detailed_status");
98 myParams.set(
"debug_procs",
"all");
99 myParams.set(
"debug_output_stream",
"std::cout");
102 myParams.set(
"memory_procs",
"0-1,3");
104 myParams.set(
"memory_procs",
"0");
106 myParams.set(
"memory_output_file",
"memInfo.txt");
108 myParams.set(
"partitioning_objective",
"minimize_cut_edge_weight");
109 myParams.set(
"imbalance_tolerance", 1.2);
116 catch(std::exception &e){
117 std::cerr << e.what() << std::endl;
125 catch(std::exception &e){
126 std::cerr << e.what() << std::endl;
133 env->
memory(
"Memory info");
134 env->
memory(
"Memory info next");
135 env->
memory(
"Memory info after");
137 catch(std::exception &e){
138 std::cerr << e.what() << std::endl;
152 if (!
fail && env->
comm_->getSize() != nprocs)
157 const ParameterEntry *dl = pl1.getEntryPtr(
"debug_level");
162 else if (!(dl->isType<
int>())){
167 int &val = dl->getValue<
int>(&value);
180 std::cout <<
"\nA test parameter list" << std::endl;
181 const Teuchos::ParameterList &envParams = env->
getParameters();
185 catch(std::exception &e){
186 std::cerr << e.what() << std::endl;
198 RCP<const Comm<int> > oldComm = env->
comm_;
201 Teuchos::ParameterList newParams = oldParams;
202 newParams.set(
"error_check_level",
"debug_mode_assertions");
203 newParams.remove(
"memory_output_file");
204 newParams.set(
"imbalance_tolerance", 1.05);
205 newParams.set(
"algorithm",
"phg");
206 newParams.set(
"partitioning_objective",
"minimize_cut_edge_weight");
208 RCP<Environment> newEnv;
211 newEnv = Teuchos::rcp(
new Environment(newParams, oldComm));
213 catch(std::exception &e){
214 std::cerr << e.what() << std::endl;
224 if (!
fail && rank==0){
225 std::cout <<
"\nA few changes/additions to the list" << std::endl;
226 const Teuchos::ParameterList &envParams = newEnv->getParameters();
230 catch(std::exception &e){
231 std::cerr << e.what() << std::endl;
242 std::cout <<
"PASS" << std::endl;
int checkErrorCode(Teuchos::RCP< const Teuchos::Comm< int > > &comm, int code)
#define TEST_FAIL_AND_RETURN_VALUE(comm, ok, s, rc)
Defines the Environment class.
Defines Parameter related enumerators, declares functions.
common code used by tests
The user parameters, debug, timing and memory profiling output objects, and error checking methods.
int myRank_
mpi rank (relative to comm_)
const Teuchos::ParameterList & getParameters() const
Returns a reference to the user's parameter list.
void debug(MessageOutputLevel level, const char *msg) const
Send a message to the debug output manager.
bool doTiming() const
Return true if timing was requested, even if this process is not printing out timing messages.
Comm_t comm_
communicator for environment
const Teuchos::ParameterList & getUnvalidatedParameters() const
Returns a const reference to the user's original list.
int numProcs_
number of processes (relative to comm_)
bool doStatus() const
Return true if debug output was requested, even if this process is not printing out debug messages.
void memory(const char *msg) const
Print a message and the kilobytes in use by this process.
AssertionLevel errorCheckLevel_
level of error checking to do
bool doMemoryProfiling() const
Return true if memory usage output was requested, even if this process is not printing out memory use...
static const std::string fail
@ BASIC_STATUS
the status at each high level step
@ DETAILED_STATUS
sub-steps, each method's entry and exit
@ BASIC_ASSERTION
fast typical checks for valid arguments
@ DEBUG_MODE_ASSERTION
checks for logic errors