This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gfortran 4.3.2 about 3x slower than g77 for scientific application


On Wed, May 13, 2009 at 10:07 PM, Julian King <jking.phys@gmail.com> wrote:
> -march=native makes negligible difference to the running time.
>
> I agree with you about the profiling being weird in terms of the
> number of calls. This is to the same data though, and the outputs of
> the program are the same. I just wonder if gprof is not catching all
> the calls somehow?
>
> -Wall produces a large number of warnings, but all of them relate to
> 1) nonconforming tab characteres
> 2) unused dummy variables
> 3) unused variables.
>
> There are no other warnings of note..

I guess you are implementing an iteration scheme?  In this case your
numerical scheme may be unstable enough to converge slower with
different amounts of optimization.  Try for example adding -ffast-math
(previous GCC versions did not adhere to standard conformance fully,
so without -ffast-math they likely did more optimizations).

Richard.

> Julian
>
> On Wed, May 13, 2009 at 9:24 PM, Steve Kargl
> <sgk@troutmask.apl.washington.edu> wrote:
>>
>> On Wed, May 13, 2009 at 11:50:13AM -0700, VelocideX wrote:
>> >
>> > (i.e. it is computationally intensive).
>> >
>> > I am on a Intel Core 2 Duo P8700 processor with 4 GB RAM, running OpenSuSE
>> > 11.1 64 bit (i.e x86-64 architecture).
>> >
>> > Executing the program on identical data is about 3x slower in gfortran than
>> > g77 (v3.3.3-hammer). This seems a serious deficiency given that all the run
>> > time in the program is spent in relatively simple calls. Both versions were
>> > compiled with the flag -O2 only.
>>
>> Try adding -march=native to the gfortran command line.
>>
>> > Here are the gprof results for the g77:
>> > ? % ? cumulative ? self ? ? ? ? ? ? ?self ? ? total
>> > ?time ? seconds ? seconds ? ?calls ? s/call ? s/call ?name
>> > ?64.12 ? ? ?2.52 ? ? 2.52 ? ?23679 ? ? 0.00 ? ? 0.00 ?vp_spvoigte__
>> > ?19.34 ? ? ?3.28 ? ? 0.76 28574044 ? ? 0.00 ? ? 0.00 ?voigt_
>> > ? 6.36 ? ? ?3.53 ? ? 0.25 ? ? ? 12 ? ? 0.02 ? ? 0.28 ?deriv_
>> > ? 4.33 ? ? ?3.70 ? ? 0.17 32747695 ? ? 0.00 ? ? 0.00 ?dexpf_
>> > ? 3.05 ? ? ?3.82 ? ? 0.12 ? ? ?877 ? ? 0.00 ? ? 0.00 ?vp_chspread__
>> > ? 1.27 ? ? ?3.87 ? ? 0.05 ? ? ? ?1 ? ? 0.05 ? ? 0.05 ?pr_sort__
>> > ? 0.51 ? ? ?3.89 ? ? 0.02 ? ? ? ?1 ? ? 0.02 ? ? 0.02 ?probks_
>> > ? 0.25 ? ? ?3.90 ? ? 0.01 ? ?23679 ? ? 0.00 ? ? 0.00 ?calcn_
>> > ? 0.25 ? ? ?3.91 ? ? 0.01 ? ? ?877 ? ? 0.00 ? ? 0.00 ?vp_chipconv__
>> > ? 0.25 ? ? ?3.92 ? ? 0.01 ? ? ? 11 ? ? 0.00 ? ? 0.00 ?udchole_
>> > ? 0.25 ? ? ?3.93 ? ? 0.01 ? ? ? ?1 ? ? 0.01 ? ? 0.01 ?pldef_
>> > ? 0.00 ? ? ?3.93 ? ? 0.00 ? 550174 ? ? 0.00 ? ? 0.00 ?ucase_
>> >
>> > ...and for the gfortran (slower version) execution:
>> > ? % ? cumulative ? self ? ? ? ? ? ? ?self ? ? total
>> > ?time ? seconds ? seconds ? ?calls ? s/call ? s/call ?name
>> > ?43.27 ? ? ?3.28 ? ? 3.28 ? ?33885 ? ? 0.00 ? ? 0.00 ?vp_spvoigte_
>> > ?27.04 ? ? ?5.33 ? ? 2.05 ? ? 1255 ? ? 0.00 ? ? 0.00 ?vp_subchspread_
>> > ?16.36 ? ? ?6.57 ? ? 1.24 41100608 ? ? 0.00 ? ? 0.00 ?voigt_
>> > ? 6.99 ? ? ?7.10 ? ? 0.53 528972139 ? ? 0.00 ? ? 0.00 ?dexpf_
>> > ? 3.56 ? ? ?7.37 ? ? 0.27 ? ? ? 17 ? ? 0.02 ? ? 0.38 ?deriv_
>> > ? 0.66 ? ? ?7.42 ? ? 0.05 ? ? ? ?1 ? ? 0.05 ? ? 0.05 ?pr_sort_
>> > ? 0.66 ? ? ?7.47 ? ? 0.05 ? ? ? ?1 ? ? 0.05 ? ? 0.05 ?probks_
>> > ? 0.40 ? ? ?7.50 ? ? 0.03 ? 478767 ? ? 0.00 ? ? 0.00 ?varythis_
>> > ? 0.40 ? ? ?7.53 ? ? 0.03 ? ? ? ?1 ? ? 0.03 ? ? 7.52 ?vp_ucoptv_
>> > ? 0.26 ? ? ?7.55 ? ? 0.02 ? ?33878 ? ? 0.00 ? ? 0.00 ?vp_archwav_
>> > ? 0.13 ? ? ?7.56 ? ? 0.01 ? ?33885 ? ? 0.00 ? ? 0.00 ?calcn_
>> > ? 0.13 ? ? ?7.57 ? ? 0.01 ? ? 1255 ? ? 0.00 ? ? 0.00 ?vp_chipconv_
>> > ? 0.13 ? ? ?7.58 ? ? 0.01 ? ? ? ?1 ? ? 0.01 ? ? 0.01 ?vp_gwclinfits_
>> > ? 0.00 ? ? ?7.58 ? ? 0.00 ? 793778 ? ? 0.00 ? ? 0.00 ?ucase_
>> >
>>
>> Are you using the same input for this comparison because the
>> number of calls to various functions suggest that you are
>> taking drastically different code paths (eg, see # of
>> calls for dexpf and voigt)?.
>>
>> If you add -Wall to the gfortran command line, do you get
>> a large number of warnings?
>>
>> --
>> Steve
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]