How to program multi processor and 64 bit chess engines

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
hgm
Posts: 27851
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: How to program multi processor and 64 bit chess engines

Post by hgm »

Gandalf wrote:Funny. Yet, I am still no closer to understanding what is wrong with what I posted... As a guess, should I have said something like "it is an impossibly difficult task that requires you to completely rewrite critical portions of your code"?
Exactly.

Numbers in chess hardly every go beyond 64, so having more than 6 bits word length doesn't directly affect performance. To exploit 64-bit arithmetic, people switch to completely different algorithms of move generation ('magic bitboard').For most engines, that would require a complete rewrite.

To exploit SMP is even worse. The compiler can't help you here at all, it requires special parallelized search algorithms like 'Young Brothers Waiting'.
Alessandro Scotti

Re: How to program multi processor and 64 bit chess engines

Post by Alessandro Scotti »

Gandalf wrote:Funny. Yet, I am still no closer to understanding what is wrong with what I posted... As a guess, should I have said something like "it is an impossibly difficult task that requires you to completely rewrite critical portions of your code"?
Well this probably would be a little more closer to the truth! :wink:

In fact, I think the two problems must be considered separately.

For 64 bits, the compiler will indeed do most of the job. However, it will do little good if you don't have in your program some stuff that can take advantage of 64 bit architectures. For example, in Hamsters there are very few 64 bit variables, basically just for the hash keys and the node counts. So I don't expect much from a 64 bit recompile. But Kiwi (also Crafty and Glaurung) is based on bitboards and makes heavy use of 64 bit data and operations, so a good speedup is expected.

The SMP problem is different. The compiler here will do no good to a chess program. Although there are libraries and techniques that can take a C or C++ program and make it parallel (usually with some help from the programmer) in most chess programs the code flows in a way that makes it impossible to take full advantage of SMP architectures without rewriting the search algorithm. Thanks to the pioneering work of Bob and Tord, who recently did an amazing job of simplifying the algorithm and implementation down to human levels, this is not an "impossibly difficult task" anymore, but it's still not something you program while watching a movie...
Tord Romstad
Posts: 1808
Joined: Wed Mar 08, 2006 9:19 pm
Location: Oslo, Norway

Re: How to program multi processor and 64 bit chess engines

Post by Tord Romstad »

Dariusz Orzechowski wrote:On topic: take a look at the Viper by Tord Romstad. It should fit your needs.
Except that it is far too complicated and poorly commented. :(

I hope I'll find the time to update and simplify the program some day.

Tord
Gandalf

Re: How to program multi processor and 64 bit chess engines

Post by Gandalf »

Thanks for the explanations, glad I was closer this time around. :)

I guess I was misguided by the fact that you can just compile a 64 bit executable with no modifications to your code and a bit ignorant to the changes required for parallel searching.
kaustubh

Re: How to program multi processor and 64 bit chess engines

Post by kaustubh »

can you explain this option gcc engine.c elo= 3500
F. Bluemers
Posts: 868
Joined: Thu Mar 09, 2006 11:21 pm
Location: Nederland

Re: How to program multi processor and 64 bit chess engines

Post by F. Bluemers »

kaustubh wrote:can you explain this option gcc engine.c elo= 3500
pity it takes gcc such a long long time when using this option ....
:lol:
best
Fonzy
Dariusz Orzechowski

Re: How to program multi processor and 64 bit chess engines

Post by Dariusz Orzechowski »

Volker Pittlik wrote:
Dariusz Orzechowski wrote:...It's really sad to watch such "experts"...
Or even worse to answer to them.

P.S. It seems your irony detector is buggy.

eod
My irony detector doesn't operate in such a range and has problems with remarks as subtle as a road roller.
Volker Pittlik
Posts: 619
Joined: Wed Mar 08, 2006 9:10 pm
Location: Murten / Morat, Switzerland
Full name: Volker Pittlik

Re: How to program multi processor and 64 bit chess engines

Post by Volker Pittlik »

Dariusz Orzechowski wrote:...
My irony detector doesn't operate in such a range...
Good we can agree it is buggy.