Cfish for the Mac

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

Moderators: hgm, Rebel, chrisw

User avatar
MikeB
Posts: 4889
Joined: Thu Mar 09, 2006 6:34 am
Location: Pen Argyl, Pennsylvania

Cfish for the Mac

Post by MikeB »

I forked Ronald De Man's cfish github page https://github.com/syzygy1/Cfish and replaced the standard makefile with one that is specifically tailor for those running MacOS based machines.

https://github.com/MichaelB7/cfish There is a MacOS exe on the github page

The makefile below will use clang and build a custom profile guided optimized (PGO) version of this stockfish derivative for your MacOS based computer. Simply type "make" at the command line where you have the source and it will build it in just a few seconds. Btw, this makefile is a direct descendant of the makefile Bob Hyatt uses for Crafty. Building a PGO version on your MacOS computer virtually assures you will have the fastest possible exe for your machine.

Code: Select all

mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
CFISH= $(current_dir:.d=)
CC=clang
LDFLAGS=
STRIP=strip

default:
	$(MAKE) -j cpro
help:
	@echo "type make"
	@echo ""

clang:
	@/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/llvm-profdata merge -output=code.profdata *.profraw
	$(MAKE) -j target=UNIX \
	CC=clang \
	opt='-DUNIX -DUSE_POPCNT -DNDEBUG -DIS_64BIT -DAPPLE' \
	CFLAGS='-Wall -m64 -arch x86_64 -mmacosx-version-min=10.9 -pthread -std=c11 -mtune=native \
	-march=native -pedantic -Wextra -Wshadow -O3 -mdynamic-no-pic \
     -mssse3 -mpopcnt -fprofile-instr-use=code.profdata' \
	LDFLAGS='$(LDFLAGS) -fprofile-use ' \
	cfish-make

clang-profile:
	$(MAKE) -j target=x86_64 \
	CC=clang \
	opt='-DUNIX -DUSE_POPCNT -DNDEBUG -DIS_64BIT -DAPPLE' \
	CFLAGS='-Wall -m64 -arch x86_64 -mmacosx-version-min=10.9 -pthread -std=c11 -mtune=native \
    -march=native -pedantic -Wextra -Wshadow -Os -O3 -mdynamic-no-pic \
	-msse4.2 -mpopcnt -fprofile-instr-generate ' \
	LDFLAGS='$(LDFLAGS) -fprofile-instr-generate  ' \
	cfish-make

cpro:
	@rm -rf *.o
	@rm -rf log.*
	@rm -rf game.*
	@rm -rf prof
	@rm -rf *.profraw
	@rm -rf *.profdata
	@rm -rf $(CFISH)
	@mkdir prof
	@touch *.c  *.h
	$(MAKE) -j clang-profile
	@echo "#!/bin/csh" > runprof
	@echo "./$&#40;CFISH&#41; <<EOF" >>runprof
	@echo "bench 16 1 10" >>runprof
	@echo "quit" >>runprof
	@echo "EOF" >>runprof
	@chmod +x runprof
	@./runprof
	@rm runprof
	@touch *.c *.h
	$&#40;MAKE&#41; -j clang
	$&#40;STRIP&#41; $&#40;CFISH&#41;

objects =  search.o bitboard.o evaluate.o movegen.o  bitbase.o movepick.o benchmark.o \
endgame.o  main.o material.o misc.o  pawns.o position.o psqt.o tbprobe.o thread.o \
timeman.o tt.o uci.o ucioption.o numa.o settings.o

# Do not change anything below this line

opts = $&#40;opt&#41; -D$&#40;target&#41;

#	@$&#40;MAKE&#41; -j opt='$&#40;opt&#41;'  CFLAGS='$&#40;CFLAGS&#41;' $&#40;CFISH&#41;
cfish-make&#58;
	@$&#40;MAKE&#41; opt='$&#40;opt&#41;'  CFLAGS='$&#40;CFLAGS&#41;' $&#40;CFISH&#41;

cfish.o&#58; *.c *.h

$&#40;CFISH&#41;&#58;	$&#40;objects&#41;
	$&#40;CC&#41; $&#40;LDFLAGS&#41; -o $&#40;CFISH&#41; $&#40;objects&#41; -lm  $&#40;LIBS&#41;

clean&#58;
	-rm -f *.o $&#40;CFISH&#41;

$&#40;objects&#41;&#58;

.c.o&#58;
	$&#40;CC&#41; $&#40;CFLAGS&#41; $&#40;opts&#41; -c $*.c
User avatar
MikeB
Posts: 4889
Joined: Thu Mar 09, 2006 6:34 am
Location: Pen Argyl, Pennsylvania

Re: Cfish for the Mac

Post by MikeB »

there's a new cfish with a modified evaluation...

testing underway with tc 3 min with 3 sec increment - which on my machine would be equal to 5/5 on CCRL..should be interesting at this time control

Code: Select all

40 of 20000 games completed...
time control&#58; 18000+300
Date&#58; 10/17/16 &#58; 23&#58;38&#58;29
40 game&#40;s&#41; loaded
Rank Name                      Rating   &#916;     +    -     #     &#931;    &#931;%     W    L    D   W%    =%   OppR 
------------------------------------------------------------------------------------------------------
   1 Stockfish 101016-12y       3123   0.0   68   68    16    9.0  56.2    5    3    8  31.2  50.0  3094 
   2 Stockfish 101016 64 POPC   3121   2.3   68   68    16    8.5  53.1    6    5    5  37.5  31.2  3095 
   3 Cfish 101716-12y 64 POPC   3100  20.8   66   66    16    8.0  50.0    4    4    8  25.0  50.0  3100 
   4 Cfish 171016 64 POPCNT     3095   4.9   67   67    16    8.0  50.0    4    4    8  25.0  50.0  3101 
   5 Komodo 10.1 64-bit         3061  34.6   69   69    16    6.5  40.6    3    6    7  18.8  43.8  3110 
------------------------------------------------------------------------------------------------------
Ronald de Man's cfish source: https://github.com/syzygy1/Cfish
cfish fork source: https://github.com/MichaelB7/cfish
cfish-101716-12y MacOS exe: https://github.com/MichaelB7/cfish/blob ... -MacOS.zip
stockfish fork source: https://github.com/MichaelB7/Stockfish
stockfish-101016-12y MaxOS exe:https://github.com/MichaelB7/Stockfish/ ... _MacOS.zip
official stockfish source: https://github.com/official-stockfish/Stockfish

realtime updates here about every 45 minutes or so (after every 40 games)
https://www.dropbox.com/s/efmt7qz1bywbc ... a.txt?dl=1

since these games are longer , you may be interested in the pgn file
https://www.dropbox.com/s/qw9zm182of8zjgd/all.pgn?dl=1
a word of caution - this file will get huge by the end and there are no evaluations included