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 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;
101 if (!fail && defEnv->
myRank_ != rank)
104 if (!fail && defEnv->
numProcs_ != nprocs)
107 if (!fail && defEnv->
comm_->getSize() != nprocs)
110 if (!fail && defEnv->
doStatus() !=
true)
113 if (!fail && defEnv->
doTiming() !=
false)
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;
181 if (!fail && env->
myRank_ != rank)
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;
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...
fast typical checks for valid arguments
Defines Parameter related enumerators, declares functions.
int main(int narg, char *arg[])
common code used by tests
bool doMemoryProfiling() const
Return true if memory usage output was requested, even if this process is not printing out memory use...
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_)
void debug(MessageOutputLevel level, const char *msg) const
Send a message to the debug output manager.
int myRank_
mpi rank (relative to comm_)
Comm_t comm_
communicator for environment
const Teuchos::ParameterList & getUnvalidatedParameters() const
Returns a const reference to the user's original list.
void memory(const char *msg) const
Print a message and the kilobytes in use by this process.
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.
bool doTiming() const
Return true if timing was requested, even if this process is not printing out timing messages...
AssertionLevel errorCheckLevel_
level of error checking to do