Re: ComStock 1.0.2 Stockfish with robobases
Posted: Wed Jan 26, 2011 8:17 am
Time permitting over the weekend, I'll probably release ComStock build minus GTB.
Independent Computer Chess Discussion Forum
https://open-chess.org/
Actually, all the EGTB stuff is from the Stockfish team, I just ported it to 2.0(.1) and added tbhits and UCI options. And added a broken ProbeOnlyAtRoot feature, but let's not talk about that...BB+ wrote:My understanding is that egtb.cpp (and its header file) is from Peter C for GTB access, whilst endgame.cpp is standard to Stockfish. I deleted egtb.cpp, and this left four unresolved symbols if I recall correctly. I then got rid of the attempt_probe_egtb stuff in search.cpp, and also the init_egtb and close_egtb in some file that I forget. In other words, I kept on deleting functionality until it worked (as I say, I was in a hurry and just fooling around to refresh my memory as to how compiling under Windows worked)... Of course, it would be better to try to get it to work with GTBs still present.the ComStock source has the egtb.h, egtb.cpp, endgame.cpp and endgame.h.[Under Linux, it all "just works", with both GTBs and RobboBases].
Code: Select all
if (UseGaviotaTb)
init_egtb();
else
close_egtb();
I simply added -L. -lgtb to the LDFLAGS in the Makefile.BB+ wrote:After looking at the build procedure for GTB, I think the following is the trouble.
In Linux it builds libgtb.a as a static library (using ar) and then links Stockfish against that.
There must be some way to tell a Windows compiler to do this, but I really don't know how.
kingliveson wrote:Time permitting over the weekend, I'll probably release ComStock build minus GTB.
BB+ wrote:I think you do need these pthread definitions, at least if you want ComStock to run in SMP mode (at least the LOCK/UNLOCK parts are necessary I presume)--- but I would have thought it should "just work" if you have the right compiler switches to tell the compiler to use them. Trying putting "#define WINDOWS" at the top of IH-win-linux.h and see what happens.
Sorry to bring this up. 'Couldn't resist finding out Why I couldn't compile Comstock 1.0.2 when someone else successfully did so.kingliveson wrote:You are correct, this should not be a problem once he has the right #define. There are other linkage issues though...I looked at the use of extern "C" which all seemed fine. Thought I would have some time this past weekend to try to correct or find a way to build it, but there was no time
I had browsed back to previous pages (of this Topic) discussing pthread definition but could not see an explicit pthread / SMP definition or instructions for Windows.RobboTripleCode/IH-win-linux.h (68): catastrophic error: cannot open source file "pthread.h"
#include <pthread.h> /* for what when no SMP? */
My understanding is that when you have "#define WINDOWS", then it should never ask for pthread.h (which is POSIX).RobboTripleCode/IH-win-linux.h (68): catastrophic error: cannot open source file "pthread.h"
I believe I did this BB+. For RobboTotalCode's IH-win-linux.h, I defined it as follows:BB+ wrote:My understanding is that when you have "#define WINDOWS", then it should never ask for pthread.h (which is POSIX).RobboTripleCode/IH-win-linux.h (68): catastrophic error: cannot open source file "pthread.h"
Code: Select all
#ifdef WINDOWS
#include <win64bits.h>
#define WINDOWS
/* 64 bits */
#define sint8 __int8
#define sint16 __int16
#define sint32 __int32
#define sint64 __int64
#define uint8 unsigned __int8
#define uint16 unsigned __int16
#define uint32 unsigned __int32
#define uint64 unsigned __int64
#define INLINE _inline
#define atoll _atoi64
#define TYPE_64_BIT "%I64d"
#if 1
#define MEMALIGN(a, b, c) a = _aligned_malloc (c, b)
#define ALIGNED_FREE(x) _aligned_free (x)
#else
#define MEMALIGN(a, b, c) a = malloc (c)
#define ALIGNED_FREE(x) free (x)
#endif
#define __builtin_prefetch /* */
#ifdef WINDOWS_X64 /* 64 bits */
#include "win64bits.h"
#else
#include "win32bits.h"
#endif
#define MUTEX_TYPE CRITICAL_SECTION
#define COND_TYPE HANDLE
#define LOCK(x) EnterCriticalSection (x)
#define UNLOCK(x) LeaveCriticalSection (x)
#define WAIT_CON_LOCK(x, y) WaitForSingleObject (x, INFINITE)
#define SIGNAL_CON_LOCK(x, y) SetEvent (x)
#define LOCK_INIT(x) InitializeCriticalSection (x)
#define LOCK_DESTROY DeleteCriticalSection
#define COND_INIT(x, y) (x) = CreateEvent (0, FALSE, FALSE, 0)
#if 0
#define TRY_LOCK(x) WaitForSingleObject (x, 0) /* HACK */
#else /* LeonardoVinci */
#define TRY_LOCK(x) (!TryEnterCriticalSection (x)) /* HACK */
#endif
#define PTHREAD_CREATE(N, b, thr, d) \
(*(N)) = CreateThread (NULL, 0, thr, (LPVOID) (d), 0, NULL);
#define PTHREAD_JOIN(x) \
{ DWORD w; do { GetExitCodeThread (x, &w); } while (w == STILL_ACTIVE); }
HANDLE PTHREAD[MAX_CPUS], PTHREAD_IO;
#define IVAN_THREAD(A) DWORD WINAPI ivan_thread (LPVOID A)
#define IO_THREAD(A) DWORD WINAPI io_thread (LPVOID A)
#define VOID_STAR_TYPE DWORD
Code: Select all
#ifdef WINDOWS
#include <win64bits.h>
#define WINDOWS
/* 64 bits */
#define sint8 __int8
#define sint16 __int16
#define sint32 __int32
#define sint64 __int64
#define uint8 unsigned __int8
#define uint16 unsigned __int16
#define uint32 unsigned __int32
#define uint64 unsigned __int64
#define INLINE _inline
#define atoll _atoi64
#define TYPE_64_BIT "%I64d"
#if 1
#define MEMALIGN(a, b, c) a = _aligned_malloc (c, b)
#define ALIGNED_FREE(x) _aligned_free (x)
#else
#define MEMALIGN(a, b, c) a = malloc (c)
#define ALIGNED_FREE(x) free (x)
#endif
#define __builtin_prefetch /* */
#ifdef WINDOWS_X64 /* 64 bits */
#include "win64bits.h"
#else
#include "win32bits.h"
#endif
#define MUTEX_TYPE CRITICAL_SECTION
#define COND_TYPE HANDLE
#define LOCK(x) EnterCriticalSection (x)
#define UNLOCK(x) LeaveCriticalSection (x)
#define WAIT_CON_LOCK(x, y) WaitForSingleObject (x, INFINITE)
#define SIGNAL_CON_LOCK(x, y) SetEvent (x)
#define LOCK_INIT(x) InitializeCriticalSection (x)
#define LOCK_DESTROY DeleteCriticalSection
#define COND_INIT(x, y) (x) = CreateEvent (0, FALSE, FALSE, 0)
#if 0
#define TRY_LOCK(x) WaitForSingleObject (x, 0) /* HACK */
#else /* LeonardoVinci */
#define TRY_LOCK(x) (!TryEnterCriticalSection (x)) /* HACK */
#endif
#define PTHREAD_CREATE(N, b, thr, d) \
(*(N)) = CreateThread (NULL, 0, thr, (LPVOID) (d), 0, NULL);
#define PTHREAD_JOIN(x) \
{ DWORD w; do { GetExitCodeThread (x, &w); } while (w == STILL_ACTIVE); }
HANDLE PTHREAD[MAX_CPUS], PTHREAD_IO;
#define IVAN_THREAD(A) DWORD WINAPI ivan_thread (LPVOID A)
#define IO_THREAD(A) DWORD WINAPI io_thread (LPVOID A)
#define VOID_STAR_TYPE DWORD
Code: Select all
#ifdef WINDOWS
#include <win64bits.h>
#define WINDOWS
[...]
Done. #define WINDOWS is now placed before the #ifdef WINDOWS line (or directive). This procedure is done for both RobboTriple and RobboTotal's IH-win-linux.h files, so that it now looks like this;BB+ wrote:This is the wrong order od operations. You need to #define WINDOWS before testing whether it is defined with #ifdef WINDOWS. So put the #define WINDOWS on the line before the #ifdef WINDOWS directive.Code: Select all
#ifdef WINDOWS #include <win64bits.h> #define WINDOWS [...]
Code: Select all
#define WINDOWS
/* 64 bits */
#ifdef WINDOWS
#include <win64bits.h>
#define sint8 __int8
#define sint16 __int16