Hi Fermin + Daniel,
i had a first look at the egbbdll sources and compiled them
without any problems for x32 + x64 platforms.
started with the original settings given in the source
Code: Select all
/*
Define PARALLEL to enable multi threading
*/
#define PARALLEL
#define USESPINLOCK
/*smp optional code*/
#ifdef PARALLEL
# define SMP_CODE(x) x
#else
# define SMP_CODE(x)
#endif
#ifdef PARALLEL
# define VOLATILE volatile
/*threads*/
# ifdef _MSC_VER
# include <process.h>
# define pthread_t HANDLE
# define t_create(f,p,t) t = (pthread_t) _beginthread(f,0,(void*)p)
# define t_sleep(x) Sleep(x)
# else
# include <pthread.h>
# define t_create(f,p,t) pthread_create(&t,0,(void*(*)(void*))&f,(void*)p)
# define t_sleep(x) usleep((x) * 1000)
# endif
/*locks*/
# ifdef _MSC_VER
# ifdef USESPINLOCK
# define LOCK VOLATILE int
# define l_create(x) ((x) = 0)
# define l_lock(x) while(InterlockedExchange((LPLONG)&(x),1) != 0) {while((x) != 0);}
# define l_unlock(x) ((x) = 0)
# else
# define LOCK CRITICAL_SECTION
# define l_create(x) InitializeCriticalSection(&x)
# define l_lock(x) EnterCriticalSection(&x)
# define l_unlock(x) LeaveCriticalSection(&x)
# endif
# else
# define LOCK pthread_mutex_t
# define l_create(x) pthread_mutex_init(&(x),0)
# define l_lock(x) pthread_mutex_lock(&(x))
# define l_unlock(x) pthread_mutex_unlock(&(x))
# endif
#else
# define VOLATILE
# define l_lock(x)
# define l_unlock(x)
#endif
started with:
1: ok
Code: Select all
#define PARALLEL
#define USESPINLOCK
2: ok
Code: Select all
#define PARALLEL
// #define USESPINLOCK
3: compile errors
Code: Select all
// #define PARALLEL
// #define USESPINLOCK
changed the following to get it to run.
Code: Select all
#else //NOT PARALLEL
# define LOCK volatile int //corrected
# define l_create(x) //added
# define l_lock(x)
# define l_unlock(x)
#endif
1.
==========
So it looks it never really was compiled for _non parallel_ settings ?!
2.
==========
This let me think that like my intuition somewhere else in the thread
something strange was going on with multithreading.
Which would underline the type of error it was producing (access ok n-times n+1 time it crashes).
Of course this is at the moment just a thought, and has to be prooved
further.
2.a
==========
Code: Select all
int probe_egbb_xxx(int player, int w_king, int b_king,
int piece1, int square1,
int piece2, int square2,
int piece3, int square3
) {
register int wdl_score,score,all_c,p_dist,material,ktable;
//get score
if(piece1 == _EMPTY)
square1 = INVALID;
if(piece2 == _EMPTY)
square2 = INVALID;
if(piece3 == _EMPTY)
square3 = INVALID;
PSEARCHER psearcher;
l_lock(searcher_lock);
for(int i = 0;i < 8;i++) {
if(!searchers[i].used) {
psearcher = &searchers[i];
psearcher->used = 1;
break;
}
}
l_unlock(searcher_lock);
..........................
..........................
..........................
if here is to find a problem with l_lock/l_unlock, this would explain
at least my problems.
(i will check the InterLockedExchange / InterLockedExchange64 issues)
Summary:
==========
So far, no problems with compiling the dlls.
I will have a _deeper_ look on it today.
@Fermin:
Because i am not able to use the dlls for the moment, would sent
you the dlls you need, if you like.
@Daniel:
thx for the source!
Unfortunatelly there is something to find, because more than hardcoding
the input for the probeEgbb cannot be done (i think) outside the dll.
one more question: does the uploaded source is the base for
the latest released egbdlls (and the settings, i was able to look at) ?
regards, Michael