54#include <Teuchos_ParameterList.hpp>
55#include <Teuchos_DefaultComm.hpp>
58using Teuchos::ParameterEntry;
65 int rank = comm->getRank();
67 std::cerr <<
"Proc " << rank <<
" error: " << code << std::endl;
76int main(
int narg,
char *arg[])
78 Tpetra::ScopeGuard tscope(&narg, &arg);
79 Teuchos::RCP<const Teuchos::Comm<int> > comm = Tpetra::getDefaultComm();
81 int rank = comm->getRank();
82 int nprocs = comm->getSize();
93 catch(std::exception &e){
94 std::cerr << e.what() << std::endl;
107 if (!
fail && defEnv->
comm_->getSize() != nprocs)
130 Teuchos::ParameterList myParams(
"testParameterList");
132 myParams.set(
"debug_level",
"detailed_status");
133 myParams.set(
"debug_procs",
"all");
134 myParams.set(
"debug_output_stream",
"std::cout");
137 myParams.set(
"memory_procs",
"0-1,3");
139 myParams.set(
"memory_procs",
"0");
141 myParams.set(
"memory_output_file",
"memInfo.txt");
143 myParams.set(
"partitioning_objective",
"minimize_cut_edge_weight");
144 myParams.set(
"imbalance_tolerance", 1.2);
151 catch(std::exception &e){
152 std::cerr << e.what() << std::endl;
160 catch(std::exception &e){
161 std::cerr << e.what() << std::endl;
168 env->
memory(
"Memory info");
169 env->
memory(
"Memory info next");
170 env->
memory(
"Memory info after");
172 catch(std::exception &e){
173 std::cerr << e.what() << std::endl;
187 if (!
fail && env->
comm_->getSize() != nprocs)
192 const ParameterEntry *dl = pl1.getEntryPtr(
"debug_level");
197 else if (!(dl->isType<
int>())){
202 int &val = dl->getValue<
int>(&value);
215 std::cout <<
"\nA test parameter list" << std::endl;
216 const Teuchos::ParameterList &envParams = env->
getParameters();
220 catch(std::exception &e){
221 std::cerr << e.what() << std::endl;
233 RCP<const Comm<int> > oldComm = env->
comm_;
236 Teuchos::ParameterList newParams = oldParams;
237 newParams.set(
"error_check_level",
"debug_mode_assertions");
238 newParams.remove(
"memory_output_file");
239 newParams.set(
"imbalance_tolerance", 1.05);
240 newParams.set(
"algorithm",
"phg");
241 newParams.set(
"partitioning_objective",
"minimize_cut_edge_weight");
243 RCP<Environment> newEnv;
246 newEnv = Teuchos::rcp(
new Environment(newParams, oldComm));
248 catch(std::exception &e){
249 std::cerr << e.what() << std::endl;
259 if (!
fail && rank==0){
260 std::cout <<
"\nA few changes/additions to the list" << std::endl;
261 const Teuchos::ParameterList &envParams = newEnv->getParameters();
265 catch(std::exception &e){
266 std::cerr << e.what() << std::endl;
277 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