Difference between "ExecutionTime" and "ClockTime"
Dear all,
A small question, what is the difference between "ExecutionTime" and "ClockTime"? I can get these lins from icoFoam.C, Code:
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" Quote:
Thanks in advance for any reply. |
|
Hi,
I'm not an expert but here's what I think, 1) There isn't much to add there, the ExecutionTime is the time spent by the processor and the ClockTime is the wall clock time or "real" time if you prefer. 2 & 3) There is an interest because a significative difference between the ExecutionTime and the ClockTime is a sign of a slow calculation. The difference can be explained by the time when a file is being written or when there is communication between processors in a parallel run. Using a computer with a slow interconnect or not enough cells per processor can cause a difference in cpu and clock time. Hope that helps |
Quote:
I noticed this is your first two posts on the forum, and they are so helpful, thank you. |
Quote:
Have you found the answer to your 4th question? Thanks! Wei |
Quote:
I had the same question and search a bit through the code. It does not seem quite simple to do, or at least if it is I have not found how. I think you would have to change the main code of OpenFOAM (I've looked at the .com version, pimpleFoam solver) or some of the principal libraries. Here's my analysis, please jump in if you know more! In the solver you call Code:
runTime.printExecutionTime(Info); Code:
elapsedClockTime Code:
elapsedCpuTime elapsedCpuTime relies on the diff function which returns a scalar (double) coming from the C++ difftime function and elapsedClockTime relies directly on the C++ difftime function. So the difference actually comes from the type of the arguments to the difftime function. For clockTime C++ time_t type is used and is in seconds. For cpuTime the call is to std::clock which returns a "processor time" which is no longer an integer. The solution would be to somehow modify/rewrite the call from getTime to use chrono, something as what is given in here: https://stackoverflow.com/questions/...d-part-of-time |
improve the precision of the excutive time
Quote:
"Starts timing and returns elapsed time from start. Uses std::chrono::high_resolution_clock for better resolution (2uSec instead of ~20mSec) than cpuTime. " So the code would be like: Code:
#include "clockTime.H" |
All times are GMT -4. The time now is 20:57. |