compiling glaurung problem with VC++6

Programming Topics (Computer Chess) and technical aspects as test techniques, book building, program tuning etc

Moderator: Andres Valverde

compiling glaurung problem with VC++6

Postby Uri Blass » 06 Sep 2006, 12:28

I tried to compile glaurung under visual C++6 and the problem is that I do not get exactly the same results when I run the program twice from the opening position by the commands
uci
go nodes 10000
I get 2962 again and again but I do not get the next number as the same number

Note that when I run the public glaurung1.2.1 I get deterministic
result at the pv even for uci go nodes 1000000 and I get 465232 nodes for the pv at depth 11

changes that I did to the public source(old code has only the part
between #else and #endif )

changes 1-3 in book.cpp

#if defined(VC6)
#define BOOK_KEY_MASK (uint64)0xFFFFFFFFFFFF0000
#define BOOK_MOVE_MASK (uint64)0xFFFF
#else
#define BOOK_KEY_MASK 0xFFFFFFFFFFFF0000ULL
#define BOOK_MOVE_MASK 0xFFFFULL
#endif

#if defined(VC6)
result += (uint64)(((uint64)c) << ((uint64)i*8));
#else
result += (uint64)(((uint64)c) << ((uint64)i*8ULL));
#endif


#if defined(VC6)
moves[n].move = (int)book_data & (int)BOOK_MOVE_MASK;
#else
moves[n].move = book_data & BOOK_MOVE_MASK;
#endif


changes 4-6 in eval.cpp

#if defined(VC6)
#define KEY_MASK ((uint64)1<<48)-1
#else
#define KEY_MASK ((1ULL<<48)-1)
#endif

#if defined(VC6)
int index = ((int)pos->key & (EvalCacheSize - 1));
#else
int index = (pos->key & (EvalCacheSize - 1));
#endif


#if defined(VC6)
int index = ((int)pos->key & (EvalCacheSize - 1));
#else
int index = (pos->key & (EvalCacheSize - 1));
#endif

change 7-8 in glaurung.h

#define VC6
#if defined(VC6)
typedef signed __int64 int64;
typedef unsigned __int64 uint64;
#else
typedef signed long long int64;
typedef unsigned long long uint64;
#endif

change 9 in io.cpp

#if defined(VC6)
if(t > 0) printf("nps " llu_format " ",
(RSI->nodes*(uint64)1000)/((uint64) t));
#else
if(t > 0) printf("nps " llu_format " ",
(RSI->nodes*1000ULL)/((uint64) t));
#endif

changes 10-12 in learn.cpp

#if defined(VC6)
int index = ((int)key & (NUM_OF_LEARN_ENTRIES - 1));
#else
int index = (key & (NUM_OF_LEARN_ENTRIES - 1));
#endif

#if defined(VC6)
int index = ((int)key & (NUM_OF_LEARN_ENTRIES - 1));
#else
int index = (key & (NUM_OF_LEARN_ENTRIES - 1));
#endif

#if defined(VC6)
int index = ((int)key & (NUM_OF_LEARN_ENTRIES - 1));
#else
int index = (key & (NUM_OF_LEARN_ENTRIES - 1));
#endif

changes 13-14 in pstruct.cpp for functions that return boolean parameter
#if defined(VC6)
return (bf!=0);
#else
return bf;
#endif

#if defined(VC6)
return ((bf & -bf)!=0);
#else
return (bf & -bf);
#endif

change 15 in root.cpp

#if defined(VC6)
RSI->nodes =(uint64)0;
#else
RSI->nodes = 0ULL;
#endif

change 16 in search.cpp

#if defined(VC6)
printf("info nodes " llu_format " nps " llu_format " time %d hashfull %d\n",
RSI->nodes, (RSI->nodes*(uint64)1000)/((uint64) t), t, hashfull());
#else
printf("info nodes " llu_format " nps " llu_format " time %d hashfull %d\n",
RSI->nodes, (RSI->nodes*1000ULL)/((uint64) t), t, hashfull());
#endif

changes 17-19 in zobrist.cpp

#if defined(VC6)
ZobEP[0]=(uint64)0;
#else
ZobEP[0] = 0ULL;
#endif

#if defined(VC6)
hashkey_t result = (uint64)0;
#else
hashkey_t result = 0ULL;
#endif

#if defined(VC6)
hashkey_t result = (uint64)0;
#else
hashkey_t result = 0ULL;
#endif

Note that it is easy to find the places to change because the lines between #else and #endif usually do not appear often so it is easy to search for them in the program(some of them appear more than one time and in this case I simply mentitoned the same lines twice or 3 times).

Uri
User avatar
Uri Blass
 
Posts: 727
Joined: 09 Oct 2004, 05:59
Location: Tel-Aviv

Re: compiling glaurung problem with VC++6

Postby Uri Blass » 06 Sep 2006, 13:04

I can add that the only way to try to solve the problem of non deterministic results is to add a function that calculate sum of all relevant variables of glaurung at existing time so I can find the earliest time when the sum is not the same.

I suspected that maybe the hash numbers are not the same under VC6 but it seems not to be the problem because when I asked glaurung to print one of them(ZobColour) I got the same result again and again.

Uri
User avatar
Uri Blass
 
Posts: 727
Joined: 09 Oct 2004, 05:59
Location: Tel-Aviv

Re: compiling glaurung problem with VC++6

Postby Uri Blass » 07 Sep 2006, 10:41

maybe some of my changes are not correct

I defined

#if defined(VC6)
#define KEY_MASK ((uint64)1<<48)-1
#else
#define KEY_MASK ((1ULL<<48)-1)
#endif

I will see if I can get deterministic result by
#define KEY_MASK (((uint64)1<<48)-1)

I undid all the changes and I now started to do them again by copy and paste when I will look if I have more errors

one error that may not be significant is that I did not add (uint64) before 8 in the following line.

#if defined(VC6)
result += (uint64)(((uint64)c) << ((uint64)i*8));
#else
result += (uint64)(((uint64)c) << ((uint64)i*8ULL));
#endif


Uri
User avatar
Uri Blass
 
Posts: 727
Joined: 09 Oct 2004, 05:59
Location: Tel-Aviv

Re: compiling glaurung problem with VC++6

Postby Uri Blass » 07 Sep 2006, 10:57

It does not help

I told it twice
uci
go depth 7

You can see that there is a difference in the number of nodes at depth 7 and in one case it is 5139 and in another case it is 5137

uci
id name Glaurung 1.2.1 SMP
id author Tord Romstad
option name Hash type spin default 32 min 4 max 1024
option name Aggressiveness type spin default 130 min 0 max 300
option name Cowardice type spin default 100 min 0 max 300
option name Passed pawns (middle game) type spin default 100 min 0 max 300
option name Passed pawns (endgame) type spin default 140 min 0 max 300
option name Pawn structure (middle game) type spin default 150 min 0 max 300
option name Pawn structure (endgame) type spin default 150 min 0 max 300
option name Mobility (middle game) type spin default 160 min 0 max 300
option name Mobility (endgame) type spin default 150 min 0 max 300
option name Space type spin default 100 min 0 max 300
option name Development type spin default 130 min 0 max 300
option name Static evaluation cache type check default true
option name Static evaluation cache size type spin default 4 min 1 max 128
option name Static null move pruning type check default true
option name Static pruning depth type spin default 3 min 1 max 6
option name Null move reduction factor (middle game) type spin default 3 min 1 m
ax 3
option name Null move reduction factor (endgame) type spin default 2 min 1 max 3

option name Late move reductions type combo default All nodes var All nodes var
Non-PV nodes var Off
option name Reduce based on type combo default Knowledge and history var Knowled
ge var History var Knowledge and history
option name Futility pruning type combo default Non-PV nodes var All nodes var N
on-PV nodes var Off
option name Futility margin 0 type spin default 100 min 0 max 1000
option name Futility margin 1 type spin default 150 min 0 max 1000
option name Futility margin 2 type spin default 300 min 0 max 1000
option name Check extension type spin default 60 min 0 max 60
option name One reply to check extension type spin default 45 min 0 max 60
option name Two replies to check extension type spin default 20 min 0 max 60
option name Mate threat extension type spin default 45 min 0 max 60
option name Pawn push to 7th rank extension type spin default 45 min 0 max 60
option name Threat depth type spin default 5 min 0 max 20
option name Checks in quiescence search type spin default 3 min 0 max 20
option name Hash quiescence search type check default true
option name Position learning type check default false
option name Clear position learning type button
option name Number of threads type spin default 2 min 1 max 4
option name Minimum tree split depth type spin default 5 min 4 max 7
option name Clear Hash type button
option name Ponder type check default false
option name OwnBook type check default true
option name MultiPV type spin default 1 min 1 max 512
option name UCI_Chess960 type check default false
option name UCI_ShowCurrLine type check default false
option name UCI_AnalyseMode type check default false
option name UCI_EngineAbout type string default Glaurung by Tord Romstad, see ht
tp://www.glaurungchess.com
uciok
go depth 7
info depth 2
info multipv 1 depth 2 score cp 15 time 31 nodes 43 nps 1387 pv e2e3 e7e6
info depth 3
info multipv 1 depth 3 score cp 37 time 31 nodes 226 nps 7290 pv e2e3 e7e6 d2d4

info depth 4
info multipv 1 depth 4 score cp 20 time 31 nodes 597 nps 19258 pv e2e3 e7e6 d2d4
d7d5 f1b5 b8d7
info depth 5
info multipv 1 depth 5 score cp 20 time 47 nodes 1288 nps 27404 pv e2e3 e7e6 d2d
4 d7d5 f1b5 b8d7
info multipv 1 depth 5 score cp 53 time 47 nodes 2962 nps 63021 pv e2e4 e7e5 d2d
4 e5d4 d1d4
info depth 6
info multipv 1 depth 6 score cp 35 time 62 nodes 5139 nps 82887 pv e2e4 e7e5 d2d
4 e5d4 d1d4 b8c6
info depth 7
info multipv 1 depth 7 score cp 20 time 109 nodes 17075 nps 156651 pv e2e4 d7d5
e4d5 d8d5 b1c3 d5e5 f1e2 c8g4
bestmove e2e4 ponder d7d5


uci
id name Glaurung 1.2.1 SMP
id author Tord Romstad
option name Hash type spin default 32 min 4 max 1024
option name Aggressiveness type spin default 130 min 0 max 300
option name Cowardice type spin default 100 min 0 max 300
option name Passed pawns (middle game) type spin default 100 min 0 max 300
option name Passed pawns (endgame) type spin default 140 min 0 max 300
option name Pawn structure (middle game) type spin default 150 min 0 max 300
option name Pawn structure (endgame) type spin default 150 min 0 max 300
option name Mobility (middle game) type spin default 160 min 0 max 300
option name Mobility (endgame) type spin default 150 min 0 max 300
option name Space type spin default 100 min 0 max 300
option name Development type spin default 130 min 0 max 300
option name Static evaluation cache type check default true
option name Static evaluation cache size type spin default 4 min 1 max 128
option name Static null move pruning type check default true
option name Static pruning depth type spin default 3 min 1 max 6
option name Null move reduction factor (middle game) type spin default 3 min 1 m
ax 3
option name Null move reduction factor (endgame) type spin default 2 min 1 max 3

option name Late move reductions type combo default All nodes var All nodes var
Non-PV nodes var Off
option name Reduce based on type combo default Knowledge and history var Knowled
ge var History var Knowledge and history
option name Futility pruning type combo default Non-PV nodes var All nodes var N
on-PV nodes var Off
option name Futility margin 0 type spin default 100 min 0 max 1000
option name Futility margin 1 type spin default 150 min 0 max 1000
option name Futility margin 2 type spin default 300 min 0 max 1000
option name Check extension type spin default 60 min 0 max 60
option name One reply to check extension type spin default 45 min 0 max 60
option name Two replies to check extension type spin default 20 min 0 max 60
option name Mate threat extension type spin default 45 min 0 max 60
option name Pawn push to 7th rank extension type spin default 45 min 0 max 60
option name Threat depth type spin default 5 min 0 max 20
option name Checks in quiescence search type spin default 3 min 0 max 20
option name Hash quiescence search type check default true
option name Position learning type check default false
option name Clear position learning type button
option name Number of threads type spin default 2 min 1 max 4
option name Minimum tree split depth type spin default 5 min 4 max 7
option name Clear Hash type button
option name Ponder type check default false
option name OwnBook type check default true
option name MultiPV type spin default 1 min 1 max 512
option name UCI_Chess960 type check default false
option name UCI_ShowCurrLine type check default false
option name UCI_AnalyseMode type check default false
option name UCI_EngineAbout type string default Glaurung by Tord Romstad, see ht
tp://www.glaurungchess.com
uciok
go depth 7
info depth 2
info multipv 1 depth 2 score cp 15 time 15 nodes 43 nps 2866 pv e2e3 e7e6
info depth 3
info multipv 1 depth 3 score cp 37 time 31 nodes 226 nps 7290 pv e2e3 e7e6 d2d4

info depth 4
info multipv 1 depth 4 score cp 20 time 31 nodes 597 nps 19258 pv e2e3 e7e6 d2d4
d7d5 f1b5 b8d7
info depth 5
info multipv 1 depth 5 score cp 20 time 31 nodes 1288 nps 41548 pv e2e3 e7e6 d2d
4 d7d5 f1b5 b8d7
info multipv 1 depth 5 score cp 53 time 47 nodes 2962 nps 63021 pv e2e4 e7e5 d2d
4 e5d4 d1d4
info depth 6
info multipv 1 depth 6 score cp 35 time 62 nodes 5137 nps 82854 pv e2e4 e7e5 d2d
4 e5d4 d1d4 b8c6
info depth 7
info multipv 1 depth 7 score cp 20 time 109 nodes 17141 nps 157256 pv e2e4 d7d5
e4d5 d8d5 b1c3 d5e5 f1e2 c8g4
bestmove e2e4 ponder d7d5
User avatar
Uri Blass
 
Posts: 727
Joined: 09 Oct 2004, 05:59
Location: Tel-Aviv

Re: compiling glaurung problem with VC++6

Postby Dann Corbit » 08 Sep 2006, 18:21

VC++ 6 is a dinosaur. Get this instead, it's a lot better:
http://msdn.microsoft.com/vstudio/expre ... /download/
Dann Corbit
 

Re: compiling glaurung problem with VC++6

Postby Uri Blass » 08 Sep 2006, 21:53

Dann Corbit wrote:VC++ 6 is a dinosaur. Get this instead, it's a lot better:
http://msdn.microsoft.com/vstudio/expre ... /download/


I do not understand how to register

It is written "3.Register" but I see no registration link.

My first thought was that I need to buy the express edition in order to register but I found that is is free in the following link

http://msdn.microsoft.com/vstudio/express/default.aspx

Uri
User avatar
Uri Blass
 
Posts: 727
Joined: 09 Oct 2004, 05:59
Location: Tel-Aviv

Re: compiling glaurung problem with VC++6

Postby Uri Blass » 08 Sep 2006, 23:01

I completed the process of registering it.
I guessed that I may get link to register after I run the download it but I was not sure that it is going to be the case and initially
I did not like to do the long process of running.

I got registration key and
I will see if it works.

Uri
User avatar
Uri Blass
 
Posts: 727
Joined: 09 Oct 2004, 05:59
Location: Tel-Aviv

Re: compiling glaurung problem with VC++6

Postby Uri Blass » 08 Sep 2006, 23:31

It does not work for me.
I created empty project and added to it all files of glaurung

I got the following error:

fatal error C1083: Cannot open include file: 'windows.h': No such file or directory

I had not that problem with VC6++

Uri
User avatar
Uri Blass
 
Posts: 727
Joined: 09 Oct 2004, 05:59
Location: Tel-Aviv

Re: compiling glaurung problem with VC++6

Postby Pradu » 08 Sep 2006, 23:36

You need to install the platform SDK.
User avatar
Pradu
 
Posts: 343
Joined: 12 Jan 2005, 19:17
Location: Chandler, Arizona, USA

Re: compiling glaurung problem with VC++6

Postby Uri Blass » 09 Sep 2006, 00:19

Pradu wrote:You need to install the platform SDK.


Thanks
I wonder how microsoft visual C6 can recognize windows.h
without the SDK

It seems that I have more problems
problem 1:
Pop-ups must be enabled to successfully use this site. If you have a pop-up blocker please ensure you have disabled it for http://www.qmedia.ca and https://www.qdirect.net.

problem 2:
The February 2003 release is the last release that supports Visual Studio 6.0.

I am afraid not to be able to use microsoft visual Studio6.0 after installing later version but if I install older version then I am afraid it is not going to help because it is written that
"The older releases are available for your convenience, but are not supported."

Uri
User avatar
Uri Blass
 
Posts: 727
Joined: 09 Oct 2004, 05:59
Location: Tel-Aviv

Re: compiling glaurung problem with VC++6

Postby Uri Blass » 09 Sep 2006, 08:10

I finally found the problem that make glaurung's behviour not deterministic.

I simply did not comment
#define SMP out of glaurung.

It has nothing to do with visual c6

Uri
User avatar
Uri Blass
 
Posts: 727
Joined: 09 Oct 2004, 05:59
Location: Tel-Aviv

Re: compiling glaurung problem with VC++6

Postby Bo Persson » 09 Sep 2006, 09:56

Uri Blass wrote:
Pradu wrote:You need to install the platform SDK.


Thanks
I wonder how microsoft visual C6 can recognize windows.h
without the SDK


VC6 includes the SDK (1998 release, or so...).

The Express Edition is a stripped down release. The full version is DVD-size!

Uri Blass wrote:It seems that I have more problems
problem 1:
Pop-ups must be enabled to successfully use this site. If you have a pop-up blocker please ensure you have disabled it for http://www.qmedia.ca and https://www.qdirect.net.


Can't help you with that one. :-)

Uri Blass wrote:problem 2:
The February 2003 release is the last release that supports Visual Studio 6.0.

I am afraid not to be able to use microsoft visual Studio6.0 after installing later version but if I install older version then I am afraid it is not going to help because it is written that
"The older releases are available for your convenience, but are not supported."

Uri


2003 is pretty old as well, you don't really want that one.

Each SDK, and each new compiler, will install in a separate directory. I don't have VC6 installed anymore, but have VC7.1 and VC8 Express plus several SDK releases on this machine. Works fine.
Bo Persson
 
Posts: 5
Joined: 04 Aug 2005, 09:37
Location: Malmö, Sweden


Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 15 guests