Compiling Crafty 25 PGO

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Canoike
Posts: 125
Joined: Tue Jan 17, 2012 8:08 pm

Compiling Crafty 25 PGO

Post by Canoike »

Hello,

I'm trying to compile Crafty 25 with Profile Guide Optimisation under Ubuntu x64. The command line is : make profile.
The Makefile specifies to "edit Makefile to make the profile option use the right compiler". So I have replaced all "CC=clang CXX=clang++" with "CC=gcc CXX=g++".

I get the following error messages :
gcc: error: unrecognized command line option ‘-fprofile-instr-generate’

I wonder what to change.

Thank you.
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Compiling Crafty 25 PGO

Post by Dann Corbit »

What is your exact version of gcc?
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
Canoike
Posts: 125
Joined: Tue Jan 17, 2012 8:08 pm

Re: Compiling Crafty 25 PGO

Post by Canoike »

gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
Copyright (C) 2013
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Compiling Crafty 25 PGO

Post by zullil »

Canoike wrote:Hello,

I'm trying to compile Crafty 25 with Profile Guide Optimisation under Ubuntu x64. The command line is : make profile.
The Makefile specifies to "edit Makefile to make the profile option use the right compiler". So I have replaced all "CC=clang CXX=clang++" with "CC=gcc CXX=g++".

I get the following error messages :
gcc: error: unrecognized command line option ‘-fprofile-instr-generate’

I wonder what to change.

Thank you.
Edit this portion:

Code: Select all

profile:
	@rm -rf *.o
	@rm -rf log.*
	@rm -rf game.*
	@rm -rf prof
	@rm -rf *.gcda
	@mkdir prof
	@touch *.c *.cpp *.h
	$(MAKE) -j unix-clang-profile
	@echo "#!/bin/csh" > runprof
	@echo "./crafty <<EOF" >>runprof
	@echo "pgo -1" >>runprof
	@echo "mt=0" >>runprof
	@echo "quit" >>runprof
	@echo "EOF" >>runprof
	@chmod +x runprof
	@./runprof
	@rm runprof
	@touch *.c *.cpp *.h
	$&#40;MAKE&#41; -j unix-clang
Might also need to change csh to sh above.
Last edited by zullil on Fri Jan 22, 2016 11:43 pm, edited 1 time in total.
abulmo
Posts: 151
Joined: Thu Nov 12, 2009 6:31 pm

Re: Compiling Crafty 25 PGO

Post by abulmo »

-fprofile-generate
or
-fprofile-arcs,

and then -fprofile-use
Richard
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Compiling Crafty 25 PGO

Post by zullil »

abulmo wrote:-fprofile-generate
or
-fprofile-arcs,

and then -fprofile-use
Already there. He needs to modify the profile target.

Code: Select all

unix-gcc&#58;
	$&#40;MAKE&#41; -j target=UNIX \
		CC=gcc CXX=g++ \
		opt='-DTEST -DINLINEASM -DPOPCNT -DCPUS=4' \
		CFLAGS='-Wall -Wno-array-bounds -pipe -O3 -fprofile-use \
		-fprofile-correction -pthread' \
		CXFLAGS='-Wall -Wno-array-bounds -pipe -O3 -fprofile-use \
		-fprofile-correction -pthread' \
		LDFLAGS='$&#40;LDFLAGS&#41; -fprofile-use -pthread -lstdc++' \
		crafty-make

unix-gcc-profile&#58;
	$&#40;MAKE&#41; -j target=UNIX \
		CC=gcc CXX=g++ \
		opt='-DTEST -DINLINEASM -DPOPCNT -DCPUS=4' \
		CFLAGS='-Wall -Wno-array-bounds -pipe -O3 -fprofile-arcs \
		-pthread' \
		CXFLAGS='-Wall -Wno-array-bounds -pipe -O3 -fprofile-arcs \
		-pthread' \
		LDFLAGS='$&#40;LDFLAGS&#41; -fprofile-arcs -pthread -lstdc++ ' \
		crafty-make
Canoike
Posts: 125
Joined: Tue Jan 17, 2012 8:08 pm

Re: Compiling Crafty 25 PGO

Post by Canoike »

zullil wrote:
Canoike wrote:Hello,

I'm trying to compile Crafty 25 with Profile Guide Optimisation under Ubuntu x64. The command line is : make profile.
The Makefile specifies to "edit Makefile to make the profile option use the right compiler". So I have replaced all "CC=clang CXX=clang++" with "CC=gcc CXX=g++".

I get the following error messages :
gcc: error: unrecognized command line option ‘-fprofile-instr-generate’

I wonder what to change.

Thank you.
Edit this portion:

Code: Select all

profile&#58;
	@rm -rf *.o
	@rm -rf log.*
	@rm -rf game.*
	@rm -rf prof
	@rm -rf *.gcda
	@mkdir prof
	@touch *.c *.cpp *.h
	$&#40;MAKE&#41; -j unix-clang-profile
	@echo "#!/bin/csh" > runprof
	@echo "./crafty <<EOF" >>runprof
	@echo "pgo -1" >>runprof
	@echo "mt=0" >>runprof
	@echo "quit" >>runprof
	@echo "EOF" >>runprof
	@chmod +x runprof
	@./runprof
	@rm runprof
	@touch *.c *.cpp *.h
	$&#40;MAKE&#41; -j unix-clang
Might also need to change csh to sh above.
Louis,
I have found out which lines to modify.

Line 8 :
$(MAKE) -j unix-clang-profile * changed to : $(MAKE) -j unix-gcc-profile

Last line :
$(MAKE) -j unix-clang * changed to : unix-gcc-profile (Raw nodes per second: 4752629)
or
$(MAKE) -j unix-clang * changed to : unix-gcc (makes a smaller and faster executable (Raw nodes per second: 5616690))

Changed csh to sh
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Compiling Crafty 25 PGO

Post by zullil »

Canoike wrote:
zullil wrote:
Canoike wrote:Hello,

I'm trying to compile Crafty 25 with Profile Guide Optimisation under Ubuntu x64. The command line is : make profile.
The Makefile specifies to "edit Makefile to make the profile option use the right compiler". So I have replaced all "CC=clang CXX=clang++" with "CC=gcc CXX=g++".

I get the following error messages :
gcc: error: unrecognized command line option ‘-fprofile-instr-generate’

I wonder what to change.

Thank you.
Edit this portion:

Code: Select all

profile&#58;
	@rm -rf *.o
	@rm -rf log.*
	@rm -rf game.*
	@rm -rf prof
	@rm -rf *.gcda
	@mkdir prof
	@touch *.c *.cpp *.h
	$&#40;MAKE&#41; -j unix-clang-profile
	@echo "#!/bin/csh" > runprof
	@echo "./crafty <<EOF" >>runprof
	@echo "pgo -1" >>runprof
	@echo "mt=0" >>runprof
	@echo "quit" >>runprof
	@echo "EOF" >>runprof
	@chmod +x runprof
	@./runprof
	@rm runprof
	@touch *.c *.cpp *.h
	$&#40;MAKE&#41; -j unix-clang
Might also need to change csh to sh above.
Louis,
I have found out which lines to modify.

Line 8 :
$(MAKE) -j unix-clang-profile * changed to : $(MAKE) -j unix-gcc-profile

Last line :
$(MAKE) -j unix-clang * changed to : unix-gcc-profile (Raw nodes per second: 4752629)
or
$(MAKE) -j unix-clang * changed to : unix-gcc (makes a smaller and faster executable (Raw nodes per second: 5616690))

Changed csh to sh
Right, except don't use unix-gcc-profile for the last line. Use unix-gcc to take advantage of the profiling that was done in line 8.