- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI,
I would like to know the CPU time and I should call it in my script
specify the call to the system subroutine to learn CPU time
SUBROUTINE TIMEL(TRES)
************************************************************
* Returns CPU time. *
************************************************************
REAL*8 TRES,TRES0
INTRINSIC SYSTEM_CLOCK
C EXTERNAL CPSEC
SAVE IF,TRES0,IRES0
DATA IF/0/
* THIS IS THE <> CALL TO LEARN CPU TIME
C TRES=MCLOCK()/100.d0
C RETURN
* THIS IS THE <> CALL TO LEARN CPU TIME
C CALL DCLOCK@(TRES)
C IF(IF.EQ.0)TRES0=TRES
C IF=1
C TRES=TRES-TRES0
C RETURN
* THIS IS INTRINSIC PROCEDURE IN FORTRAN<90>
C IF(IF.EQ.0)CALL SYSTEM_CLOCK(IRES0,IRESR,IRESM)
C IF=1
C CALL SYSTEM_CLOCK(IRES,IRESR,IRESM)
C TRES=DBLE(IRES-IRES0)/DBLE(IRESR)
* THIS IS THE MICROSOFT FORTRAN POWER STATION CALL
C IF(IF.EQ.0)TRES0=CPSEC()
C TRES=CPSEC()
C TRES=TRES-TRES0
C IF=1
TRES=0.D0
END
this is the script and where should I specify the call
Pl advice me
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[bash] SUBROUTINE TIMEL(TRES) ************************************************************ * Returns CPU time. Fortran 9X version * ************************************************************ REAL*8 TRES,TRES0 SAVE IF,TRES0,IRES0 DATA IF/0/ * THIS IS INTRINSIC PROCEDURE IN FORTRAN<90> IF(IF.EQ.0)CALL SYSTEM_CLOCK(IRES0,IRESR,IRESM) IF=1 CALL SYSTEM_CLOCK(IRES,IRESR,IRESM) TRES=DBLE(IRES-IRES0)/DBLE(IRESR) END [/bash]
Link Copied
10 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The piece of program already tells you how to do it, after each * line there is the code for doing what you want, you just have to uncomment it (remove the initial "C" of each line).
In what architecture will you running this program?
In what architecture will you running this program?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Reis,
I would like to run this on a 32 bit architecture and my processor speed is 2.93 Ghz. So how should I specify
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You might take into account that system_clock() works much better with 64-bit integers. One more reason for explicit declarations.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HOw can I able to specify 64 bit when my system architecture is 32-bit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You choose the 35 year old non-standard way of specifying 64-bit real, if you choose to be further non-standard you can so the same with integer (integer*8), or you can adopt the way which came in together with system_clock:
integer(selected_int_kind(12)) :: ires0,iresr,iresm,ires
integer(selected_int_kind(12)) :: ires0,iresr,iresm,ires
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Intel Fortran for IA-32 supports 64-bit integers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you TIM
but can you put that in the code which I've geiven so that would give me clearly
but can you put that in the code which I've geiven so that would give me clearly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[bash] SUBROUTINE TIMEL(TRES) ************************************************************ * Returns CPU time. Fortran 9X version * ************************************************************ REAL*8 TRES,TRES0 SAVE IF,TRES0,IRES0 DATA IF/0/ * THIS IS INTRINSIC PROCEDURE IN FORTRAN<90> IF(IF.EQ.0)CALL SYSTEM_CLOCK(IRES0,IRESR,IRESM) IF=1 CALL SYSTEM_CLOCK(IRES,IRESR,IRESM) TRES=DBLE(IRES-IRES0)/DBLE(IRESR) END [/bash]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please note that SYSTEM_CLOCK returns "wall clock" elapsed time, not CPU time. The CPU_TIME intrinsic returns that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It has been so long and after my PC crashed out. I reinstated my PC and Now I exactly got what I can do I'll keep posted on the improvement

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