CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   CPU time (https://www.cfd-online.com/Forums/main/5999-cpu-time.html)

R. April 16, 2003 20:27

CPU time
 
Hi guys,

Is there any simple way to find out the CPU time used for a code in FORTRAN. I just forgot the command. Your help is appreciated.

Manosh April 17, 2003 05:52

Re: CPU time
 
At the Unix prompt, enter:

time yourprog

Manosh

Jean-François Simon April 17, 2003 08:45

Re: CPU time
 
In Fortran directly,

REAL time_begin, time_end

... CALL CPU_TIME(time_begin)

... CALL CPU_TIME(time_end)

R. April 17, 2003 15:08

Re: CPU time
 
Thanks but none did work! Do I have to use the library?

I am writing my code on Unix computer.

xueying April 17, 2003 18:27

Re: CPU time
 
Are you using Fortran 90/95? Both of the methods work for my Fortran 90/95 code without linking to any library, however, if you direct your running results to some file, then the first method doesn't work.

R. April 17, 2003 19:19

Re: CPU time
 
Thanks a lot.

What about function ETIME

In the manual it says it should give the CPU time, what I get is very very small values!

carlslack April 18, 2003 03:13

Re: CPU time
 
This is a code snippet from my Windows Fortran90 program, if it's of any help...

use portlib

real elapsed_time

elapsed_time=timef() !start processor timer

... program stuff...

elapsed_time=timef() !stop processor timer

write(*,*) 'execution time: (sec)', elapsed_time

end program

R. April 18, 2003 16:28

Re: CPU time
 
Thank you very much!


All times are GMT -4. The time now is 12:02.