Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Eperimental Paralellization and Vectorization CFLAGS
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
Well.Heeled.Man
n00b
n00b


Joined: 25 Aug 2011
Posts: 19

PostPosted: Mon Sep 05, 2011 6:16 pm    Post subject: Eperimental Paralellization and Vectorization CFLAGS Reply with quote

Hi folks,

On the back of this article I thought I would experiment with these flags.

http://gcc.gnu.org/wiki/LoopOptimizationsBOF

# CFLAGS
CFLAGS="-march=native -O2 -pipe"
CFLAGS="${CFLAGS} -floop-interchange -floop-strip-mine -floop-block -ftree-parallelize-loops=3"
#CFLAGS="${CFLAGS} -flto -fwhole-program"
CFLAGS="${CFLAGS} -ftree-vectorize"
CXXFLAGS="${CFLAGS}"

# LDFLAGS
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,--hash-style=gnu"
#LDFLAGS="${LDFLAGS} -flto -fwhole-program"

As far as I can see, everything builds (but I have not done anything drastic like, 'emerge -e system/world' - although I have with just -floop-interchange -floop-strip-mine -floop-block, with no failures).

Has anyone played around with any of these flags? Am I doing something bat-shit crazy playing with these flags? It seems that the first three flags lend themselves to being auto-parallelized by the fourth, and the fifth is the auto-vectorization pass.

I have a Core 2 T7200 2GHZ and 4gb RAM.

Any thoughts on this?
Back to top
View user's profile Send private message
Etal
Veteran
Veteran


Joined: 15 Jul 2005
Posts: 1696

PostPosted: Mon Sep 05, 2011 10:14 pm    Post subject: Re: Eperimental Paralellization and Vectorization CFLAGS Reply with quote

Well.Heeled.Man wrote:

# CFLAGS
CFLAGS="-march=native -O2 -pipe"
CFLAGS="${CFLAGS} -floop-interchange -floop-strip-mine -floop-block -ftree-parallelize-loops=3"

Aside from -ftree-parallelize-loops, these are all considered pretty safe. If I remember correctly, it might cause slowdowns since in many cases it would parallelize things where it's counterproductive, but don't quote me on that.

Well.Heeled.Man wrote:
#CFLAGS="${CFLAGS} -flto -fwhole-program"

These (if you uncommented them) would not be a good idea unless you're using gcc-4.6. They are unsupported, though, in either case.

Well.Heeled.Man wrote:

CFLAGS="${CFLAGS} -ftree-vectorize"
CXXFLAGS="${CFLAGS}"

This might cause a few build failures and crashes. It also might cause a significant slowdown in ffmpeg, among other things.

Well.Heeled.Man wrote:

# LDFLAGS
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,--hash-style=gnu"
#LDFLAGS="${LDFLAGS} -flto -fwhole-program"

Your syntax is wrong here. It should be "-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,--hash-style=gnu"

Aside from -Wl,--sort-common, you don't have anything too exotic here.
_________________
“And even in authoritarian countries, information networks are helping people discover new facts and making governments more accountable.”– Hillary Clinton, Jan. 21, 2010
Back to top
View user's profile Send private message
Well.Heeled.Man
n00b
n00b


Joined: 25 Aug 2011
Posts: 19

PostPosted: Mon Sep 05, 2011 10:42 pm    Post subject: Reply with quote

Thanks Etal,

Yeah, I read that it can cause slowdowns as there is no value assessment before the optimization, but I was hoping that parallelization would be faster on the whole. I guess I will need to look for serious problems. I am hoping that -ftree-vectorize would likewise be faster on the whole.

I also added -ftree-loop-distribution as the GCC Man states that it allows (required for?) parallelization and vector optimizations.

Cheers,

Scott
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum