- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does anyone have experience with timing code processes (non-threaded) using System_Clock?
As described (Fortran 95/2003 Explained, Metcalf et al), it looks like System_Clock would be the preferred way to go, but the CPU_Time seems to be more in line with the "clock time" on the computer.
Any hints on articles (search on the forum didn't show much) that I should look at?
As described (Fortran 95/2003 Explained, Metcalf et al), it looks like System_Clock would be the preferred way to go, but the CPU_Time seems to be more in line with the "clock time" on the computer.
Any hints on articles (search on the forum didn't show much) that I should look at?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Certainly, system_clock() is useful when you want elapsed time. On linux, a generally implemented way of taking advantage of the f2003 requirement to allow big integer arguments (kind=8) is to have system_clock give microsecond resolution as well as supporting reasonably long intervals. Support for Fortran 2003 guarantees only that the big integers are acceptable, not that they necessarily work better than default integers. Maybe Windows Fortran could adopt this improvement soon.
cpu_time totals up the time spent by the CPU on your application only among all threads. Yes, it's effectively the same as the C library clock() function. In ifort, it has 0.01 second resolution, so it can't time smaller intervals. It may be interesting to compare cpu_time against system_clock to see what effective parallelism you achieve in a parallelized application, or how much time is idle or taken by tasks outside your application.
The primary alternatives for elapsed time would be omp_get_wtime(), for an application using OpenMP library, or MPI_Wtime, when using MPI library.
Unfortunately, several articles easily found by your search engine (even Wikipedia) may mislead you about implementation details.
cpu_time totals up the time spent by the CPU on your application only among all threads. Yes, it's effectively the same as the C library clock() function. In ifort, it has 0.01 second resolution, so it can't time smaller intervals. It may be interesting to compare cpu_time against system_clock to see what effective parallelism you achieve in a parallelized application, or how much time is idle or taken by tasks outside your application.
The primary alternatives for elapsed time would be omp_get_wtime(), for an application using OpenMP library, or MPI_Wtime, when using MPI library.
Unfortunately, several articles easily found by your search engine (even Wikipedia) may mislead you about implementation details.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page