GCC Compiling

Discussion of chess software programming and technical issues.

Moderator: Ras

Edsel Apostol
Posts: 803
Joined: Mon Jul 17, 2006 5:53 am
Full name: Edsel Apostol

GCC Compiling

Post by Edsel Apostol »

The current IDE I'm using right now is Code Blocks 8.02 bundled with GCC 4.2.1. My OS is Windows XP SP2.

I can't find any documentation of the GCC compiler on Code Blocks so I decided to post here so that one of the experts on the matter might give some useful advise.

Does the GCC compiler support PGO? If so, what are the things I need to do to enable it?

My engine Twisted Logic is a bitboard engine and it will surely benefit from a 64 bit compile. Does anyone know how to achieve this using GCC?

I also have plans of adding SMP to my engine and I want to know if GCC supports multi-threading. Do I need to download some special libraries and where can I find them?
User avatar
Jim Ablett
Posts: 2146
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: GCC Compiling

Post by Jim Ablett »

Edsel Apostol wrote:The current IDE I'm using right now is Code Blocks 8.02 bundled with GCC 4.2.1. My OS is Windows XP SP2.

I can't find any documentation of the GCC compiler on Code Blocks so I decided to post here so that one of the experts on the matter might give some useful advise.

Does the GCC compiler support PGO? If so, what are the things I need to do to enable it?

My engine Twisted Logic is a bitboard engine and it will surely benefit from a 64 bit compile. Does anyone know how to achieve this using GCC?

I also have plans of adding SMP to my engine and I want to know if GCC supports multi-threading. Do I need to download some special libraries and where can I find them?
Hello Edsel,

For profile guided optimization use

Code: Select all

-fprofile-generate
and on final build use

Code: Select all

-fprofile-use
For 64 bit use special 64bit mingw
http://sourceforge.net/projects/mingw-w64/

For threading you could use with mingw - win32 pthreads library
http://sourceware.org/pthreads-win32/

or with gcc-cygwin using built-in linux pthreads support

regards,
Jim.
User avatar
Bo Persson
Posts: 257
Joined: Sat Mar 11, 2006 8:31 am
Location: Malmö, Sweden
Full name: Bo Persson

Re: GCC Compiling

Post by Bo Persson »

Edsel Apostol wrote:The current IDE I'm using right now is Code Blocks 8.02 bundled with GCC 4.2.1. My OS is Windows XP SP2.

I can't find any documentation of the GCC compiler on Code Blocks so I decided to post here so that one of the experts on the matter might give some useful advise.
Why not try this:

http://gcc.gnu.org/onlinedocs/
Edsel Apostol
Posts: 803
Joined: Mon Jul 17, 2006 5:53 am
Full name: Edsel Apostol

Re: GCC Compiling

Post by Edsel Apostol »

Thanks Jim!

That's all the answer I need.
Edsel Apostol
Posts: 803
Joined: Mon Jul 17, 2006 5:53 am
Full name: Edsel Apostol

Re: GCC Compiling

Post by Edsel Apostol »

Thanks Bo.
User avatar
Jim Ablett
Posts: 2146
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: GCC Compiling

Post by Jim Ablett »

You can also get 64-bit pthread libraries as part of the Mozilla-64 build tools.

http://www.mozilla-x86-64.com/download.html

Jim.
User avatar
Denis P. Mendoza
Posts: 415
Joined: Fri Dec 15, 2006 9:46 pm
Location: Philippines

Re: GCC Compiling

Post by Denis P. Mendoza »

Ed,

I already included what everybody here suggested in the package I will send to you. Jim has been very helpful when it comes to compiling, so I got everything I need. I owe it to him.

Since you're just a few miles away from me, why not send you a CD to avoid the hassle of downloading kabayan! Siyempre may kasamang bonus pa!

We are hoping for a faster TwistedLogic anytime soon.

Denis
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: GCC Compiling

Post by bob »

Edsel Apostol wrote:The current IDE I'm using right now is Code Blocks 8.02 bundled with GCC 4.2.1. My OS is Windows XP SP2.

I can't find any documentation of the GCC compiler on Code Blocks so I decided to post here so that one of the experts on the matter might give some useful advise.

Does the GCC compiler support PGO? If so, what are the things I need to do to enable it?
Yes. compile with the option -fprofile-arcs, then run some representative test cases, then re-compile with the option -fbranch-probabilities and you are done.

My engine Twisted Logic is a bitboard engine and it will surely benefit from a 64 bit compile. Does anyone know how to achieve this using GCC?
You need to run a 64 bit operating system. If you do, then the compiler should produce 64 bit code by default... without a 64 bit O/S, you can't run 64 bit applications.

I also have plans of adding SMP to my engine and I want to know if GCC supports multi-threading. Do I need to download some special libraries and where can I find them?
[/quote]

SMP is a function of your operating system. Standard libraries provide you with facilities to create new processes, etc... So you should be good to go there with any compiler and no add-ons needed.
Edsel Apostol
Posts: 803
Joined: Mon Jul 17, 2006 5:53 am
Full name: Edsel Apostol

Re: GCC Compiling

Post by Edsel Apostol »

Thanks Kuya.

I have learned a lot in my three years of computer programming experience and I could already write efficient code. One can see that the latest version now is almost twice as fast as the version I have last year. A better compiler would even make it faster.

My goal is to try to reach or surpass the Strelka NPS. It is 50 to 75 percent faster than my engine right now in 32 bit. Every 2 percent of speed-up is worth 1 elo. :)
User avatar
Jim Ablett
Posts: 2146
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: GCC Compiling

Post by Jim Ablett »

Edsel Apostol wrote:Thanks Kuya.

I have learned a lot in my three years of computer programming experience and I could already write efficient code. One can see that the latest version now is almost twice as fast as the version I have last year. A better compiler would even make it faster.

My goal is to try to reach or surpass the Strelka NPS. It is 50 to 75 percent faster than my engine right now in 32 bit. Every 2 percent of speed-up is worth 1 elo. :)
Just using msvc in instead of gcc could give you an extra 30% maybe more.

Jim.