- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I usually use call CPU_TIME() to calculate the time of running a code so that I can compare the performances of my codes. Unfortunately, since now I start to use openmp in my code, I find the time returned by CPU_TIME() is the total time the 4 cores have used, instead of the total time the code runs. So is there any way to give me the actual time? It seems SYSTEM_CLOCK() or DATE_AND_TIME() work, but I do not know how.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
cpu_time() tries to give you the total CPU time of all threads. Sometimes, people ask for the average level of parallelism, which you get by dividing this by the elapsed time.
With system_clock(), you should use integer*8 in order to get adequate resolution and range.
The portable way is with omp_get_wtime() (but it will work only with the OpenMP compile switches). Typically, on linux systems, it's a wrapper for gettimeofday(), so there is no point in trying the latter, except as a way to make it work without OpenMP.
date_and_time() is fine if you simply want to display it. It's difficult to calculate intervals accurately.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
cpu_time() tries to give you the total CPU time of all threads. Sometimes, people ask for the average level of parallelism, which you get by dividing this by the elapsed time.
With system_clock(), you should use integer*8 in order to get adequate resolution and range.
The portable way is with omp_get_wtime() (but it will work only with the OpenMP compile switches). Typically, on linux systems, it's a wrapper for gettimeofday(), so there is no point in trying the latter, except as a way to make it work without OpenMP.
date_and_time() is fine if you simply want to display it. It's difficult to calculate intervals accurately.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Tim,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page