public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/31139]  New: sum(w_re(1:nn,1)*fi(i(1:nn, ii)))  up to 3.5x slower than C version
@ 2007-03-11 22:38 burnus at gcc dot gnu dot org
  2007-03-11 22:45 ` [Bug fortran/31139] " burnus at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-03-11 22:38 UTC (permalink / raw)
  To: gcc-bugs

The problem came up with octopus, http://www.tddft.org/programs/octopus/
http://www.tddft.org/pipermail/octopus-devel/2007-March/003398.html
(Somehow, all my messages are not archived?)

The problem is that "sum(w_re(1:nn,1)*fi(i(1:nn, ii)))" can be much slower. For
the original program, one finds the following timings:

Core 2 Duo + gfortan + gcc (v. 4.1.x), total cpu time:
SSE2     120 s
PLAIN C  160 s
FORTRAN  331 s
(Fortran = assumed shape arrays)

 * * *

I tried to reproduce this with a smaller test case (see attachment) - and with
explicit shape arrays. Here, SSE and non-SSE version made little difference.
Result for gcc/gfortran 4.3.0 20070311 on an Athlon 64 X2 4800+.

-O3 -march=opteron -funroll-loops -msse3 -ftree-vectorize -m64:
Fortran:   0.8240519, real    0m7.661s, user    0m7.232s
Fortran:   0.8240528, real    0m7.654s, user    0m7.232s
c_nosse:   0.2320137, real    0m7.071s, user    0m6.652s
c_nosse:   0.2320151, real    0m7.062s, user    0m6.672s

-O3 -march=opteron -msse3 -ftree-vectorize -m32:
Fortran:   0.3840241, real    0m7.714s, user    0m7.280s
Fortran:   0.3840246, real    0m7.701s, user    0m7.328s
c_nosse:   0.3480220, real    0m7.687s, user    0m7.256s
c_nosse:   0.3400207, real    0m7.670s, user    0m7.236s

And with ifort/x86-64:
gcc -std=c99 -O3 -funroll-loops -ftree-vectorize -march=opteron -msse3 -m64
ifort -xW -O3

Fortran:   0.3280210, real    0m0.855s, user    0m0.624s
Fortran:   0.3280210, real    0m0.856s, user    0m0.624s
c_nosse:   0.2320140, real    0m0.753s, user    0m0.492s
c_nosse:   0.2280150, real    0m0.756s, user    0m0.464s

and with ifort/ia32:

Fortran:   0.3000200, real    0m0.818s, user    0m0.516s
Fortran:   0.2960190, real    0m0.826s, user    0m0.528s
c_nosse:   0.3760230, real    0m0.904s, user    0m0.652s
c_nosse:   0.3800240, real    0m0.902s, user    0m0.624s

I did no yet check which of the problems are Fortran, Backend and Target
problems.

Summary:
- GCC -m32 is much slower than -m64
- gfortran is slower (-m32) / much slower (-m64) than the C version
- ifort is faster than gfortran and similarly fast on both -m32 and -m64.


-- 
           Summary: sum(w_re(1:nn,1)*fi(i(1:nn, ii)))  up to 3.5x slower
                    than C version
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31139


^ permalink raw reply	[flat|nested] 11+ messages in thread
[parent not found: <bug-31139-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2015-10-10  9:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-11 22:38 [Bug fortran/31139] New: sum(w_re(1:nn,1)*fi(i(1:nn, ii))) up to 3.5x slower than C version burnus at gcc dot gnu dot org
2007-03-11 22:45 ` [Bug fortran/31139] " burnus at gcc dot gnu dot org
2007-03-11 22:50 ` burnus at gcc dot gnu dot org
2007-03-12  5:33 ` pinskia at gcc dot gnu dot org
2007-03-12  5:38 ` pinskia at gcc dot gnu dot org
2007-03-12  7:58 ` burnus at gcc dot gnu dot org
2007-03-12  8:16 ` burnus at gcc dot gnu dot org
2007-04-18  5:56 ` fxcoudert at gcc dot gnu dot org
2010-09-12 15:45 ` jvdelisle at gcc dot gnu dot org
     [not found] <bug-31139-4@http.gcc.gnu.org/bugzilla/>
2013-06-22 16:55 ` dominiq at lps dot ens.fr
2015-10-10  9:21 ` dominiq at lps dot ens.fr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).