Slightly smoother stockfishes

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

Moderator: Ras

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

Re: Slightly smoother stockfishes

Post by mcostalba »

Please, remove all that 'max' stuff.

Just use the _already_ existent Max() and Min() macro.

Dann I would think you could use Max and Min in your patch so to avoid people throwing in fancy stuff.
royb
Posts: 566
Joined: Thu Mar 09, 2006 12:53 am

Re: Slightly smoother stockfishes

Post by royb »

mcostalba wrote:Please, remove all that 'max' stuff.

Just use the _already_ existent Max() and Min() macro.

Dann I would think you could use Max and Min in your patch so to avoid people throwing in fancy stuff.
I am not sure if you were referencing the discussion Dann and I were having, but if I remove the max stuff, I get this:

g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o search.o search.cpp
search.cpp: In function ‘Value<unnamed>::search(Position&, SearchStack*, Value, Depth, int, bool, int, Move)’:
search.cpp:1398: error: ‘max’ was not declared in this scope
value.h: At global scope:
value.h:126: warning: ‘TempoValue’ defined but not used
history.h:70: warning: ‘HistoryMax’ defined but not used
make[2]: *** [search.o] Error 1
make[2]: Leaving directory `/home/roy/chess/test-new/stockfish_1.6'
make[1]: *** [gcc] Error 2
make[1]: Leaving directory `/home/roy/chess/test-new/stockfish_1.6'
make: *** [default] Error 2

What is the best way to make sure 'max' is defined at the right scope?
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Slightly smoother stockfishes

Post by mcostalba »

royb wrote: search.cpp:1398: error: ‘max’ was not declared in this scope
Could you please post the code around line 1398 of file search.cpp ?

Thanks
royb
Posts: 566
Joined: Thu Mar 09, 2006 12:53 am

Re: Slightly smoother stockfishes

Post by royb »

mcostalba wrote:
royb wrote: search.cpp:1398: error: ‘max’ was not declared in this scope
Could you please post the code around line 1398 of file search.cpp ?

Thanks
Here is that section of file search.cpp:

#ifdef SMOOTH_REDUCTION
double delta = approximateEval - beta;
delta = max(delta, 1.0);
double ddepth = double(depth);
double r = 0.18 * ddepth + 3.1 + log(delta)/5.0;
r = r > ddepth ? ddepth : r;
int R = int(r);
#else
// Null move dynamic reduction based on depth
int R = (depth >= 5 * OnePly ? 4 : 3);

// Null move dynamic reduction based on value
if (approximateEval - beta > PawnValueMidgame)
R++;
#endif
nullValue = -search(pos, ss, -(beta-1), depth-R*OnePly, ply+1, false, threadID);

pos.undo_null_move();
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Slightly smoother stockfishes

Post by mcostalba »

royb wrote:
mcostalba wrote:
royb wrote: search.cpp:1398: error: ‘max’ was not declared in this scope
Could you please post the code around line 1398 of file search.cpp ?

Thanks
Here is that section of file search.cpp:

#ifdef SMOOTH_REDUCTION
double delta = approximateEval - beta;
delta = max(delta, 1.0);
double ddepth = double(depth);
double r = 0.18 * ddepth + 3.1 + log(delta)/5.0;
r = r > ddepth ? ddepth : r;
int R = int(r);
#else
// Null move dynamic reduction based on depth
int R = (depth >= 5 * OnePly ? 4 : 3);

// Null move dynamic reduction based on value
if (approximateEval - beta > PawnValueMidgame)
R++;
#endif
nullValue = -search(pos, ss, -(beta-1), depth-R*OnePly, ply+1, false, threadID);

pos.undo_null_move();
Ok, then please write

Code: Select all

delta = Max(delta, 1.0);

instead of

delta = max(delta, 1.0);
and try to compile....
royb
Posts: 566
Joined: Thu Mar 09, 2006 12:53 am

Re: Slightly smoother stockfishes

Post by royb »

mcostalba wrote:
royb wrote:
mcostalba wrote:
royb wrote: search.cpp:1398: error: ‘max’ was not declared in this scope
Could you please post the code around line 1398 of file search.cpp ?

Thanks
Here is that section of file search.cpp:

#ifdef SMOOTH_REDUCTION
double delta = approximateEval - beta;
delta = max(delta, 1.0);
double ddepth = double(depth);
double r = 0.18 * ddepth + 3.1 + log(delta)/5.0;
r = r > ddepth ? ddepth : r;
int R = int(r);
#else
// Null move dynamic reduction based on depth
int R = (depth >= 5 * OnePly ? 4 : 3);

// Null move dynamic reduction based on value
if (approximateEval - beta > PawnValueMidgame)
R++;
#endif
nullValue = -search(pos, ss, -(beta-1), depth-R*OnePly, ply+1, false, threadID);

pos.undo_null_move();
Ok, then please write

Code: Select all

delta = Max(delta, 1.0);

instead of

delta = max(delta, 1.0);
and try to compile....
roy@ubuntu-roy:~/chess/test-new/stockfish_1.6$ make clean
rm -f *.o .depend *~ stockfish
roy@ubuntu-roy:~/chess/test-new/stockfish_1.6$ make
Makefile:309: .depend: No such file or directory
g++ -msse -MM application.cpp bitboard.cpp pawns.cpp material.cpp endgame.cpp evaluate.cpp main.cpp misc.cpp move.cpp movegen.cpp history.cpp movepick.cpp search.cpp piece.cpp position.cpp direction.cpp tt.cpp value.cpp uci.cpp ucioption.cpp mersenne.cpp book.cpp bitbase.cpp san.cpp benchmark.cpp > .depend
make gcc
make[1]: Entering directory `/home/roy/chess/test-new/stockfish_1.6'
make \
CXX='g++' \
CXXFLAGS="-O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti" \
all
make[2]: Entering directory `/home/roy/chess/test-new/stockfish_1.6'
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o application.o application.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o bitboard.o bitboard.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o pawns.o pawns.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o material.o material.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o endgame.o endgame.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o evaluate.o evaluate.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o main.o main.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o misc.o misc.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o move.o move.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o movegen.o movegen.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o history.o history.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o movepick.o movepick.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o search.o search.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o piece.o piece.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o position.o position.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o direction.o direction.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o tt.o tt.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o value.o value.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o uci.o uci.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o ucioption.o ucioption.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o mersenne.o mersenne.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o book.o book.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o bitbase.o bitbase.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o san.o san.cpp
g++ -O1 -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -c -o benchmark.o benchmark.cpp
g++ -lpthread -o stockfish application.o bitboard.o pawns.o material.o endgame.o evaluate.o main.o misc.o move.o movegen.o history.o movepick.o search.o piece.o position.o direction.o tt.o value.o uci.o ucioption.o mersenne.o book.o bitbase.o san.o benchmark.o
search.o: In function `nodes_searched()':
/home/roy/chess/test-new/stockfish_1.6/search.cpp:646: multiple definition of `nodes_searched()'
misc.o:/home/roy/chess/test-new/stockfish_1.6/misc.cpp:644: first defined here
search.o: In function `SearchStack::init(int)':
/home/roy/chess/test-new/stockfish_1.6/search.cpp:656: multiple definition of `SearchStack::init(int)'
misc.o:/home/roy/chess/test-new/stockfish_1.6/misc.cpp:654: first defined here
search.o: In function `SearchStack::initKillers()':
/home/roy/chess/test-new/stockfish_1.6/search.cpp:663: multiple definition of `SearchStack::initKillers()'
misc.o:/home/roy/chess/test-new/stockfish_1.6/misc.cpp:661: first defined here
search.o: In function `stop_threads()':
/home/roy/chess/test-new/stockfish_1.6/search.cpp:625: multiple definition of `stop_threads()'
misc.o:/home/roy/chess/test-new/stockfish_1.6/misc.cpp:623: first defined here
search.o: In function `init_threads()':
/home/roy/chess/test-new/stockfish_1.6/search.cpp:572: multiple definition of `init_threads()'
misc.o:/home/roy/chess/test-new/stockfish_1.6/misc.cpp:570: first defined here
search.o: In function `perft(Position&, Depth)':
/home/roy/chess/test-new/stockfish_1.6/search.cpp:339: multiple definition of `perft(Position&, Depth)'
misc.o:/home/roy/chess/test-new/stockfish_1.6/misc.cpp:337: first defined here
search.o: In function `think(Position const&, bool, bool, int, int*, int*, int, int, int, int, Move*)':
/home/roy/chess/test-new/stockfish_1.6/search.cpp:372: multiple definition of `think(Position const&, bool, bool, int, int*, int*, int, int, int, int, Move*)'
misc.o:/home/roy/chess/test-new/stockfish_1.6/misc.cpp:370: first defined here
application.o: In function `Application':
/home/roy/chess/test-new/stockfish_1.6/application.cpp:55: undefined reference to `get_system_time()'
/home/roy/chess/test-new/stockfish_1.6/application.cpp:55: undefined reference to `get_system_time()'
evaluate.o: In function `evaluate_pieces<(PieceType)3u, (Color)0u, false>':
/home/roy/chess/test-new/stockfish_1.6/evaluate.cpp:602: undefined reference to `Chess960'
evaluate.o: In function `evaluate_pieces<(PieceType)3u, (Color)1u, false>':
/home/roy/chess/test-new/stockfish_1.6/evaluate.cpp:602: undefined reference to `Chess960'
evaluate.o: In function `evaluate_pieces<(PieceType)3u, (Color)0u, true>':
/home/roy/chess/test-new/stockfish_1.6/evaluate.cpp:602: undefined reference to `Chess960'
evaluate.o: In function `evaluate_pieces<(PieceType)3u, (Color)1u, true>':
/home/roy/chess/test-new/stockfish_1.6/evaluate.cpp:602: undefined reference to `Chess960'
main.o: In function `main':
/home/roy/chess/test-new/stockfish_1.6/main.cpp:81: undefined reference to `engine_name()'
misc.o: In function `(anonymous namespace)::current_search_time()':
misc.cpp:(.text+0xbbe): undefined reference to `get_system_time()'
misc.o: In function `(anonymous namespace)::poll()':
misc.cpp:(.text+0xe02): undefined reference to `Bioskey()'
misc.cpp:(.text+0x104f): undefined reference to `dbg_show_mean'
misc.cpp:(.text+0x1057): undefined reference to `dbg_print_mean()'
misc.cpp:(.text+0x105d): undefined reference to `dbg_show_hit_rate'
misc.cpp:(.text+0x1065): undefined reference to `dbg_print_hit_rate()'
misc.o: In function `(anonymous namespace)::id_loop(Position const&, Move*)':
misc.cpp:(.text+0x57fd): undefined reference to `dbg_show_mean'
misc.cpp:(.text+0x580a): undefined reference to `dbg_print_mean(std::basic_ofstream<char, std::char_traits<char> >&)'
misc.cpp:(.text+0x5810): undefined reference to `dbg_show_hit_rate'
misc.cpp:(.text+0x581d): undefined reference to `dbg_print_hit_rate(std::basic_ofstream<char, std::char_traits<char> >&)'
misc.o: In function `think(Position const&, bool, bool, int, int*, int*, int, int, int, int, Move*)':
misc.cpp:(.text+0x5de9): undefined reference to `get_system_time()'
misc.cpp:(.text+0x6724): undefined reference to `Chess960'
move.o: In function `move_to_string(Move)':
/home/roy/chess/test-new/stockfish_1.6/move.cpp:123: undefined reference to `Chess960'
search.o: In function `(anonymous namespace)::current_search_time()':
search.cpp:(.text+0xbbe): undefined reference to `get_system_time()'
search.o: In function `(anonymous namespace)::poll()':
search.cpp:(.text+0xe02): undefined reference to `Bioskey()'
search.cpp:(.text+0x104f): undefined reference to `dbg_show_mean'
search.cpp:(.text+0x1057): undefined reference to `dbg_print_mean()'
search.cpp:(.text+0x105d): undefined reference to `dbg_show_hit_rate'
search.cpp:(.text+0x1065): undefined reference to `dbg_print_hit_rate()'
search.o: In function `(anonymous namespace)::id_loop(Position const&, Move*)':
search.cpp:(.text+0x585d): undefined reference to `dbg_show_mean'
search.cpp:(.text+0x586a): undefined reference to `dbg_print_mean(std::basic_ofstream<char, std::char_traits<char> >&)'
search.cpp:(.text+0x5870): undefined reference to `dbg_show_hit_rate'
search.cpp:(.text+0x587d): undefined reference to `dbg_print_hit_rate(std::basic_ofstream<char, std::char_traits<char> >&)'
search.o: In function `think(Position const&, bool, bool, int, int*, int*, int, int, int, int, Move*)':
search.cpp:(.text+0x5e49): undefined reference to `get_system_time()'
search.cpp:(.text+0x6784): undefined reference to `Chess960'
uci.o: In function `(anonymous namespace)::perft(std::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >&)':
/home/roy/chess/test-new/stockfish_1.6/uci.cpp:334: undefined reference to `get_system_time()'
/home/roy/chess/test-new/stockfish_1.6/uci.cpp:338: undefined reference to `get_system_time()'
uci.o: In function `(anonymous namespace)::handle_command(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/home/roy/chess/test-new/stockfish_1.6/uci.cpp:121: undefined reference to `engine_name()'
ucioption.o: In function `init_uci_options()':
/home/roy/chess/test-new/stockfish_1.6/ucioption.cpp:206: undefined reference to `cpu_count()'
/home/roy/chess/test-new/stockfish_1.6/ucioption.cpp:206: undefined reference to `cpu_count()'
/home/roy/chess/test-new/stockfish_1.6/ucioption.cpp:207: undefined reference to `cpu_count()'
/home/roy/chess/test-new/stockfish_1.6/ucioption.cpp:207: undefined reference to `cpu_count()'
benchmark.o: In function `benchmark(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/home/roy/chess/test-new/stockfish_1.6/benchmark.cpp:148: undefined reference to `get_system_time()'
/home/roy/chess/test-new/stockfish_1.6/benchmark.cpp:163: undefined reference to `get_system_time()'
collect2: ld returned 1 exit status
make[2]: *** [stockfish] Error 1
make[2]: Leaving directory `/home/roy/chess/test-new/stockfish_1.6'
make[1]: *** [gcc] Error 2
make[1]: Leaving directory `/home/roy/chess/test-new/stockfish_1.6'
make: *** [default] Error 2
User avatar
mariaclara
Posts: 4186
Joined: Wed Mar 08, 2006 9:31 pm
Location: Sulu Sea

Re: Slightly smoother stockfishes

Post by mariaclara »

:D

Maraming Salamat ( muchas gracias)

&

HAPPY NEW YEAR

to

--- :arrow: Tord Ronstad, Marco Costalba, Joona Kiiski

:wink: :wink:

Last edited by mariaclara on Wed Dec 30, 2009 12:57 am, edited 1 time in total.
.
.

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

Re: Slightly smoother stockfishes

Post by mcostalba »

royb wrote: g++ -lpthread -o stockfish application.o bitboard.o pawns.o material.o endgame.o evaluate.o main.o misc.o move.o movegen.o history.o movepick.o search.o piece.o position.o direction.o tt.o value.o uci.o ucioption.o mersenne.o book.o bitbase.o san.o benchmark.o
search.o: In function `nodes_searched()':
/home/roy/chess/test-new/stockfish_1.6/search.cpp:646: multiple definition of `nodes_searched()'
misc.o:/home/roy/chess/test-new/stockfish_1.6/misc.cpp:644: first defined here
Ok, compile of search.cpp now works. Now you have a problem at link time, it says that function nodes_searched() was already defined at line 644 of file misc.cpp but this is _not_ possible with the original misc.cpp file.

What misc.cpp file do you have ?

I suggest to take the original SF 1.6 sources that compile and are clean and then just add in search.cpp

this code

Code: Select all

double delta = approximateEval - beta;
delta = Max(delta, 1.0);
double ddepth = double(depth);
double r = 0.18 * ddepth + 3.1 + log(delta)/5.0;
r = r > ddepth ? ddepth : r;
int R = int(r);
instead of this

Code: Select all

// Null move dynamic reduction based on depth
int R = (depth >= 5 * OnePly ? 4 : 3);

// Null move dynamic reduction based on value
if (approximateEval - beta > PawnValueMidgame)
R++; 
and that's should be all, no macro no SMOOTH_REDUCTION symbols, no troubles. :wink:


BTW, compile with -O1 under gcc or wait for the soon to be released 1.6.2 that will fix this issue once and for all.
royb
Posts: 566
Joined: Thu Mar 09, 2006 12:53 am

Re: Slightly smoother stockfishes

Post by royb »

mcostalba wrote:
royb wrote: g++ -lpthread -o stockfish application.o bitboard.o pawns.o material.o endgame.o evaluate.o main.o misc.o move.o movegen.o history.o movepick.o search.o piece.o position.o direction.o tt.o value.o uci.o ucioption.o mersenne.o book.o bitbase.o san.o benchmark.o
search.o: In function `nodes_searched()':
/home/roy/chess/test-new/stockfish_1.6/search.cpp:646: multiple definition of `nodes_searched()'
misc.o:/home/roy/chess/test-new/stockfish_1.6/misc.cpp:644: first defined here
Ok, compile of search.cpp now works. Now you have a problem at link time, it says that function nodes_searched() was already defined at line 644 of file misc.cpp but this is _not_ possible with the original misc.cpp file.

What misc.cpp file do you have ?

I suggest to take the original SF 1.6 sources that compile and are clean and then just add in search.cpp

this code

Code: Select all

double delta = approximateEval - beta;
delta = Max(delta, 1.0);
double ddepth = double(depth);
double r = 0.18 * ddepth + 3.1 + log(delta)/5.0;
r = r > ddepth ? ddepth : r;
int R = int(r);
instead of this

Code: Select all

// Null move dynamic reduction based on depth
int R = (depth >= 5 * OnePly ? 4 : 3);

// Null move dynamic reduction based on value
if (approximateEval - beta > PawnValueMidgame)
R++; 
and that's should be all, no macro no SMOOTH_REDUCTION symbols, no troubles. :wink:
I had the misc.cpp from Dann. I copied over the original misc.cpp from Stockfish-1.6 and now compiled/linked with new search.cpp and voila! Thanks so much!

Any news on whether or not -O1 will be able to be changed to -O2 or -O3 with an upcoming update?

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

Re: Slightly smoother stockfishes

Post by mcostalba »

royb wrote: Any news on whether or not -O1 will be able to be changed to -O2 or -O3 with an upcoming update?
Yes, we are almost ready with 1.6.2 maintenance release, but I would like to take the opportunity to do some clarification.

1) Stockfish 1.6.2 will be a maintenance release. It means that will be 100% functionality identical to 1.6

Stockfish 1.6 JA and Stockfish 1.6.2 JA will HAVE THE SAME ELO STRENGTH, they are THE SAME engine.

The only point of 1.6.2 is to fix an issue with gcc compiles under Linux, absolutely NO CHANGE for Windows users so that all the tests done so far with 1.6 can be KEPT at 100% after 1.6.2 is out


2) Stockfish 1.6.2 will NOT incorporate the work of Dann, because it changes functionality. Patch of Dann will be possibly incorporated in the new development cycle.


3) To answering to your question, yes, issue with gcc has been fixed so that you can compile again with -O3 as default.


4) I hope release will be out very very soon, very probably within this week. We have already fixed the issue with gcc and we are verifying there is no speed regression. We have already verified it is 100% functionality identical to 1.6



We are sorry it takes a bit of time, but we want to be sure 1.6 and 1.6.2 are 100% equivalent before to release.