- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I want to find the run time fora section of program in microseconds. Iput call date_and_time(data,time1)
and data_and_time(data,time2) at the beginning and the end of this section.
I know time1(8:10) and time2 (8:10) is the microseconds of the clock. Since this section is inside of a do loop, I want to calculate the total timewithin this session from the complete do loop.
How can I get time calculation with something like
t = t+ time2(8:10) - time1(8:10) if I set t = 0. outside of the do loop? In other words, how do I convert the character into integer here?
Thanks.
I want to find the run time fora section of program in microseconds. Iput call date_and_time(data,time1)
and data_and_time(data,time2) at the beginning and the end of this section.
I know time1(8:10) and time2 (8:10) is the microseconds of the clock. Since this section is inside of a do loop, I want to calculate the total timewithin this session from the complete do loop.
How can I get time calculation with something like
t = t+ time2(8:10) - time1(8:10) if I set t = 0. outside of the do loop? In other words, how do I convert the character into integer here?
Thanks.
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You could do the following (read up on "internal files" in a Fortran book):
[fortran] real :: t1,t2 ... call date_and_time (data,time1) ... ... call date_and_time (data,time2) read(time1,123)t1 read(time2,123)t2 123 format(F10.3) t_run = t2 - t1[/fortran]Note, however, that it may be more appropriate for you to call CPU_TIME rather than using the wall-clock time as you have done, especially if you are using a multi-user/multi-process OS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For wall-clock time, system_clock() may be more appropriate, although the resolution for Intel Windows compiler is limited to 60 Hz.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Then it would be useful to know how to change it, and why it doesn't just work as it does for linux.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
An easy way to do this is to build with OpenMP enabled (you do not need to use OpenMP within the application). add use omp_lib then
real(8) :: T1
...
T1 = OMP_GET_WTIME()
Returns a double-precision value equal to the elapsed wallclock time (in seconds) relative to an arbitrary reference time.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In fact, Jim's suggestion is the way I do it for Windows, although I could get somewhat better results on most machines with QueryPerformance.

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