Polyhedron benchmark results on AMD64
Steve Kargl
sgk@troutmask.apl.washington.edu
Fri Feb 9 23:17:00 GMT 2007
On Fri, Feb 09, 2007 at 11:31:10PM +0100, Dominique Dhumieres wrote:
>
> Steve Kargl wrote:
>
> > I looked at gas_dyn a long time ago. My conclusion was that
> > gfortran needed to do inter-procedure optimizations to make
> > any big gains.
>
> I cannot comment on this, but I had a look to the code and did not find
> any obvious way to hand optimize the code.
>
A quick look with a profiler shows:
gfc4x -pg -O2 -march=opteron -funroll-loops -o z gas_dyn.f90
% cumulative self self total
time seconds seconds calls ms/call ms/call name
46.3 11.67 11.67 20002 0.58 0.58 eos_ [3]
15.4 15.55 3.88 20001 0.19 0.19 chozdt_ [4]
11.0 18.31 2.76 0 100.00% _gfortran_minloc0_4_r4 [5]
10.3 20.90 2.59 0 100.00% _mcount [6]
6.7 22.59 1.69 5603564 0.00 0.00 area_ [7]
The guilty code in eos_ is this:
IF (SHEAT>0.0 .AND. CGAMMA>0.0) THEN
TEMP(:NODES) = IENER(:NODES)/SHEAT
PRES(:NODES) = (CGAMMA - 1.0)*DENS(:NODES)*IENER(:NODES)
GAMMA(:NODES) = CGAMMA
CS(:NODES) = SQRT(CGAMMA*PRES(:NODES)/DENS(:NODES))
ELSE
With naive and manual loop fusion:
IF (SHEAT>0.0 .AND. CGAMMA>0.0) THEN
do sk = 1, nodes
TEMP(sk) = IENER(sk)/SHEAT
PRES(sk) = (CGAMMA - 1.0)*DENS(sk)*IENER(sk)
GAMMA(sk) = CGAMMA
CS(sk) = SQRT(CGAMMA*PRES(sk)/DENS(sk))
end do
ELSE
I see
% cumulative self self total
time seconds seconds calls ms/call ms/call name
43.4 10.65 10.65 20002 0.53 0.53 eos_ [3]
15.9 14.56 3.91 20001 0.20 0.20 chozdt_ [4]
11.7 17.44 2.88 0 100.00% _gfortran_minloc0_4_r4 [5]
11.0 20.13 2.69 0 100.00% _mcount [6]
Restoring the code to first snippet and adding -ftree-vectorize, I see
% cumulative self self total
time seconds seconds calls ms/call ms/call name
36.8 6.63 6.63 20002 0.33 0.33 eos_ [3]
15.4 9.42 2.78 0 100.00% _gfortran_minloc0_4_r4 [4]
14.3 11.99 2.58 0 100.00% _mcount [5]
10.7 13.92 1.92 20001 0.10 0.10 chozdt_ [6]
--
Steve
More information about the Fortran
mailing list