Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Fortran Programming Language

Can I do a timing line by line?


I am Visual Fortran 5.0 newbie and program under Windows XP
professional SP2. I recently want to do a timing for my 700-line
program. It is much slower than expected, and I wonder how could I do
a line-by-line timing for this program to find the bottleneck. Is is
possible to do a line by line timing?

I used Visual Fortran profiling tools which only provided timing for
each function. The profiling results demonstrate that the program
spend 30% of total time calculating Sin Cos and Acos function, and 60%
in the main program. A  typical value should be 90% time in Sin/Cos/
Acos function and 10% in main. In addition, there are no other
functions with significant time consumption.

By the way, are there any recommendations of debugging tools under
Windows environment?

On May 14, 4:27 pm, Butterseeds <sullivanz.@gmail.com> wrote:

> I am Visual Fortran 5.0 newbie and program under Windows XP
> professional SP2. I recently want to do a timing for my 700-line
> program. It is much slower than expected, and I wonder how could I do
> a line-by-line timing for this program to find the bottleneck. Is is
> possible to do a line by line timing?

Digital Visual Fortran 5 is pretty old. If you and your employer are
serious about performance, why haven't you upgraded to Intel Visual
Fortran? What compiler options are you using?

The CPU_TIME intrinsic of Fortran 95 can be used to time code -- I
don't know if DVF (officially a Fortran 90 compiler) supports it.
Fortran 90 has the slighly less convenient DATE_AND_TIME.

Beliavsky wrote:
> On May 14, 4:27 pm, Butterseeds <sullivanz.@gmail.com> wrote:
>> I am Visual Fortran 5.0 newbie and program under Windows XP
>> professional SP2. I recently want to do a timing for my 700-line
>> program. It is much slower than expected, and I wonder how could I do
>> a line-by-line timing for this program to find the bottleneck. Is is
>> possible to do a line by line timing?

> Digital Visual Fortran 5 is pretty old. If you and your employer are
> serious about performance, why haven't you upgraded to Intel Visual
> Fortran? What compiler options are you using?

> The CPU_TIME intrinsic of Fortran 95 can be used to time code -- I
> don't know if DVF (officially a Fortran 90 compiler) supports it.
> Fortran 90 has the slighly less convenient DATE_AND_TIME.

I think a tool that supports line-by-line profiling would be a better option than
instrumenting code by hand. The one thing I really liked about the PGI compiler suite I
used to use was their profiling tool, pgprof. It did line-by-line profiling, producing
little colour-coded bar graphs of the code (hyperlinked so you could traverse via a gui)
so it was easy to see the hotspots as the bars for those particular lines (or procedures)
were coloured red.

I've never been able to get the usual profilers to produce anything that detailed
(line-by-line I mean) and, as such, I've never seen as useful as tool as that profiler.
Sigh. If other current f95 compiler vendors provide similar products, then they need to
poke their marketing departments with a pointy stick coz I haven't heard about 'em. :o)

cheers,

paulv

>> I used Visual Fortran profiling tools which only provided timing for
>> each function. The profiling results demonstrate that the program
>> spend 30% of total time calculating Sin Cos and Acos function, and 60%
>> in the main program. A  typical value should be 90% time in Sin/Cos/
>> Acos function and 10% in main. In addition, there are no other
>> functions with significant time consumption.

>> By the way, are there any recommendations of debugging tools under
>> Windows environment?

--
Paul van Delst             Ride lots.
CIMSS @ NOAA/NCEP/EMC               Eddy Merckx
I don't remember checking out DVF5 profiling, but I do know that
profiling tools for HLLs (e.g., Fortran and C) for DOS/Win16 and WIN32
all allowed line by line profiling.  

I think you should be able to do it with DVF5 -- but I am not
sure.

I actually need something free. I think my employer does not have any
plan for an upgrade. Since he himself is quite super smart guy that
FORTRAN77 complier in gcc is totally enough for him........

On May 14, 5:00 pm, Beliavsky <beliav@aol.com> wrote:

Butterseeds wrote:

> By the way, are there any recommendations of debugging tools under
> Windows environment?

The Visual Studio debugger is very solid in my experience.  Nothing else
that I've used compares for ease-of-use.

Butterseeds wrote:
> I actually need something free. I think my employer does not have any
> plan for an upgrade. Since he himself is quite super smart guy that
> FORTRAN77 complier in gcc is totally enough for him........

gfortran with the  -fprofile-arcs -ftest-coverage  options,
and the gcov command does, I believe, what you are asking.

And it's free!

There are two gcc related tools that work with gfortran
(and I believe g95): gprof and gcov.  You might want to
use both of them to get all the information you need.

-- glen

Which version of Visual studio do you mean?
I have visual studio 6.0, but where is the debugger? I have used the VC
++ 6.0 Debug toolbar in VC++ IDE, but I do not know where is that
debugger program and how I could extend it to Fortran.
Would you please tell me?

On May 14, 6:34 pm, Craig Powers <eni@hal-pc.org> wrote:

In article <f2aklr$oc@news.nems.noaa.gov>, Paul van Delst wrote:
> I've never been able to get the usual profilers to produce anything that detailed
> (line-by-line I mean)

If you're on Linux oprofile does line-by-line profiling, or even
per-instruction profiling if you want. It's based on sampling hardware
counters rather than inserting profiling code, so it has quite low
overhead (a few %, typically). You can sample a largish number of
counters the hardware provides, like cpu cycles, cache misses and
whatnot. The downside is that it's a system-wide profiler so it
requires root access.

See http://oprofile.sourceforge.net/about/

I think there are a few oprofile gui:s around (including AMD code
analyzer or something), but I haven't used them that much so I can't
really tell if they are any good.

--
Janne Blomqvist

Excellent, thanks for the link! I will have a lookee.

cheers,

paulv

--
Paul van Delst             Ride lots.
CIMSS @ NOAA/NCEP/EMC               Eddy Merckx

Butterseeds wrote:
> I am Visual Fortran 5.0 newbie and program under Windows XP
> professional SP2. I recently want to do a timing for my 700-line
> program. It is much slower than expected, and I wonder how could I do
> a line-by-line timing for this program to find the bottleneck. Is is
> possible to do a line by line timing?

The serious answer to your questions is "no".  If you are interested
in performance, you can't do line by line timing of source code.
Modern compilers do so much optimization and source code rearrangement
that it's difficult or impossible to time a line.

Some suggestions:
Experiment with various levels of optimization, (are you sure you've
even got optimization turned on?)

700 lines is a small code and you can do things by hand.  Put in some
counters and find out which loops are executed a lot (some might be
executed more than you suspect).  Try putting calls to one of the
low level timing routines around each set of DO loops and see where
the time is spent.  Something like
         call cpu_time(T1)
              DO whatever
                 ...
              enddo
         call cpu_time(T2)
         print *, T2-T1
But, don't try to time the loops if you've also got counters in them
to see how often they are executed.

Dick Hendrickson

Butterseeds wrote:
> Which version of Visual studio do you mean?
> I have visual studio 6.0, but where is the debugger? I have used the VC
> ++ 6.0 Debug toolbar in VC++ IDE, but I do not know where is that
> debugger program and how I could extend it to Fortran.
> Would you please tell me?

If you're using Visual Fortran 5.0, you should use the Visual Studio 5.0
IDE with it.  There you should find the Fortran features to be
integrated into the IDE and debugger.

Even in Visual Studio 6.0, you should be able to set breakpoints and
step through code, but it may be a little weird with looking at
variables and such.

Yes, I do use that built-in debugger for trouble shooting my program.
But that debugger seems not to give any performance information. Line-
by-line timing is something I have never heard about in that debugger.

On May 15, 1:15 pm, Craig Powers <eni@hal-pc.org> wrote:

I think you are essentially right, but there are quite a lot of
programs providing line counting and line coverage statistics. Since
line counting is feasible, despite that they are sometimes inaccurate
due to compile-time optimization, I could still guess that line timing
is possible, because theoretically, adding a timer to line counting
program will do the trick.

After all, I will try CPU_TIME to see what is the most time_consuming
part of my program.

On May 15, 11:30 am, Dick Hendrickson <dick.hendrick@att.net>
wrote:

SullivanZ wrote:
> Yes, I do use that built-in debugger for trouble shooting my program.
> But that debugger seems not to give any performance information. Line-
> by-line timing is something I have never heard about in that debugger.

Right.  Other people had answered your profiling questions better than I
could have done, but nobody had answered your question about a debugger.
  You're not going to get performance info out of a debugger, that's not
what it's built for.  In fact, debugging pretty much precludes getting
useful performance info.
Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc