One part I was looking into is when I terminate my search. At the start of the search I compute two values, optimalTime, and maxiumTime. If time used ever passes maxiumTime then search aborts the partial depth search. If the search aborts before finishing a depth, that time is for the most part wasted (Sure, PV could change, Hash could gain value).
so I did the following to try to avoid some of the times when time is wasted.
Code: Select all
// Check to see if we expect to be able to complete the next depth
if (thread->limits->limitedBySelf){
double lastTime = info->timeUsage[depth];
double timeFactor = MIN(2, info->timeUsage[depth] / info->timeUsage[lastDepth]);
double estimatedUsage = lastTime * (timeFactor + .25);
double estiamtedEndtime = getRealTime() + estimatedUsage - thread->starttime;
if (estiamtedEndtime > thread->maxusage){
for (i = 0; i < thread->nthreads; i++)
thread->threads[i].abort = ABORT_ALL;
pthread_mutex_unlock(thread->lock);
break;
}
}
I tested it in the following 5 ways, and found elo gains between 9 and 13.
* 20+.2s 1Thread
* 5+.05s 1Thread
* 40/4.0s 1Thread
* 40/40.0s 1Thread
* 40/4.0s 3Thread
I was worried about how this change scales with more than 1 thread. With 1 thread, search completion times are fairly predicable, but with lazy SMP the time between finishing depths varies greatly. I've tried testing with 6Threads, but cannot find the same level of improvement.
Has anyone gone down this path? Any thoughts to share?
-- Andrew