public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* What optimizaton flags should i use (g++-4.3.3,Linux,Core2Duo)?
@ 2009-04-19 15:18 Martin Ettl
  2009-04-19 17:50 ` Tim Prince
  2009-04-22 15:34 ` Bob Plantz
  0 siblings, 2 replies; 7+ messages in thread
From: Martin Ettl @ 2009-04-19 15:18 UTC (permalink / raw)
  To: gcc-help

Hello all,

i am playing around with g++-4.3.3 on Ubuntu Linux. The project i am working does a lot of floating point arithmetic (based on double variables). The testplattform i use, is a intel core 2 duo processor. So what optimization flags are good for this plattform? Currently i am using -O3 -funroll-loops, but there are a plenty other. 

Thanks in advance!

Best regards

Ettl Martin


-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: What optimizaton flags should i use (g++-4.3.3,Linux,Core2Duo)?
  2009-04-19 15:18 What optimizaton flags should i use (g++-4.3.3,Linux,Core2Duo)? Martin Ettl
@ 2009-04-19 17:50 ` Tim Prince
  2009-04-19 20:05   ` Matthew Lai
  2009-04-20 19:23   ` Ian Lance Taylor
  2009-04-22 15:34 ` Bob Plantz
  1 sibling, 2 replies; 7+ messages in thread
From: Tim Prince @ 2009-04-19 17:50 UTC (permalink / raw)
  To: Martin Ettl; +Cc: gcc-help

Martin Ettl wrote:

> i am playing around with g++-4.3.3 on Ubuntu Linux. The project i am working does a lot of floating point arithmetic (based on double variables). The testplattform i use, is a intel core 2 duo processor. So what optimization flags are good for this plattform? Currently i am using -O3 -funroll-loops, but there are a plenty other. 
> 
If you are using the 64-bit compiler, this may be sufficient, but
--param max-unrolled-insns=<your choice>
or
--param max-unroll-times=4
may be useful to make the unrolling less aggressive.

I suppose you're not using the 32-bit compiler, where you would set
-march=pentium-m
or
-march=prescott
or some other option, to enable partial or full use of sse2.

Add -msse3 if you like (either 32- or 64-bit), but you probably have no
use for it.

-fassociative-math (or, if it doesn't work, -ffast-math) are required for
vectorization of sum reductions.  Otherwise, they may be undesirable.
They are saner in gfortran than in g++.

If you use OpenMP, of course you would set -fopenmp.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: What optimizaton flags should i use (g++-4.3.3,Linux,Core2Duo)?
  2009-04-19 17:50 ` Tim Prince
@ 2009-04-19 20:05   ` Matthew Lai
  2009-04-20 19:23   ` Ian Lance Taylor
  1 sibling, 0 replies; 7+ messages in thread
From: Matthew Lai @ 2009-04-19 20:05 UTC (permalink / raw)
  To: tprince; +Cc: gcc-help

4.3.3 has
-march=core2


Tim Prince wrote:
> Martin Ettl wrote:
>
>   
>> i am playing around with g++-4.3.3 on Ubuntu Linux. The project i am working does a lot of floating point arithmetic (based on double variables). The testplattform i use, is a intel core 2 duo processor. So what optimization flags are good for this plattform? Currently i am using -O3 -funroll-loops, but there are a plenty other. 
>>
>>     
> If you are using the 64-bit compiler, this may be sufficient, but
> --param max-unrolled-insns=<your choice>
> or
> --param max-unroll-times=4
> may be useful to make the unrolling less aggressive.
>
> I suppose you're not using the 32-bit compiler, where you would set
> -march=pentium-m
> or
> -march=prescott
> or some other option, to enable partial or full use of sse2.
>
> Add -msse3 if you like (either 32- or 64-bit), but you probably have no
> use for it.
>
> -fassociative-math (or, if it doesn't work, -ffast-math) are required for
> vectorization of sum reductions.  Otherwise, they may be undesirable.
> They are saner in gfortran than in g++.
>
> If you use OpenMP, of course you would set -fopenmp.
>   

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: What optimizaton flags should i use (g++-4.3.3,Linux,Core2Duo)?
  2009-04-19 17:50 ` Tim Prince
  2009-04-19 20:05   ` Matthew Lai
@ 2009-04-20 19:23   ` Ian Lance Taylor
  2009-04-21  6:31     ` Martin Ettl
  1 sibling, 1 reply; 7+ messages in thread
From: Ian Lance Taylor @ 2009-04-20 19:23 UTC (permalink / raw)
  To: tprince; +Cc: Martin Ettl, gcc-help

Tim Prince <TimothyPrince@sbcglobal.net> writes:

> Martin Ettl wrote:
>
>> i am playing around with g++-4.3.3 on Ubuntu Linux. The project i am working does a lot of floating point arithmetic (based on double variables). The testplattform i use, is a intel core 2 duo processor. So what optimization flags are good for this plattform? Currently i am using -O3 -funroll-loops, but there are a plenty other. 
>> 
> If you are using the 64-bit compiler, this may be sufficient, but
> --param max-unrolled-insns=<your choice>
> or
> --param max-unroll-times=4
> may be useful to make the unrolling less aggressive.
>
> I suppose you're not using the 32-bit compiler, where you would set
> -march=pentium-m
> or
> -march=prescott
> or some other option, to enable partial or full use of sse2.
>
> Add -msse3 if you like (either 32- or 64-bit), but you probably have no
> use for it.
>
> -fassociative-math (or, if it doesn't work, -ffast-math) are required for
> vectorization of sum reductions.  Otherwise, they may be undesirable.
> They are saner in gfortran than in g++.
>
> If you use OpenMP, of course you would set -fopenmp.

Other options to consider are -mfpmath=sse and -ffast-math.

Ian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: What optimizaton flags should i use (g++-4.3.3,Linux,Core2Duo)?
  2009-04-20 19:23   ` Ian Lance Taylor
@ 2009-04-21  6:31     ` Martin Ettl
  2009-04-21  6:39       ` Brian Budge
  0 siblings, 1 reply; 7+ messages in thread
From: Martin Ettl @ 2009-04-21  6:31 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

Thank you for the tip.
But if i use the -ffast-math option, the result is computed fast but result of my computation is wrong! I am using a lots of double operations and <cmath> functions.

Is this a known issue?

Best regards

Martin

 
-------- Original-Nachricht --------
> Datum: Mon, 20 Apr 2009 12:23:19 -0700
> Von: Ian Lance Taylor <iant@google.com>
> An: tprince@computer.org
> CC: Martin Ettl <ettl.martin@gmx.de>, gcc-help@gcc.gnu.org
> Betreff: Re: What optimizaton flags should i use (g++-4.3.3,Linux,Core2Duo)?

> Tim Prince <TimothyPrince@sbcglobal.net> writes:
> 
> > Martin Ettl wrote:
> >
> >> i am playing around with g++-4.3.3 on Ubuntu Linux. The project i am
> working does a lot of floating point arithmetic (based on double variables).
> The testplattform i use, is a intel core 2 duo processor. So what
> optimization flags are good for this plattform? Currently i am using -O3
> -funroll-loops, but there are a plenty other. 
> >> 
> > If you are using the 64-bit compiler, this may be sufficient, but
> > --param max-unrolled-insns=<your choice>
> > or
> > --param max-unroll-times=4
> > may be useful to make the unrolling less aggressive.
> >
> > I suppose you're not using the 32-bit compiler, where you would set
> > -march=pentium-m
> > or
> > -march=prescott
> > or some other option, to enable partial or full use of sse2.
> >
> > Add -msse3 if you like (either 32- or 64-bit), but you probably have no
> > use for it.
> >
> > -fassociative-math (or, if it doesn't work, -ffast-math) are required
> for
> > vectorization of sum reductions.  Otherwise, they may be undesirable.
> > They are saner in gfortran than in g++.
> >
> > If you use OpenMP, of course you would set -fopenmp.
> 
> Other options to consider are -mfpmath=sse and -ffast-math.
> 
> Ian

-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: What optimizaton flags should i use (g++-4.3.3,Linux,Core2Duo)?
  2009-04-21  6:31     ` Martin Ettl
@ 2009-04-21  6:39       ` Brian Budge
  0 siblings, 0 replies; 7+ messages in thread
From: Brian Budge @ 2009-04-21  6:39 UTC (permalink / raw)
  To: Martin Ettl; +Cc: Ian Lance Taylor, gcc-help

If you rely on IEEE behaviors, you can't use fast-math.  See the gcc
info page for more information regarding that.  fast-math is actually
a collection of options.  You can probably try to figure out a subset
of fast-math that will work for you (for example, you can turn off
setting of errno and turn off signaling NaN and most likely this won't
break your code).

  Brian

On Mon, Apr 20, 2009 at 11:30 PM, Martin Ettl <ettl.martin@gmx.de> wrote:
> Thank you for the tip.
> But if i use the -ffast-math option, the result is computed fast but result of my computation is wrong! I am using a lots of double operations and <cmath> functions.
>
> Is this a known issue?
>
> Best regards
>
> Martin
>
>
> -------- Original-Nachricht --------
>> Datum: Mon, 20 Apr 2009 12:23:19 -0700
>> Von: Ian Lance Taylor <iant@google.com>
>> An: tprince@computer.org
>> CC: Martin Ettl <ettl.martin@gmx.de>, gcc-help@gcc.gnu.org
>> Betreff: Re: What optimizaton flags should i use (g++-4.3.3,Linux,Core2Duo)?
>
>> Tim Prince <TimothyPrince@sbcglobal.net> writes:
>>
>> > Martin Ettl wrote:
>> >
>> >> i am playing around with g++-4.3.3 on Ubuntu Linux. The project i am
>> working does a lot of floating point arithmetic (based on double variables).
>> The testplattform i use, is a intel core 2 duo processor. So what
>> optimization flags are good for this plattform? Currently i am using -O3
>> -funroll-loops, but there are a plenty other.
>> >>
>> > If you are using the 64-bit compiler, this may be sufficient, but
>> > --param max-unrolled-insns=<your choice>
>> > or
>> > --param max-unroll-times=4
>> > may be useful to make the unrolling less aggressive.
>> >
>> > I suppose you're not using the 32-bit compiler, where you would set
>> > -march=pentium-m
>> > or
>> > -march=prescott
>> > or some other option, to enable partial or full use of sse2.
>> >
>> > Add -msse3 if you like (either 32- or 64-bit), but you probably have no
>> > use for it.
>> >
>> > -fassociative-math (or, if it doesn't work, -ffast-math) are required
>> for
>> > vectorization of sum reductions.  Otherwise, they may be undesirable.
>> > They are saner in gfortran than in g++.
>> >
>> > If you use OpenMP, of course you would set -fopenmp.
>>
>> Other options to consider are -mfpmath=sse and -ffast-math.
>>
>> Ian
>
> --
> Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: What optimizaton flags should i use (g++-4.3.3,Linux,Core2Duo)?
  2009-04-19 15:18 What optimizaton flags should i use (g++-4.3.3,Linux,Core2Duo)? Martin Ettl
  2009-04-19 17:50 ` Tim Prince
@ 2009-04-22 15:34 ` Bob Plantz
  1 sibling, 0 replies; 7+ messages in thread
From: Bob Plantz @ 2009-04-22 15:34 UTC (permalink / raw)
  To: Martin Ettl; +Cc: gcc-help

I don't have any good answers for you and am looking forward to
responses from others.

Meanwhile, it might be good to know if you are using 32-bit or 64-bit
mode. The default for gcc's floating point is x87 in 32-bit and it is
SSE2 in 64-bit. That may affect the performance of your code.

Does your application lend itself to any parallelization? For example,
openMP?

Bob

On Sun, 2009-04-19 at 17:18 +0200, Martin Ettl wrote:
> Hello all,
> 
> i am playing around with g++-4.3.3 on Ubuntu Linux. The project i am working does a lot of floating point arithmetic (based on double variables). The testplattform i use, is a intel core 2 duo processor. So what optimization flags are good for this plattform? Currently i am using -O3 -funroll-loops, but there are a plenty other. 
> 
> Thanks in advance!
> 
> Best regards
> 
> Ettl Martin
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-04-22 15:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-19 15:18 What optimizaton flags should i use (g++-4.3.3,Linux,Core2Duo)? Martin Ettl
2009-04-19 17:50 ` Tim Prince
2009-04-19 20:05   ` Matthew Lai
2009-04-20 19:23   ` Ian Lance Taylor
2009-04-21  6:31     ` Martin Ettl
2009-04-21  6:39       ` Brian Budge
2009-04-22 15:34 ` Bob Plantz

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).