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;
102 if (!fail && defEnv->
myRank_ != rank)
105 if (!fail && defEnv->
numProcs_ != nprocs)
108 if (!fail && defEnv->
comm_->getSize() != nprocs)
111 if (!fail && defEnv->
doStatus() !=
true)
114 if (!fail && defEnv->
doTiming() !=
false)
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(
"speed_versus_quality",
"speed");
145 myParams.set(
"memory_versus_speed",
"memory");
147 myParams.set(
"topology",
"2,6,6");
148 myParams.set(
"randomize_input",
"true");
149 myParams.set(
"partitioning_objective",
"minimize_cut_edge_weight");
150 myParams.set(
"imbalance_tolerance", 1.2);
157 catch(std::exception &e){
158 std::cerr << e.what() << std::endl;
166 catch(std::exception &e){
167 std::cerr << e.what() << std::endl;
174 env->
memory(
"Memory info");
175 env->
memory(
"Memory info next");
176 env->
memory(
"Memory info after");
178 catch(std::exception &e){
179 std::cerr << e.what() << std::endl;
187 if (!fail && env->
myRank_ != rank)
193 if (!fail && env->
comm_->getSize() != nprocs)
198 const ParameterEntry *dl = pl1.getEntryPtr(
"debug_level");
203 else if (!(dl->isType<
int>())){
208 int &val = dl->getValue<
int>(&value);
221 std::cout <<
"\nA test parameter list" << std::endl;
222 const Teuchos::ParameterList &envParams = env->
getParameters();
226 catch(std::exception &e){
227 std::cerr << e.what() << std::endl;
239 RCP<const Comm<int> > oldComm = env->
comm_;
242 Teuchos::ParameterList newParams = oldParams;
243 newParams.set(
"error_check_level",
"debug_mode_assertions");
244 newParams.set(
"memory_versus_speed",
"speed");
245 newParams.remove(
"memory_output_file");
246 newParams.set(
"imbalance_tolerance",
"1.05");
247 newParams.set(
"algorithm",
"phg");
248 newParams.set(
"partitioning_objective",
"minimize_cut_edge_weight");
250 RCP<Environment> newEnv;
253 newEnv = Teuchos::rcp(
new Environment(newParams, oldComm));
255 catch(std::exception &e){
256 std::cerr << e.what() << std::endl;
266 if (!fail && rank==0){
267 std::cout <<
"\nA few changes/additions to the list" << std::endl;
268 const Teuchos::ParameterList &envParams = newEnv->getParameters();
272 catch(std::exception &e){
273 std::cerr << e.what() << std::endl;
284 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.
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.
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...
AssertionLevel errorCheckLevel_
level of error checking to do