63#include <Teuchos_DefaultComm.hpp>
73int main(
int narg,
char *arg[])
75 Tpetra::ScopeGuard tscope(&narg, &arg);
76 Teuchos::RCP<const Teuchos::Comm<int> > comm = Tpetra::getDefaultComm();
78 int rank = comm->getRank();
79 int nprocs = comm->getSize();
88 bool iPrint = (rank%2 == 0);
89 bool someOnePrints =
true;
95 rank, iPrint, std::cout, someOnePrints,
string(
"units"), 10);
97 catch(std::exception &e){
109 std::cout <<
"\nThere are " << nprocs <<
" processes. ";
110 std::cout <<
"Even ranks only participate." << std::endl;
114 intmom->
print(
string(
"number of things"), 10);
115 intmom->
print(
string(
"number of other things"), 5);
117 catch(std::exception &e){
128 someOnePrints =
true;
134 rank, iPrint, std::cout, someOnePrints,
string(
"dollars"), 10);
136 catch(std::exception &e){
148 std::cout <<
"\nThere are " << nprocs <<
" processes. ";
149 std::cout <<
"All ranks participate." << std::endl;
153 floatmom->
print(
string(
"Price of things"), 10.10);
154 floatmom->
print(
string(
"Price of other things"), 25.25);
156 catch(std::exception &e){
166 iPrint = (rank == 0);
167 someOnePrints =
true;
170 std::ios_base::openmode flags = std::ios_base::out & std::ios_base::trunc;
172 std::ofstream outF(
"testMetricFile.txt", flags);
177 catch(std::exception &e){
184 std::cout <<
"\nThere are " << nprocs <<
" processes. ";
185 std::cout <<
"Rank zero only participates" << std::endl;
189 doublemom->
print(
string(
"Time to do something"),
191 doublemom->
print(
string(
"Time to do something else"),
194 catch(std::exception &e){
205 std::ifstream inF(
"testMetricFile.txt");
207 while (getline(inF, s)){
208 std::cout << s << std::endl;
211 system(
"rm testMetricFile.txt");
219 std::cout <<
"PASS" << std::endl;
#define TEST_FAIL_AND_EXIT(comm, ok, s, code)
Defines the MetricOutputManager class.
Defines Parameter related enumerators, declares functions.
common code used by tests
MetricOutputManager handles output of profiling messages.
bool getMetricsOn() const
Return true if any process outputs metrics.
void print(const std::string &msg, const T val)
Print a line of information.
static const std::string fail