compiling glaurung problem with VC++6
Posted: 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
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