|
[Sponsors] |
July 2, 2008, 18:14 |
Measuring an Execution Time - f90
|
#1 |
Guest
Posts: n/a
|
how can I Measuring an Execution Time in fortran, f90, in a PC. Is there any command can I write in my code in order to see how many min, sec, hours that I need to get results.
thanx |
|
July 2, 2008, 18:32 |
Re: Measuring an Execution Time - f90
|
#2 |
Guest
Posts: n/a
|
You can use the "CALL CPU_TIME(..)" in a line. The usage can be found by googling.
|
|
July 3, 2008, 05:13 |
Re: Measuring an Execution Time - f90
|
#3 |
Guest
Posts: n/a
|
is there any example on line? couldn't find any!
|
|
July 3, 2008, 07:21 |
Re: Measuring an Execution Time - f90
|
#4 |
Guest
Posts: n/a
|
place "CALL CPU_TIME (time_begin)" at the very beginning of the code, and place "CALL CPU_TIME (time_end)" where you want to calculate the CPU time. So; time_spent = time_end - time_begin in seconds.
|
|
July 3, 2008, 09:47 |
Re: Measuring an Execution Time - f90
|
#5 |
Guest
Posts: n/a
|
Many thanks for your reply. Consider the following code. Say the follwoing is user1.f90 (the main peogram)
PROGRAM test USE SAMPLE IMPLICIT NONE save DO I = 1,5 CALL CPU_TIME (time_begin) K(I) = 2*I time_spent = time_end - time_begin CALL CPU_TIME (time_end) print*, 'Time of operation was ', time_spent, ' seconds' END DO END PROGRAM test ------------:- And I have a separate file called: SAMPLE.f90 --------: MODULE SAMPLE INTEGER, DIMENSION (10) :: K INTEGER :: I real :: time_spent, time_end, time_begin END MODULE SAMPLE -------------------- Am running this in a PC using a PC compiler (only no linux or unix)and it is not working at all for the use statement and not for the cpu time. How can I solve this problem, am still new to fortran 95/90. is the USE done with unix ONLY ? Thanks for your help. |
|
July 3, 2008, 11:10 |
Re: Measuring an Execution Time - f90
|
#6 |
Guest
Posts: n/a
|
.... REAL begin_time, end_time ...
CALL CPU_TIME(begin_time) DO WHILE(t < tfinal) ... ENDDO CALL CPU_TIME(end_time) PRINT*,' ' PRINT*,'total computing time: ',(end_time-begin_time),'sec.' |
|
July 4, 2008, 03:44 |
Re: Measuring an Execution Time - f90
|
#7 |
Guest
Posts: n/a
|
you can apply USE and CPU_TIME declarations in f90, your code should have worked. check out your compiler's help documents, it might apply slightly different declarations. also, put the cpu time built-in fuctions outside of the do-loop, unless you do want to measure the time for each and every iteration operation. and you should have calculated the time_spent after obtaining time_end.
|
|
July 4, 2008, 05:14 |
Re: Measuring an Execution Time - f90
|
#8 |
Guest
Posts: n/a
|
The time is working now BUT not the use statement! Shall I switch to a different compiler? Or keep trying
|
|
July 4, 2008, 07:02 |
Re: Measuring an Execution Time - f90
|
#9 |
Guest
Posts: n/a
|
cpu_time may vary i think, but use statement have to be a standard declaration for f90. perhaps you haven't added the module file to the project before compilation.
|
|
July 4, 2008, 07:07 |
Re: Measuring an Execution Time - f90
|
#10 |
Guest
Posts: n/a
|
wait a moment, how can it works without the use statement? if cpu_time works then use statements must be working also. you are missing some point, it is better to examine details before asking i think.
|
|
July 4, 2008, 07:46 |
Re: Measuring an Execution Time - f90
|
#11 |
Guest
Posts: n/a
|
working without the USE !
|
|
July 4, 2008, 08:21 |
Re: Measuring an Execution Time - f90
|
#12 |
Guest
Posts: n/a
|
there is an "implicit none" statement in your main file, therefore every variable have to be declared beforehand. use statement or your module is working obviously. if you couldn't see the variables in debugging screen it is because they are global variables, and you can see the assigned values to them by writing down variable's names in debugging screen explicitly.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Multiple floating objects | CKH | OpenFOAM Running, Solving & CFD | 14 | February 20, 2019 10:08 |
calculation diverge after continue to run | zhajingjing | OpenFOAM | 0 | April 28, 2010 05:35 |
Restarting interDyMFoam | hsieh | OpenFOAM Bugs | 4 | January 25, 2009 16:19 |
Convergence moving mesh | lr103476 | OpenFOAM Running, Solving & CFD | 30 | November 19, 2007 15:09 |
unsteady calcs in FLUENT | Sanjay Padhiar | Main CFD Forum | 1 | March 31, 1999 13:32 |