A
anto.anish
Hi -
I have been using clock() for calculating CPU time and time() for
calculating Wall time. However, since time() does not provided milli/
microsecond accurancy, i started using gettimeofday() as below to
calculate walltime,
struct timeval tv1,tv2;
struct timezone tz1, tz2;
gettimeofday(&tv1,&tz1);
double time_start1 = (double) tv1.tv_sec + (double)tv1.tv_usec/
1000000.0;
//ALL ALGO PROCESSING HERE
gettimeofday(&tv2,&tz2);
double time_stop1 = (double) tv2.tv_sec + (double)tv2.tv_usec/
1000000.0;
LOGGER.info("BackgroundEstimationAlgoT Run WALL_TIME: %0.3f",(double)
(time_stop1 - time_start1));
Certain times, i have been noticing that WALLTIME calculated is lesser
than CPUTIME. I am not sure why ? Double checked the simple code,
nothing seems to be wrong in simple substraction. My understanding was
always WALLTIME(elapsed time) remains higher than CPUTIME(compute
time).
I test my application on a Linux cluster with 24 compute nodes.
Any pointers as to why is this happening ?
Thanks
Anish
I have been using clock() for calculating CPU time and time() for
calculating Wall time. However, since time() does not provided milli/
microsecond accurancy, i started using gettimeofday() as below to
calculate walltime,
struct timeval tv1,tv2;
struct timezone tz1, tz2;
gettimeofday(&tv1,&tz1);
double time_start1 = (double) tv1.tv_sec + (double)tv1.tv_usec/
1000000.0;
//ALL ALGO PROCESSING HERE
gettimeofday(&tv2,&tz2);
double time_stop1 = (double) tv2.tv_sec + (double)tv2.tv_usec/
1000000.0;
LOGGER.info("BackgroundEstimationAlgoT Run WALL_TIME: %0.3f",(double)
(time_stop1 - time_start1));
Certain times, i have been noticing that WALLTIME calculated is lesser
than CPUTIME. I am not sure why ? Double checked the simple code,
nothing seems to be wrong in simple substraction. My understanding was
always WALLTIME(elapsed time) remains higher than CPUTIME(compute
time).
I test my application on a Linux cluster with 24 compute nodes.
Any pointers as to why is this happening ?
Thanks
Anish