public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "benedict.geihe at ins dot uni-bonn.de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/54000] New: Performance breakdown for gcc-4.{6,7} vs. gcc-4.5 using std::vector in matrix vector multiplication
Date: Tue, 17 Jul 2012 15:59:00 -0000	[thread overview]
Message-ID: <bug-54000-4@http.gcc.gnu.org/bugzilla/> (raw)

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

             Bug #: 54000
           Summary: Performance breakdown for gcc-4.{6,7} vs. gcc-4.5
                    using std::vector in matrix vector multiplication
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: benedict.geihe@ins.uni-bonn.de


Dear experts,

I got here from the gcc-help mailing list but have not submitted any bug
reports before. So I hope for your patience.

In a self-written library used for numerical computations we have some typical
programs serving as benchmarks for new compiler versions or optimization flags.
When gcc-4.6 was released we noticed a performance breakdown. The problem
persisted with gcc-4.7. I tried to produce a minimal stand-alone example and
followed the instructions at http://gcc.gnu.org/bugs/minimize.html. As
std::vector is included I was however not able to arrive at a really small
file.

What you see at the end of the file is actually just 1000 times matrix-vector
multiplication. However the matrix has a highly specific structure which is
encountered when performing numerical computations using the Finite Element
Method (FEM), i.e.:

std::vector<MinimalVec3> rows[9];

Thus it consists of 9 bands of triples of doubles. The length of each band
corresponds to the length of the vector it is applied to.


Compiling with gcc-4.5.0 (our current standard) 'time' command gives:
  real    1m32.606s
Using gcc-4.7.0 we get:
  real    2m6.923s
When removing member variable "double stuff" in "class MinimalVector" and using
gcc-4.7.0 we get:
  real    1m27.354s


Using a C array instead of std::vector above resolves this issue.


The specifications of the two compilers used are:

Using built-in specs.
COLLECT_GCC=/home/prog/gcc-4.5.0-64/bin/g++
COLLECT_LTO_WRAPPER=/home/prog/gcc-4.5.0-64/libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --prefix=/home/prog/gcc-4.5.0-64/
--enable-languages=c,c++,fortran --disable-multilib --enable-lto
--with-libelf=/home/prog/libelf-64/ --with-ppl=/home/prog/ppl-64/
--with-cloog=/home/prog/cloog-ppl-64/
Thread model: posix
gcc version 4.5.0 (GCC)

and

Using built-in specs.
COLLECT_GCC=/home/prog/gcc-4.7.0-64/bin/g++
COLLECT_LTO_WRAPPER=/home/prog/gcc-4.7.0-64/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.7.0/configure --prefix=/home/prog/gcc-4.7.0-64/
--enable-languages=c,c++,fortran --with-gmp=/home/prog/gmp-5.0.4-64/
--with-ppl=/home/prog/ppl-0.12-64/ --enable-cloog-backend=isl
--with-cloog=/home/prog/cloog-0.16.3-64/ --disable-multilib
--enable-libstdcxx-debug
Thread model: posix
gcc version 4.7.0 (GCC)

They have been compiled manually on a machine running openSuse 11.3.


The command line was: g++ -O2 -o minmvmult minmvmult.ii


There were no warnings or error messages.



We'd be grateful for any suggestions.
Best regards
Benedict


             reply	other threads:[~2012-07-17 15:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-17 15:59 benedict.geihe at ins dot uni-bonn.de [this message]
2012-07-17 16:01 ` [Bug c++/54000] " benedict.geihe at ins dot uni-bonn.de
2012-07-17 16:20 ` [Bug c++/54000] [4.6/4.7/4.8 Regression] " redi at gcc dot gnu.org
2012-07-17 20:14 ` hjl.tools at gmail dot com
2012-07-17 21:47 ` [Bug tree-optimization/54000] " jason at gcc dot gnu.org
2012-07-18  8:41 ` rguenth at gcc dot gnu.org
2012-07-24  9:53 ` benedict.geihe at ins dot uni-bonn.de
2012-09-05  9:30 ` benedict.geihe at ins dot uni-bonn.de
2012-09-05  9:32 ` benedict.geihe at ins dot uni-bonn.de
2012-09-07 10:00 ` [Bug tree-optimization/54000] [4.6/4.7/4.8 Regression][IVOPTS] " rguenth at gcc dot gnu.org
2013-02-22 23:41 ` [Bug tree-optimization/54000] [4.6/4.7/4.8 Regression] Performance breakdown for gcc-4.{6,7} vs. gcc-4.5 using std::vector in matrix vector multiplication (IVopts / inliner) steven at gcc dot gnu.org
2013-02-22 23:42 ` steven at gcc dot gnu.org
2013-04-12 15:17 ` [Bug tree-optimization/54000] [4.7/4.8/4.9 " jakub at gcc dot gnu.org
2014-06-12 13:48 ` [Bug tree-optimization/54000] [4.7/4.8/4.9/4.10 " rguenth at gcc dot gnu.org
2014-12-19 13:32 ` [Bug tree-optimization/54000] [4.8/4.9/5 " jakub at gcc dot gnu.org
2015-02-09  8:46 ` [Bug tree-optimization/54000] [4.8/4.9 " rguenth at gcc dot gnu.org
2015-02-09  8:57 ` [Bug tree-optimization/54000] [4.8 " rguenth at gcc dot gnu.org
2015-02-09 11:51 ` rguenth at gcc dot gnu.org

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=bug-54000-4@http.gcc.gnu.org/bugzilla/ \
    --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).