Using time.h and clock()

Using time.h and clock()

Hello, I'm using this function (clock() from time.h) in my program to get time spended to part of my job.

On local machine I have no problem with it (2x CPU, OS Windows 7, Intel Compiler \\ MSVCC), but when I try to run with it on PBS with qsub, I have bad values of time (f. ex. -0.0, -279.0 ... )

Is using this function not correct on this system?

2 帖子 / 0 全新
Mike Pearce (Intel)的头像

Not sure why you're seeing these values, but if you're using OpenMP, I would suggest that you use the OpenMP time function:

double start, end;
start = omp_get_wtime();

... Stuff to time

end = omp_get_wtime();
printf(" Took %f seconds.\n", end-start);