mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-02-06 20:29:10 +01:00
DroidFish: Recognize UCI option "Cores" to set number of search threads.
This commit is contained in:
parent
c9b019e581
commit
bcc8353129
|
@ -553,7 +553,7 @@ public class DroidComputerPlayer {
|
|||
}
|
||||
uciEngine.setOption("Ponder", sr.ponderEnabled);
|
||||
uciEngine.setOption("UCI_AnalyseMode", false);
|
||||
uciEngine.setOption("Threads", sr.engineThreads > 0 ? sr.engineThreads : numCPUs);
|
||||
uciEngine.setNThreads(sr.engineThreads > 0 ? sr.engineThreads : numCPUs);
|
||||
uciEngine.writeLineToEngine(posStr.toString());
|
||||
if (sr.wTime < 1) sr.wTime = 1;
|
||||
if (sr.bTime < 1) sr.bTime = 1;
|
||||
|
@ -590,7 +590,7 @@ public class DroidComputerPlayer {
|
|||
}
|
||||
uciEngine.writeLineToEngine(posStr.toString());
|
||||
uciEngine.setOption("UCI_AnalyseMode", true);
|
||||
uciEngine.setOption("Threads", sr.engineThreads > 0 ? sr.engineThreads : numCPUs);
|
||||
uciEngine.setNThreads(sr.engineThreads > 0 ? sr.engineThreads : numCPUs);
|
||||
StringBuilder goStr = new StringBuilder(96);
|
||||
goStr.append("go infinite");
|
||||
if (sr.searchMoves != null) {
|
||||
|
|
|
@ -200,7 +200,7 @@ public class ExternalEngine extends UCIEngineBase {
|
|||
return true;
|
||||
if (hashMB != getHashMB(engineOptions.hashMB))
|
||||
return false;
|
||||
if (haveOption("gaviotatbpath") && !gaviotaTbPath.equals(engineOptions.gtbPath))
|
||||
if (hasOption("gaviotatbpath") && !gaviotaTbPath.equals(engineOptions.gtbPath))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -223,7 +223,7 @@ public class NetworkEngine extends UCIEngineBase {
|
|||
return false;
|
||||
if (hashMB != engineOptions.hashMB)
|
||||
return false;
|
||||
if (haveOption("gaviotatbpath") && !gaviotaTbPath.equals(engineOptions.gtbPath))
|
||||
if (hasOption("gaviotatbpath") && !gaviotaTbPath.equals(engineOptions.gtbPath))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -71,4 +71,7 @@ public interface UCIEngine {
|
|||
|
||||
/** Register an option as supported by the engine. */
|
||||
public void registerOption(String optName);
|
||||
|
||||
/** Set number of search threads to use. */
|
||||
public void setNThreads(int nThreads);
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ public abstract class UCIEngineBase implements UCIEngine {
|
|||
}
|
||||
|
||||
/** Return true if engine has option optName. */
|
||||
protected boolean haveOption(String optName) {
|
||||
protected boolean hasOption(String optName) {
|
||||
return allOptions.contains(optName);
|
||||
}
|
||||
|
||||
|
@ -114,4 +114,12 @@ public abstract class UCIEngineBase implements UCIEngine {
|
|||
writeLineToEngine(String.format(Locale.US, "setoption name %s value %s", name, value));
|
||||
currOptions.put(lcName, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNThreads(int nThreads) {
|
||||
if (allOptions.contains("threads"))
|
||||
setOption("Threads", nThreads);
|
||||
else if (allOptions.contains("cores"))
|
||||
setOption("Cores", nThreads);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user