Menu

#1 diff code generation: reused variables

open
nobody
pFortran (1)
5
2007-10-15
2007-10-15
Ed Zaron
No

Dear Rich,

The first issue with the Parametric Fortran Compiler has to do with
linearization of nonlinearities using the "diff". Suppose you define

diff = RP [a, u, v, d]

and in you original code you have

a = d*v
u = a*u

with u,v,d as inputs. The linearized code will be

rp_a = rp_d*v + d*rp_v
rp_u = rp_a*u + a*rp_u

In the last term in the second equation "a" is an unknown quantity
because it is not computed. So the linearization has to keep track of
local nonlinear terms that are being "re-used". So the linearized code
should be

a = d*v
rp_a = rp_d*v + d*rp_v
rp_u = rp_a*u + a*rp_u

The second issue is the consistency of Fortran versions. By defaults,
PFC dumps free-format Fortran 90. There should be an option to dump the
output as Fortran 77 in cases where the original code is in that format.
Ben apparently says that should not be difficult to do.

All users should include the option -O in the compilation command, i.e.

pfc -p param_file -O input_file.pf output_file

it eliminates unnecessary multiplications by zero.

Hans

Discussion


Log in to post a comment.

MongoDB Logo MongoDB