oliver wrote:
Am Friday 14 November 2008 20:35:36 schrieb Michel Van den Bergh:
One problem is that in 1.4.1SE the number of threads is still hardcoded.
If you want to I can give you a small patch that makes it a UCI option.
Other Toga variants have this already.

Yes I would like to include this patch. Are you the author? If I include it, I would have to know the author for the copyright. The variety of people in the chess engine community, that work on toga2 do cause some sort of a "problem" for the debian legal policy.

Many thanks,

Oliver



Hi Oliver,

Attached is the patch that makes the number of threads a UCI option.
I guess I am the author but the patch is really trivial.

Regards,
Michel

diff -Naur -x '*.orig' src/option.cpp src_thread_patch/option.cpp
--- src/option.cpp	2008-01-30 23:59:58.000000000 +0100
+++ src_thread_patch/option.cpp	2008-11-15 22:04:51.000000000 +0100
@@ -74,7 +74,7 @@
    { "Toga King Safety Margin",  true, "1700",    "spin",  "min 500 max 3000", NULL },
    { "Toga Extended History Pruning",true, "false", "check", "", NULL },
    { "Toga History Threshold",   false, "40",   "spin",  "min 0 max 100", NULL },
-
+   { "Number of Threads",   true, "1",   "spin",  "min 1 max 16", NULL },
    { NULL, false, NULL, NULL, NULL, NULL, },
 };
 
diff -Naur -x '*.orig' src/protocol.cpp src_thread_patch/protocol.cpp
--- src/protocol.cpp	2008-10-22 09:50:44.000000000 +0200
+++ src_thread_patch/protocol.cpp	2008-11-15 22:21:04.000000000 +0100
@@ -112,8 +112,11 @@
       // late initialisation
 
       Init = true;
+
+      NumberThreads=option_get_int("Number of Threads");
+      if(NumberThreads>MaxThreads) NumberThreads=MaxThreads;
 		
-	   book_parameter();
+      book_parameter();
       
 	   //SearchInput->multipv = option_get_int("MultiPV");
 
diff -Naur -x '*.orig' src/search.cpp src_thread_patch/search.cpp
--- src/search.cpp	2008-10-22 09:50:44.000000000 +0200
+++ src_thread_patch/search.cpp	2008-11-15 22:12:06.000000000 +0100
@@ -70,6 +70,9 @@
 static pthread_t threat_handle[MaxThreads];
 static my_sem_t thread_runnable[MaxThreads];
 #endif
+
+int NumberThreads = 1;
+
 //bool trans_endgame;
 //CRITICAL_SECTION CriticalSection; 
 
diff -Naur -x '*.orig' src/search.h src_thread_patch/search.h
--- src/search.h	2008-01-15 21:17:28.000000000 +0100
+++ src_thread_patch/search.h	2008-11-15 22:12:36.000000000 +0100
@@ -17,7 +17,6 @@
 
 const int MultiPVMax = 10;
 const int MaxThreads = 16;
-const int NumberThreads = 2;
 
 const int DepthMax = 64;
 const int HeightMax = 256;
@@ -114,6 +113,7 @@
 extern search_best_t SearchBest[MaxThreads][MultiPVMax];
 extern search_root_t SearchRoot[MaxThreads][1];
 extern search_current_t SearchCurrent[MaxThreads][1];
+extern int NumberThreads;
 
 // functions
 

Reply via email to