CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   The method of Checking the CPU time (https://www.cfd-online.com/Forums/main/736-method-checking-cpu-time.html)

JunYoung Park April 18, 1999 04:02

The method of Checking the CPU time
 
hi, I am a graduate student. I will compare the CPU time of serial and parallel program. But, I don't know how do calculating the cpu time in fortran language. please, let me know the method.

Tim Cowan April 19, 1999 11:28

Re: The method of Checking the CPU time
 
Are you wanting to embedd something into the source code which keeps track of the run time for you? Functions which handle this are typically platform/compiler dependent. On a PC with DVF you can use the CPU_TIME function. Call it twice, once to get the start time and once to get the finish time. You run time is then the difference between the two values. The syntax is as follows:

CALL CPU_TIME(x)

Under Unix, there are "better" ways to keep track of your run times that do not involve modifying your Fortran source code. Most Unix versions include a time function which can be used to keep track of the system and user time during your run.

Note that if the above do not help, the easiest thing to do is pull out you manuals or use the online help system and look for time functions...

Patrick Godon April 19, 1999 15:34

Re: The method of Checking the CPU time
 
Hi. In addition to the function mentioned by Tim in Fortran, each parallel software has also its own function to do the same task. For example if you use MPI (message passing interface) to write your parallel program in Fortran, MPI has its own call of time functions that also includes of course the processor id in it. So you might want to check that too, once you get there. As a first step you can also use these options where you don't have to change your Fortran programs (as Tim suggested), e.g. in unix (on a Sparc station / Sun) you will just run your job by entering: time job , where 'job' is your executable statement (your job name). This will return the total cpu time for your job to be completed, but it is of course less accurate than the fortran function. PG.


All times are GMT -4. The time now is 18:51.