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

About Migrating from F77 to F95


Hi all,

I used to write f77 codes and now I want to migrate to f95. Since
there is a large set of old f77 styled codes in my own lib, I have
several questions on the necessities for the migration:

1. if I keep the old codes unchanged and only re-compile them with
compilers like ifort, will the efficiency be promoted a lot even
without rewriting codes? and in what degree the efficiency will be
promoted if I further rewrite all the codes in f95 style and recompile
them with ifort?

2. is there any suggestion form you experienced guys about rewriting
f77 codes complying with f95 styles?

Please leave your comments, thanks in advance

Zuying:

You should consider trying out Mike  Metcalf's  convert program which will  
convert F77 fixed format syntax to f90 free format syntax. It will do other
good things (like indent DO groups).  Get it at:

ftp://ftp.numerical.rl.ac.uk/pub/MandR/convert.f90

compile it and read the leading comments, and perhaps change any
default options that you  wiish.

There are other possible changes you could make manually, like
replacing COMMON with modules, declaring subprogram arguments
with INTENT clauses. If you have questions about this, post the
code and ask this group those questions.

Since F77 is a subset of F90 you should be able  to compile the F77
code with an F90/95 compiler (like Intel Fortran).

Skip Knoble

On 30 Apr 2007 04:57:36 -0700, "zuy@gmail.com" <zuy@gmail.com> wrote:

-|Hi all,
-|
-|I used to write f77 codes and now I want to migrate to f95. Since
-|there is a large set of old f77 styled codes in my own lib, I have
-|several questions on the necessities for the migration:
-|
-|1. if I keep the old codes unchanged and only re-compile them with
-|compilers like ifort, will the efficiency be promoted a lot even
-|without rewriting codes? and in what degree the efficiency will be
-|promoted if I further rewrite all the codes in f95 style and recompile
-|them with ifort?
-|
-|2. is there any suggestion form you experienced guys about rewriting
-|f77 codes complying with f95 styles?
-|
-|Please leave your comments, thanks in advance

<zuy@gmail.com> wrote in message

news:1177934256.001763.323830@o5g2000hsb.googlegroups.com...

> 1. if I keep the old codes unchanged and only re-compile them with
> compilers like ifort, will the efficiency be promoted a lot even
> without rewriting codes?

As you don't specify the compiler you're using for F77 it's hard to say, but
it's unlikely that you'd see any material change.

> and in what degree the efficiency will be
> promoted if I further rewrite all the codes in f95 style and recompile
> them with ifort?

If it ain't broke, don't fix it.

> 2. is there any suggestion from you experienced guys about rewriting
> f77 codes complying with f95 styles?

It can be a pain to mix Fortran 77 and Fortran 95 source forms and styles.
Thus, it would be useful to make these *minimal* changes to your existing
code:

a) convert the fixed-form source to free-form source using a tool such as
convert.90 (which will optionally add procedure names to the procedure end
statements);

b) organize your old code into modules so that the interfaces become
explicit (which requires procedure names on the end statements).

When that all works you might consider replacing fixed storage with dynamic
storage, common with module variables etc. (but see comment above).

HTH

Mike Metcalf

On Apr 30, 7:57 am, "zuy@gmail.com" <zuy@gmail.com> wrote:

> Hi all,

> I used to write f77 codes and now I want to migrate to f95. Since
> there is a large set of old f77 styled codes in my own lib, I have
> several questions on the necessities for the migration:

> 1. if I keep the old codes unchanged and only re-compile them with
> compilers like ifort, will the efficiency be promoted a lot even
> without rewriting codes?

That depends on what Fortran 77 compiler you have been using. There
are some old benchmarks at http://www.polyhedron.com/pb04/win32/f77bench_p4.html
showing Intel Visual Fortran to be faster than g77.

> and in what degree the efficiency will be
> promoted if I further rewrite all the codes in f95 style and recompile
> them with ifort?

I would NOT expect rewriting F77 codes in F95 style (modules, array
operations, assumed shape arrays etc.) to increase the speed of a
program, and it could make it slower. Fortran compilers are good at
optimizing F77, based on a lot of experience. I have read that the
speed penalty of using some of the modern features of Fortran has
fallen since Fortran 90 compilers were first introduced.

> 2. is there any suggestion form you experienced guys about rewriting
> f77 codes complying with f95 styles?

You can use Michael Metcalf's convert.f90 program at
http://www.slac.stanford.edu/comp/fortran/convert.f90 to convert fixed
to free source form. I think free source form is more readable and
less error-prone. Alan Miller's to_f90.f90 program
http://users.bigpond.net.au/amiller/to_f90.f90 is more ambitious and
attempts to
add some F90 features such as INTENT. Note the caveats under "Known
problems".

In general, spending your time on writing new code in F95 to do new
things may be more productive than making stylistic changes to old
code, unless you are going to modify the old code anyway to add
functionality.

Writing Fortran 95 wrappers for Fortran 77 code can be productive.
Lapack95 http://www.netlib.org/lapack95/ is an example of this.

zuy@gmail.com wrote:
> Hi all,

> I used to write f77 codes and now I want to migrate to f95. Since
> there is a large set of old f77 styled codes in my own lib, I have
> several questions on the necessities for the migration:

> 1. if I keep the old codes unchanged and only re-compile them with
> compilers like ifort, will the efficiency be promoted a lot even
> without rewriting codes? and in what degree the efficiency will be
> promoted if I further rewrite all the codes in f95 style and recompile
> them with ifort?

As others said, you ask for a comparison between an unknown compiler and
an unknown version of ifort, so no answer makes much sense.  ifort,
particularly in the latest versions, is exceptionally good at
vectorizing loops with many assignments, provided they meet the
qualifications.  It also necessarily works harder at vectorizing double
precision than certain other compilers.

ifort will gain efficiency from modern syntax only in those cases where
your rewrite forces you to make better optimizable source code.  ifort
for 32-bit and 32-bit extended 64-bit depends heavily on vectorization
of stride 1 arrays as its primary means for optimization.  ifort still
tends to be weak in optimization of array syntax with non-default stride.
ifort is just beginning to address the issues of fusion for efficiency
for the recent CPUs which care about it.  So, you might not gain as much
from such a move if you don't intend to keep your compiler up to date.

gfortran is doing well in optimization of f95 syntax, short of dealing
with fusion and the like.

Michael Metcalf <michaelmetc@compuserve.com> wrote:
> <zuy@gmail.com> wrote in message
> news:1177934256.001763.323830@o5g2000hsb.googlegroups.com...
> > and in what degree the efficiency will be
> > promoted if I further rewrite all the codes in f95 style and recompile
> > them with ifort?

> If it ain't broke, don't fix it.

In particular, if you do this naively, it might well hurt performance.
Getting good performance is a bit of an art in any language. It cannot
be achieved by just writing on one or another style changing to an f95
is not a "magic bullet" for performance. If you want to do some changes
for other reasons, that's one thing. But if you convert to an f95 style
solely in the hopes of getting better performance, without understanding
what particular things you expect to improve performance and why, then
you will likely be disappointed.

--
Richard Maine                    | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle           |  -- Mark Twain

Thank you all, Then I gonna stay with my previous codes and only write
f95 for new codes.

On Apr 30, 11:29 pm, nos@see.signature (Richard Maine) wrote:

In article <1177934256.001763.323@o5g2000hsb.googlegroups.com>,

zuy@gmail.com <zuy@gmail.com> wrote:
>Hi all,

>2. is there any suggestion form you experienced guys about rewriting
>f77 codes complying with f95 styles?

You may find my notes on Fortran 95 for Fortran 77 users helpful. See
http://www.mcs.vuw.ac.nz/math/papers/JFH10_f95_2006

-- John Harper, School of Mathematics, Statistics and Computer Science,
Victoria University, PO Box 600, Wellington 6140, New Zealand
e-mail john.har@vuw.ac.nz phone (+64)(4)463 5341 fax (+64)(4)463 5045

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc