33 #include <boost/algorithm/string/predicate.hpp>
118 msg <<
level1 <<
"-----------------------------------------------------------------\n";
119 msg <<
" Timing (dclock) results for " <<
Ippl::getNodes() <<
" nodes:" <<
"\n";
120 msg <<
"-----------------------------------------------------------------";
124 double walltotal = 0.0;
126 msg << tptr->name.c_str() <<
" ";
127 for (j=strlen(tptr->name.c_str()); j < 10; ++j)
129 msg <<
" Wall tot = ";
137 double wallmax = 0.0, wallmin = 0.0;
138 double wallavg = 0.0 ;
142 msg << tptr->name.c_str() <<
" ";
143 for (j=strlen(tptr->name.c_str()); j < 10; ++j)
145 msg <<
" Wall max = ";
147 msg << wallmax <<
"\n";
148 for (j = 0; j < 21; ++j)
150 msg <<
" Wall avg = ";
153 for (j = 0; j < 21; ++j)
155 msg <<
" Wall min = ";
157 msg << wallmin <<
"\n\n";
159 msg <<
"-----------------------------------------------------------------";
174 <<
"-----------------------------------------------------------------";
176 msg <<
" Timing results for " <<
Ippl::getNodes() <<
" nodes:" <<
"\n";
177 msg <<
"-----------------------------------------------------------------";
182 double walltotal = 0.0, cputotal = 0.0;
185 size_t lengthName =
std::min(tptr->
name.length(), 19lu);
186 msg << tptr->
name.substr(0,lengthName)
187 << std::string().assign(20 - lengthName,
'.')
188 <<
" Wall tot = " << std::setw(10) << walltotal <<
","
189 <<
" CPU tot = " << std::setw(10) << cputotal <<
"\n"
197 return boost::ilexicographical_compare(a->
name, b->
name);
200 for (
unsigned int i=1; i <
TimerList.size(); ++i) {
202 double wallmax = 0.0, cpumax = 0.0, wallmin = 0.0, cpumin = 0.0;
203 double wallavg = 0.0, cpuavg = 0.0;
210 size_t lengthName =
std::min(tptr->
name.length(), 19lu);
212 msg << tptr->
name.substr(0,lengthName)
213 << std::string().assign(20 - lengthName,
'.')
214 <<
" Wall max = " << std::setw(10) << wallmax <<
","
215 <<
" CPU max = " << std::setw(10) << cpumax <<
"\n"
216 << std::string().assign(20,
' ')
217 <<
" Wall avg = " << std::setw(10) << wallavg /
Ippl::getNodes() <<
","
218 <<
" CPU avg = " << std::setw(10) << cpuavg /
Ippl::getNodes() <<
"\n"
219 << std::string().assign(20,
' ')
220 <<
" Wall min = " << std::setw(10) << wallmin <<
","
221 <<
" CPU min = " << std::setw(10) << cpumin <<
"\n"
224 msg <<
"-----------------------------------------------------------------";
231 void Timing::print(
const std::string &fn,
const std::map<std::string, unsigned int> &problemSize) {
233 std::ofstream *timer_stream;
239 timer_stream =
new std::ofstream;
240 timer_stream->open( fn.c_str(), std::ios::out );
241 msg =
new Inform( 0, *timer_stream, 0 );
253 if (problemSize.size() > 0) {
254 *msg <<
"Problem size:\n";
255 for (
auto it: problemSize) {
256 *msg <<
" " << std::setw(10) << it.first <<
": " << it.second <<
"\n";
261 *msg << std::setw(27) <<
"num Nodes"
262 << std::setw(10) <<
"CPU tot"
263 << std::setw(11) <<
"Wall tot\n"
264 << std::string().assign(47,
'=')
268 double walltotal = 0.0, cputotal = 0.0;
271 size_t lengthName =
std::min(tptr->
name.length(), 19lu);
272 *msg << tptr->
name.substr(0,lengthName);
273 for (
int j=lengthName; j < 20; ++j) {
277 <<
" " << std::setw(9) << std::setprecision(4) << cputotal
278 <<
" " << std::setw(9) << std::setprecision(4) << walltotal
286 return boost::ilexicographical_compare(a->
name, b->
name);
290 << std::setw(27) <<
"num Nodes"
291 << std::setw(10) <<
"CPU max"
292 << std::setw(10) <<
"Wall max"
293 << std::setw(10) <<
"CPU min"
294 << std::setw(10) <<
"Wall min"
295 << std::setw(10) <<
"CPU avg"
296 << std::setw(11) <<
"Wall avg\n"
297 << std::string().assign(87,
'=')
299 for (
unsigned int i=0; i <
TimerList.size(); ++i) {
301 double wallmax = 0.0, cpumax = 0.0, wallmin = 0.0, cpumin = 0.0;
302 double wallavg = 0.0, cpuavg = 0.0;
309 size_t lengthName =
std::min(tptr->
name.length(), 19lu);
310 *msg << tptr->
name.substr(0,lengthName);
311 for (
int j=lengthName; j < 20; ++j) {
315 <<
" " << std::setw(9) << std::setprecision(4) << cpumax
316 <<
" " << std::setw(9) << std::setprecision(4) << wallmax
317 <<
" " << std::setw(9) << std::setprecision(4) << cpumin
318 <<
" " << std::setw(9) << std::setprecision(4) << wallmin
319 <<
" " << std::setw(9) << std::setprecision(4) << cpuavg /
Ippl::getNodes()
320 <<
" " << std::setw(9) << std::setprecision(4) << wallavg /
Ippl::getNodes()
323 timer_stream->close();
void startTimer(TimerRef)
static std::stack< Timing * > stashedInstance
void clearTimer(TimerRef)
bool reduce(Communicate &, InputIterator, InputIterator, OutputIterator, const ReduceOp &, bool *IncludeVal=0)
T * value_type(const SliceIterator< T > &)
TimerRef getTimer(const char *)
std::string::iterator iterator
Inform & level1(Inform &inf)
T::PETE_Expr_t::PETE_Return_t min(const PETE_Expr< T > &expr, NDIndex< D > &loc)
Inform & endl(Inform &inf)