Problem with Stockfish make signature-profile-build

Discussion of chess software programming and technical issues.

Moderator: Ras

mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Problem with Stockfish make signature-profile-build

Post by mcostalba »

mcostalba wrote:Ok, I have modified sed command to write the file in one go, this should work although is ugly as hell :-)

Code: Select all

embed-signature:
	@echo "Running benchmark for getting the signature ..."
	@$(SIGNBENCH) 2>&1 | sed -n 's/Nodes searched  : \(.*\)/\/string Version\/s\/"\\(.*\\)"\/"sig-\1"\//p' > sign.txt
	@sed -f sign.txt -i misc.cpp
	@rm sign.txt

Could you please verify ?
BTW, your suggestion with bak files does not work on Linux :-(
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Problem with Stockfish make signature-profile-build

Post by mcostalba »

zullil wrote: Fails here, as before:
Yes, sorry. I have removed one -i but there is another one. Could you please test the following?

Code: Select all

embed-signature:
	@echo "Running benchmark for getting the signature ..."
	@$(SIGNBENCH) 2>&1 | sed -n 's/Nodes searched  : \(.*\)/\/string Version\/s\/"\\(.*\\)"\/"sig-\1"\//p' > sign.txt
	@sed -f sign.txt misc.cpp > misc2.cpp
	@mv misc2.cpp misc.cpp
	@rm sign.txt
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Problem with Stockfish make signature-profile-build

Post by zullil »

mcostalba wrote:
zullil wrote: Fails here, as before:
Yes, sorry. I have removed one -i but there is another one. Could you please test the following?

Code: Select all

embed-signature:
	@echo "Running benchmark for getting the signature ..."
	@$(SIGNBENCH) 2>&1 | sed -n 's/Nodes searched  : \(.*\)/\/string Version\/s\/"\\(.*\\)"\/"sig-\1"\//p' > sign.txt
	@sed -f sign.txt misc.cpp > misc2.cpp
	@mv misc2.cpp misc.cpp
	@rm sign.txt
Works for me. Thanks.

Code: Select all

LZsMacPro-OSX6: ~/Documents/Chess/Stockfish/src] ./stockfish 
Stockfish sig-4769737 64 SSE4.2 by Tord Romstad, Marco Costalba and Joona Kiiski
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Problem with Stockfish make signature-profile-build

Post by Sven »

mcostalba wrote:
mcostalba wrote:Ok, I have modified sed command to write the file in one go, this should work although is ugly as hell :-)

Code: Select all

embed-signature:
	@echo "Running benchmark for getting the signature ..."
	@$(SIGNBENCH) 2>&1 | sed -n 's/Nodes searched  : \(.*\)/\/string Version\/s\/"\\(.*\\)"\/"sig-\1"\//p' > sign.txt
	@sed -f sign.txt -i misc.cpp
	@rm sign.txt

Could you please verify ?
BTW, your suggestion with bak files does not work on Linux :-(
Have you noticed my post above which contains a link that explains why?

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

Re: Problem with Stockfish make signature-profile-build

Post by zullil »

Sven Schüle wrote:
mcostalba wrote:
mcostalba wrote:Ok, I have modified sed command to write the file in one go, this should work although is ugly as hell :-)

Code: Select all

embed-signature:
	@echo "Running benchmark for getting the signature ..."
	@$(SIGNBENCH) 2>&1 | sed -n 's/Nodes searched  : \(.*\)/\/string Version\/s\/"\\(.*\\)"\/"sig-\1"\//p' > sign.txt
	@sed -f sign.txt -i misc.cpp
	@rm sign.txt

Could you please verify ?
BTW, your suggestion with bak files does not work on Linux :-(
Have you noticed my post above which contains a link that explains why?

Sven
Marco noticed. The link you found is referenced in Marco's commit fixing this issue on github.

By the way, the last (most recent) post on the thread you found offers a simple workaround to the issue, one which purportedly works on gnu and bsd:
This works with both GNU and BSD versions of sed:

sed -i'' -e 's/old_link/new_link/g' *

or with backup:

sed -i'.bak' -e 's/old_link/new_link/g' *

Note missing space after -i option! (Necessary for GNU sed)
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Problem with Stockfish make signature-profile-build

Post by Sven »

zullil wrote:Marco noticed. The link you found is referenced in Marco's commit fixing this issue on github.
Thanks for the info!
zullil wrote:By the way, the last (most recent) post on the thread you found offers a simple workaround to the issue, one which purportedly works on gnu and bsd:
This works with both GNU and BSD versions of sed:

sed -i'' -e 's/old_link/new_link/g' *

or with backup:

sed -i'.bak' -e 's/old_link/new_link/g' *

Note missing space after -i option! (Necessary for GNU sed)
I saw that but my first impression was that Marco would not like it that way (I do not like it as well, using an option immediately followed by a string literal and intentionally without any space inbetween is nothing but an ugly hack), and it seems my impression was right :-)

Sven
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Problem with Stockfish make signature-profile-build

Post by mcostalba »

Sven Schüle wrote:
zullil wrote:Marco noticed. The link you found is referenced in Marco's commit fixing this issue on github.
Thanks for the info!
zullil wrote:By the way, the last (most recent) post on the thread you found offers a simple workaround to the issue, one which purportedly works on gnu and bsd:
This works with both GNU and BSD versions of sed:

sed -i'' -e 's/old_link/new_link/g' *

or with backup:

sed -i'.bak' -e 's/old_link/new_link/g' *

Note missing space after -i option! (Necessary for GNU sed)
I saw that but my first impression was that Marco would not like it that way (I do not like it as well, using an option immediately followed by a string literal and intentionally without any space inbetween is nothing but an ugly hack), and it seems my impression was right :-)

Sven
Actually I have missed this :-)

I agree is not so nice, but current hack of using a misc2.cpp tmp file is even uglier !

Thanks to both!

I have pushed yet another fixing patch
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Problem with Stockfish make signature-profile-build

Post by zullil »

mcostalba wrote:
Actually I have missed this :-)

I agree is not so nice, but current hack of using a misc2.cpp tmp file is even uglier !

Thanks to both!

I have pushed yet another fixing patch
Well, you can't trust the Internet.

It doesn't work on OS X. Please revert to the uglier version.

Sorry.

Code: Select all

Running benchmark for getting the signature ...
sed: 1: "sign.txt": unterminated substitute pattern
make: *** [embed-signature] Error 1