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