DiscoCheck 4.0.0 (release candidate)
Moderator: Ras
- 
				velmarin  
- Posts: 1600
- Joined: Mon Feb 21, 2011 9:48 am
Re: DiscoCheck 4.0.0 (release candidate)
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.
			
			
									
						
										
						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.
- 
				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)
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.
Jim.
			
			
									
						
										
						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;
}- 
				lucasart
- Posts: 3242
- Joined: Mon May 31, 2010 1:29 pm
- Full name: lucasart
Re: DiscoCheck 4.0.0 (release candidate)
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.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.
Jim.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; }
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
			
						- 
				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)
lucasart wrote: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.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.
Jim.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; }
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.
- 
				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)
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
To enable hardware enabled popcount builds. These are the switches I use >
Jim.
			
			
									
						
										
						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 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)
lucasart wrote:I think the cross compiler (mingw-w64) could be at fault here. Here's another attempt, this time compiling libgcc statically: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
WernerI 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.exeCode: 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
If that trick still fails, then I'm out of tricks
Perhaps Jim Ablett can come and rescue me
I'm doing some builds. They will be along shortly.
Jim.
- 
				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)
Hi Lucas,lucasart wrote:I think the cross compiler (mingw-w64) could be at fault here. Here's another attempt, this time compiling libgcc statically: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
WernerI 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.exeCode: 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
If that trick still fails, then I'm out of tricks
Perhaps Jim Ablett can come and rescue me
now another dll is missed. I ask Jim for help

Werner
			
						- 
				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)
lucasart wrote:I think the cross compiler (mingw-w64) could be at fault here. Here's another attempt, this time compiling libgcc statically: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
WernerI 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.exeCode: 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
If that trick still fails, then I'm out of tricks
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-archiveCode: Select all
-s- 
				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)
I can confirm this works for Arm/Android >
You may need to add  > 
for the 'CHAR_BIT' 
Jim.
			
			
									
						
										
						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;
}
Code: Select all
#include <limits.h>Jim.
- 
				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)

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