Skip to content
Snippets Groups Projects
Commit 7f56c6d1 authored by João Isler's avatar João Isler
Browse files

Improved Timer::PrintElapsedRegions function

parent d6f8045d
No related branches found
No related tags found
No related merge requests found
......@@ -154,34 +154,40 @@ void Timer::PrintElapsedRegions(LibUtilities::CommSharedPtr comm,
}
// write out all other timings order alphabetically on string
for (auto item = m_elapsedRegion.begin();
item != m_elapsedRegion.end(); ++item)
for (int i=0; i<=iolevel; i++)
{
if(std::get<2>(item->second) < iolevel)
for (auto item = m_elapsedRegion.begin();
item != m_elapsedRegion.end(); ++item)
{
if(boost::iequals(item->first,"Execute"))
if(std::get<2>(item->second) == i)
{
continue;
}
auto elapsedAve = std::get<0>(item->second).count();
comm->AllReduce(elapsedAve, LibUtilities::ReduceSum);
elapsedAve /= comm->GetSize();
auto elapsedMin = std::get<0>(item->second).count();
comm->AllReduce(elapsedMin, LibUtilities::ReduceMin);
auto elapsedMax = std::get<0>(item->second).count();
comm->AllReduce(elapsedMax, LibUtilities::ReduceMax);
if (comm->GetRank() == 0)
{
o << std::setw(widths[0]) << item->first
<< std::setw(widths[1]) << elapsedAve
<< std::setw(widths[2]) << elapsedMin
<< std::setw(widths[3]) << elapsedMax
<< std::setw(widths[4]) << std::get<1>(item->second) << '\n';
if(boost::iequals(item->first,"Execute"))
{
continue;
}
auto elapsedAve = std::get<0>(item->second).count();
comm->AllReduce(elapsedAve, LibUtilities::ReduceSum);
elapsedAve /= comm->GetSize();
auto elapsedMin = std::get<0>(item->second).count();
comm->AllReduce(elapsedMin, LibUtilities::ReduceMin);
auto elapsedMax = std::get<0>(item->second).count();
comm->AllReduce(elapsedMax, LibUtilities::ReduceMax);
if (comm->GetRank() == 0)
{
o << std::setw(widths[0]) << item->first
<< std::setw(widths[1]) << elapsedAve
<< std::setw(widths[2]) << elapsedMin
<< std::setw(widths[3]) << elapsedMax
<< std::setw(widths[4]) << std::get<1>(item->second) << '\n';
}
}
}
}
if (iolevel > 0 && comm->GetRank() == 0){
o << "-----| end of IO_Timer_Level=" << i << " |-----\n";
}
}
}
// static members init
std::map<std::string, std::tuple<Timer::Seconds, size_t, int>>
......
......@@ -77,7 +77,7 @@ class Timer
LIB_UTILITIES_EXPORT static void PrintElapsedRegions
(LibUtilities::CommSharedPtr comm,
std::ostream &o = std::cout,
int iolevel = 1);
int iolevel = 0);
/// \brief Returns amount of seconds per iteration in
/// a test with n iterations.
......
......@@ -75,7 +75,7 @@ int main(int argc, char *argv[])
{
int iolevel;
session->LoadParameter("IO_Timer_Level",iolevel,1);
session->LoadParameter("IO_Timer_Level",iolevel,0);
LibUtilities::Timer::PrintElapsedRegions(session->GetComm(),
std::cout, iolevel);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment