Linux Version of Maverick 1.5

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

Moderators: hgm, Rebel, chrisw

User avatar
Steve Maughan
Posts: 1221
Joined: Wed Mar 08, 2006 8:28 pm
Location: Florida, USA

Linux Version of Maverick 1.5

Post by Steve Maughan »

Thanks to Antonio Arias there is now a couple of Linux version included in the distribution.

For those interested you can download them here:

http://www.chessprogramming.net/downloads/

FYI it looks as if Maverick 1.5 is playing at around 2550 ELO on the CCRL scale

- Steve
http://www.chessprogramming.net - Maverick Chess Engine
User avatar
MikeB
Posts: 4889
Joined: Thu Mar 09, 2006 6:34 am
Location: Pen Argyl, Pennsylvania

Re: Linux Version of Maverick 1.5

Post by MikeB »

Steve Maughan wrote:Thanks to Antonio Arias there is now a couple of Linux version included in the distribution.

For those interested you can download them here:

http://www.chessprogramming.net/downloads/

FYI it looks as if Maverick 1.5 is playing at around 2550 ELO on the CCRL scale

- Steve
Had to add this define to bittwiddle.h

Code: Select all

#if defined (OSX)
#include <pmmintrin.h>
#else
#include <intrin.h>
#endif
And with that - we almost have a Mac version, down to three errors.

Code: Select all

In file included from bitboards.cpp&#58;17&#58;
./bittwiddle.h&#58;85&#58;5&#58; error&#58; use of undeclared identifier '_BitScanForward64'
    _BitScanForward64&#40;&index, b&#41;;
    ^
./bittwiddle.h&#58;94&#58;5&#58; error&#58; use of undeclared identifier '_BitScanForward64'
    _BitScanForward64&#40;&index, *b&#41;;
    ^
./bittwiddle.h&#58;119&#58;12&#58; error&#58; use of undeclared identifier '__popcnt64'
    return __popcnt64&#40;b&#41;;


Anyone else have any other suggestions?
User avatar
Steve Maughan
Posts: 1221
Joined: Wed Mar 08, 2006 8:28 pm
Location: Florida, USA

Re: Linux Version of Maverick 1.5

Post by Steve Maughan »

Hi Mike,
MikeB wrote:(...)And with that - we almost have a Mac version, down to three errors.

Code: Select all

In file included from bitboards.cpp&#58;17&#58;
./bittwiddle.h&#58;85&#58;5&#58; error&#58; use of undeclared identifier '_BitScanForward64'
    _BitScanForward64&#40;&index, b&#41;;
    ^
./bittwiddle.h&#58;94&#58;5&#58; error&#58; use of undeclared identifier '_BitScanForward64'
    _BitScanForward64&#40;&index, *b&#41;;
    ^
./bittwiddle.h&#58;119&#58;12&#58; error&#58; use of undeclared identifier '__popcnt64'
    return __popcnt64&#40;b&#41;;


Anyone else have any other suggestions?
It would be great to have a Mac version. Anyone else able to chip in to get it to compile?

Thanks,

Steve
http://www.chessprogramming.net - Maverick Chess Engine
User avatar
mid
Posts: 22
Joined: Thu Dec 11, 2014 6:34 am
Location: Cupertino, California

Re: Linux Version of Maverick 1.5

Post by mid »

On OSX both _BitScanForward64 and __popcnt64 are defined in Intrin.h (comes with Xcode/clang 6.0).

I should be able to take closer look tomorrow.

Best,
Michael
-- http://www.dvorkin.net
User avatar
Jim Ablett
Posts: 1383
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: Linux Version of Maverick 1.5

Post by Jim Ablett »

Can replace with intrinsics >

Code: Select all

__inline int FirstBit&#40;U64 val&#41;  &#123;       // LSB // FirstBit // FirstOne // BitScanForward // BSF
return __builtin_ffsll&#40;val&#41; - 1;
&#125;


__inline int LastBit&#40;U64 val&#41;  &#123;       //  MSB // LastBit // LastOne // BitScanReverse // BSR
return 63 - __builtin_clzll&#40;val&#41;;
&#125;


__inline int BitCount&#40;U64 b&#41;
&#123;
	return __builtin_popcountll&#40;b&#41;;
&#125;
Jim.
User avatar
mid
Posts: 22
Joined: Thu Dec 11, 2014 6:34 am
Location: Cupertino, California

Re: Linux Version of Maverick 1.5

Post by mid »

Hi Steve,

Made it compile on OSX: https://github.com/michaeldv/maverick-1.5-osx

To see the changes check out https://github.com/michaeldv/maverick-1 ... its/master -- second pair of eyes would be good. :-)

Clang threw tons of warnings, you might want to check them out as well: https://gist.github.com/michaeldv/118fbbb66a7d787b119e

HTH,
Michael
-- http://www.dvorkin.net
User avatar
MikeB
Posts: 4889
Joined: Thu Mar 09, 2006 6:34 am
Location: Pen Argyl, Pennsylvania

Re: Linux Version of Maverick 1.5

Post by MikeB »

mid wrote:Hi Steve,

Made it compile on OSX: https://github.com/michaeldv/maverick-1.5-osx

To see the changes check out https://github.com/michaeldv/maverick-1 ... its/master -- second pair of eyes would be good. :-)

Clang threw tons of warnings, you might want to check them out as well: https://gist.github.com/michaeldv/118fbbb66a7d787b119e

HTH,
Michael
-- http://www.dvorkin.net
Steve/Michael:

Very good. Ok for gcc compile on OSX - I made these changes:

Code: Select all

uci.cpp ->removed "__stdcall" 
line 41&#58;
/*unsigned __stdcall engine_loop&#40;void* pArguments&#41; delete __stdcall for OSX&#41;*/
unsigned engine_loop&#40;void* pArguments&#41;

proca.h ->removed "__stdcall"
line 11&#58;
/*unsigned __stdcall engine_loop&#40;void* pArguments&#41;;  delete __stdcall for OSX */
unsigned engine_loop&#40;void* pArguments&#41;;
and gcc PGO make file:

Code: Select all

# Makefile to build Maverick 1.5 on OS X.
# type "make" ; for subsequent builds, type "make clean" , then "make"

#comment in/out the depending on the build you are making
# make first build with  -fprofile-generate flag
# run a few test positions 
# make final build with  -fprofile-use flag
# at this point , very little pickup using PGO, clang is a fraction slower on my machine &#40;20ms&#41;

CC = g++ -pipe -O3 -Ofast -mtune=native -fprofile-generate
#CC = g++ -pipe -O3 -Ofast -mtune=native -fprofile-use
#CC = clang -pipe -O3 -Ofast -mtune=native

APP = maverick-1.5-osx-64
SRC = $&#40;wildcard *.cpp&#41;
OBJ = $&#40;SRC&#58;.cpp=.o&#41;
LDFLAGS='-libc++ -pthread'

$&#40;APP&#41;&#58; $&#40;OBJ&#41;
	$&#40;CC&#41; $&#40;LDFLAGS&#41; -c $&#40;SRC&#41;
	$&#40;CC&#41; -o $&#40;APP&#41; $&#40;OBJ&#41;

clean&#58;
	rm -f *.o
	rm -f $&#40;APP&#41;
suedo bench ( go depth 15 from start position)

Code: Select all

id name Maverick 1.5 x64 osx
id author Steve Maughan
option name Hash type spin default 64 min 2 max 1024
option name Ponder type check default true
option name Book Selectivity type combo default Normal var Random var Varied var Normal var Discerning var Tournament
option name UCI_ShowCurrLine type check default false
option name UCI_Chess960 type check default false
option name UCI_EngineAbout type string default Maverick 1.5 x64 osx by Steve Maughan www.chessprogramming.net
option name Show Search Statistics type check default true
option name Futility Pruning type check default false
uciok
...
info nodes 4360009 nps 565573
bestmove e2e4 ponder d7d5

fwiw, a ton of warnings with clang and gcc