public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/31139] sum(w_re(1:nn,1)*fi(i(1:nn, ii)))  up to 3.5x slower than C version
Date: Mon, 12 Mar 2007 08:16:00 -0000	[thread overview]
Message-ID: <20070312081639.23202.qmail@sourceware.org> (raw)
In-Reply-To: <bug-31139-13404@http.gcc.gnu.org/bugzilla/>



------- Comment #6 from burnus at gcc dot gnu dot org  2007-03-12 08:16 -------
> Can someone try instead of doing "__real__ a += w[j] *__real__ mfi[*index];"
> Use "a+= xxx* yyy" and also use -std=c99 to get the correct multiplication?

Well, -std=c99 was used already and the "real(!) * complex" calculation was
already correct. "c_cmplx" below uses now:
      a += w[j    ] * mfi[*index++];

Compiled with:
gcc -std=c99 -O3 -funroll-loops -ftree-vectorize -march=opteron -msse3
-ffast-math -m64
gfortran -O3 -funroll-loops -ftree-vectorize -march=opteron -msse3 -ffast-math
-m64

 Fortran:   0.4360271
 Fortran:   0.4280267
 c_nosse:   0.2440166
 c_nosse:   0.2320151
 c_sse:     0.2320137
 c_sse:     0.2400150
 c_struct:  0.2320151
 c_struct:  0.2320147
 c_cmplx:   0.2360163
 c_cmplx:   0.2320147
And using a non-manually unrolled version: 0.3760242, 0.3760242
  for(i = 0; i < np ; i++) {
    for(j = 1; j < n; j++)
      a += w[j    ] * mfi[*index++];
    fo[i] = a;
  }
Thus the unrolling seems to do most of the speed up. With -funroll-all-loops,
the timings of fortran an the non-unrolled version remain the same.


-- 


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


  parent reply	other threads:[~2007-03-12  8:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-11 22:38 [Bug fortran/31139] New: " 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070312081639.23202.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).