DiscoCheck 4.0.0 (release candidate)

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

User avatar
velmarin
Posts: 1600
Joined: Mon Feb 21, 2011 9:48 am

Re: DiscoCheck 4.0.0 (release candidate)

Post by velmarin »

It is the problem of "pure linux".

They have to compile for most "windows users".

But it's good to be out of the ordinary.
While having these things.


It is increasingly difficult to compile this code in "Windows meant".

Thanks for the efforts.
Master Teacher, Judge of the clones and derivatives.
User avatar
Jim Ablett
Posts: 2330
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: DiscoCheck 4.0.0 (release candidate)

Post by Jim Ablett »

Hi Lucas,

just a suggestion but if you use GCC built-in intrinsics instead of asm for your lsb()/msb() code it would
be more portable and would enable 32 bit & Android compiles to be built easily as well.

Code: Select all

inline int lsb(Bitboard b)
{
	
return __builtin_ffsll(b) - 1;

}

inline int msb(Bitboard b)
{
	

int64_t ret = sizeof(uint64_t) * CHAR_BIT - 1;
	return b ? ret - __builtin_clzll(b) : ret;

}
Jim.
lucasart
Posts: 3242
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: DiscoCheck 4.0.0 (release candidate)

Post by lucasart »

Jim Ablett wrote:Hi Lucas,

just a suggestion but if you use GCC built-in intrinsics instead of asm for your lsb()/msb() code it would
be more portable and would enable 32 bit & Android compiles to be built easily as well.

Code: Select all

inline int lsb(Bitboard b)
{
	
return __builtin_ffsll(b) - 1;

}

inline int msb(Bitboard b)
{
	

int64_t ret = sizeof(uint64_t) * CHAR_BIT - 1;
	return b ? ret - __builtin_clzll(b) : ret;

}
Jim.
Hey thanks, this is great! And far more portable than my lame bsfq. I'll try that and see if I can get an ARM and Linux 32-bit compile with it. Would love to be able to use DiscoCheck on my cell phone.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
User avatar
Jim Ablett
Posts: 2330
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: DiscoCheck 4.0.0 (release candidate)

Post by Jim Ablett »

lucasart wrote:
Jim Ablett wrote:Hi Lucas,

just a suggestion but if you use GCC built-in intrinsics instead of asm for your lsb()/msb() code it would
be more portable and would enable 32 bit & Android compiles to be built easily as well.

Code: Select all

inline int lsb(Bitboard b)
{
	
return __builtin_ffsll(b) - 1;

}

inline int msb(Bitboard b)
{
	

int64_t ret = sizeof(uint64_t) * CHAR_BIT - 1;
	return b ? ret - __builtin_clzll(b) : ret;

}
Jim.
Hey thanks, this is great! And far more portable than my lame bsfq. I'll try that and see if I can get an ARM and Liux 32-bit compile with it. Would love to be able to use DiscoCheck on my cell phone.

Arm might need ctzll for the lsb, I'm not sure>

Code: Select all

inline int lsb(Bitboard b)
{
   
return __builtin_ctzll(b) - 1;

} 

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

Re: DiscoCheck 4.0.0 (release candidate)

Post by Jim Ablett »

I think built-in popcount is better too. It will drop back to c code version (which is the same as your version) without -mpopcnt switch

Code: Select all

int count_bit_max15(Bitboard b)
/* Counts the '1' in a bitboard, using the so-called SWAR approach:
 * http://chessprogramming.wikispaces.com/Population+Count */
{
	
return __builtin_popcountll(b);
}

To enable hardware enabled popcount builds. These are the switches I use >

Code: Select all

# for popcount (AMD)   =   -march=amdfam10 -mtune=amdfam10 -mpopcnt
# for popcount (INTEL) =   -msse4.2 -march=corei7 -mtune=corei7 -mpopcnt
Jim.
User avatar
Jim Ablett
Posts: 2330
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: DiscoCheck 4.0.0 (release candidate)

Post by Jim Ablett »

lucasart wrote:
Werner wrote:Hi Lucas,
thanks for the engine.
Sorry, does not run here - missing dll
libgcc_s_sjlj

can you please compile once more - or help how to use the exe?

best wishes
Werner
I think the cross compiler (mingw-w64) could be at fault here. Here's another attempt, this time compiling libgcc statically:

Code: Select all

$ x86_64-w64-mingw32-g++ ./src/*.cc -o ./bin/DC401_win64.exe -static-libgcc -DNDEBUG -std=c++0x -O3 -flto -fno-rtti -Wall
I don't have Windows, so I can't really verify myself if it works. But I've put the new executable in ./bin/DC401_win64.exe
If that trick still fails, then I'm out of tricks :cry:
Perhaps Jim Ablett can come and rescue me

I'm doing some builds. They will be along shortly.

Jim.
User avatar
Werner
Posts: 2997
Joined: Wed Mar 08, 2006 10:09 pm
Location: Germany
Full name: Werner Schüle

Re: DiscoCheck 4.0.0 (release candidate)

Post by Werner »

lucasart wrote:
Werner wrote:Hi Lucas,
thanks for the engine.
Sorry, does not run here - missing dll
libgcc_s_sjlj

can you please compile once more - or help how to use the exe?

best wishes
Werner
I think the cross compiler (mingw-w64) could be at fault here. Here's another attempt, this time compiling libgcc statically:

Code: Select all

$ x86_64-w64-mingw32-g++ ./src/*.cc -o ./bin/DC401_win64.exe -static-libgcc -DNDEBUG -std=c++0x -O3 -flto -fno-rtti -Wall
I don't have Windows, so I can't really verify myself if it works. But I've put the new executable in ./bin/DC401_win64.exe
If that trick still fails, then I'm out of tricks :cry:
Perhaps Jim Ablett can come and rescue me
Hi Lucas,
now another dll is missed. I ask Jim for help :lol:
Werner
User avatar
Jim Ablett
Posts: 2330
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: DiscoCheck 4.0.0 (release candidate)

Post by Jim Ablett »

lucasart wrote:
Werner wrote:Hi Lucas,
thanks for the engine.
Sorry, does not run here - missing dll
libgcc_s_sjlj

can you please compile once more - or help how to use the exe?

best wishes
Werner
I think the cross compiler (mingw-w64) could be at fault here. Here's another attempt, this time compiling libgcc statically:

Code: Select all

$ x86_64-w64-mingw32-g++ ./src/*.cc -o ./bin/DC401_win64.exe -static-libgcc -DNDEBUG -std=c++0x -O3 -flto -fno-rtti -Wall
I don't have Windows, so I can't really verify myself if it works. But I've put the new executable in ./bin/DC401_win64.exe
If that trick still fails, then I'm out of tricks :cry:
Perhaps Jim Ablett can come and rescue me

Try using gcc instead of g++ and including the whole stdc++ library >

Code: Select all

-Wl,--whole-archive -lstdc++ -Wl,--no-whole-archive
and make sure you strip it

Code: Select all

-s
Jim.
User avatar
Jim Ablett
Posts: 2330
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: DiscoCheck 4.0.0 (release candidate)

Post by Jim Ablett »

I can confirm this works for Arm/Android >

Code: Select all

inline int lsb(Bitboard b)
{
	
return __builtin_ffsll(b) - 1;

}

inline int msb(Bitboard b)
{
	

int64_t ret = sizeof(uint64_t) * CHAR_BIT - 1;
	return b ? ret - __builtin_clzll(b) : ret;

}
You may need to add >

Code: Select all

#include <limits.h>
for the 'CHAR_BIT'

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

Re: DiscoCheck 4.0.0 (release candidate)

Post by Jim Ablett »

Image
DiscoCheck 4.0.0 JA by Lucas Braesch

Here are my compiles built using Gcc built-in intrinsics for Msb/Lsb/Popcount (which I mentioned earlier)

This package is 'The Full Monty' :)

Windows/Linux/Android 64/32 bit & hardware popcount versions.

https://dl.dropbox.com/u/5047625/discocheck-400-ja.zip
Mirror:
http://cl.ly/MTp6/discocheck-400-ja.zip

Android direct link:
https://dl.dropbox.com/u/5047625/discoc ... android-ja

Code: Select all

32 bit bench (32 bit system)

signature = 7217665
time = 39.4219


64 bit bench 

signature = 7217665
time = 24.5938
Jim.