mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-12-12 09:02:41 +01:00
DroidFish: Allow using more threads and more hash memory. Useful for network engines.
This commit is contained in:
@@ -364,26 +364,38 @@ you are not actively using the program.\
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
</string-array>
|
||||
<item>6</item>
|
||||
<item>8</item>
|
||||
</string-array>
|
||||
<string-array name="engine_threads_values">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
</string-array>
|
||||
<item>6</item>
|
||||
<item>8</item>
|
||||
</string-array>
|
||||
<string-array name="engine_hash_texts">
|
||||
<item>16 MB</item>
|
||||
<item>32 MB</item>
|
||||
<item>64 MB</item>
|
||||
<item>128 MB</item>
|
||||
</string-array>
|
||||
<item>256 MB</item>
|
||||
<item>512 MB</item>
|
||||
<item>1024 MB</item>
|
||||
<item>2048 MB</item>
|
||||
</string-array>
|
||||
<string-array name="engine_hash_values">
|
||||
<item>16</item>
|
||||
<item>32</item>
|
||||
<item>64</item>
|
||||
<item>128</item>
|
||||
</string-array>
|
||||
<item>256</item>
|
||||
<item>512</item>
|
||||
<item>1024</item>
|
||||
<item>2048</item>
|
||||
</string-array>
|
||||
<string-array name="moves_per_session_texts">
|
||||
<item>Whole Game</item>
|
||||
<item>1 move</item>
|
||||
|
||||
@@ -787,7 +787,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||
bookOptions.random = (settings.getInt("bookRandom", 500) - 500) * (3.0 / 500);
|
||||
setBookOptions();
|
||||
|
||||
engineOptions.hashMB = getHashMB();
|
||||
engineOptions.hashMB = getIntSetting("hashMB", 16);
|
||||
engineOptions.hints = settings.getBoolean("tbHints", false);
|
||||
engineOptions.hintsEdit = settings.getBoolean("tbHintsEdit", false);
|
||||
engineOptions.rootProbe = settings.getBoolean("tbRootProbe", true);
|
||||
@@ -824,19 +824,6 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||
ctrl.prefsChanged();
|
||||
}
|
||||
|
||||
/** Get hash size in MB from settings, but reduce size to an amount that the device can handle. */
|
||||
private final int getHashMB() {
|
||||
int hashMB = getIntSetting("hashMB", 16);
|
||||
if (hashMB > 16) {
|
||||
int maxMem = (int)(Runtime.getRuntime().maxMemory() / (1024*1024));
|
||||
if (maxMem < 16)
|
||||
maxMem = 16;
|
||||
if (hashMB > maxMem)
|
||||
hashMB = maxMem;
|
||||
}
|
||||
return hashMB;
|
||||
}
|
||||
|
||||
private void updateButtons() {
|
||||
boolean largeButtons = settings.getBoolean("largeButtons", false);
|
||||
Resources r = getResources();
|
||||
|
||||
@@ -171,8 +171,8 @@ public class ExternalEngine extends UCIEngineBase {
|
||||
@Override
|
||||
public void initOptions(EngineOptions engineOptions) {
|
||||
super.initOptions(engineOptions);
|
||||
hashMB = engineOptions.hashMB;
|
||||
setOption("Hash", engineOptions.hashMB);
|
||||
hashMB = getHashMB(engineOptions.hashMB);
|
||||
setOption("Hash", hashMB);
|
||||
if (engineOptions.engineProbe) {
|
||||
gaviotaTbPath = engineOptions.gtbPath;
|
||||
setOption("GaviotaTbPath", engineOptions.gtbPath);
|
||||
@@ -181,12 +181,24 @@ public class ExternalEngine extends UCIEngineBase {
|
||||
optionsInitialized = true;
|
||||
}
|
||||
|
||||
/** Reduce too large hash sizes. */
|
||||
private final int getHashMB(int hashMB) {
|
||||
if (hashMB > 16) {
|
||||
int maxMem = (int)(Runtime.getRuntime().maxMemory() / (1024*1024));
|
||||
if (maxMem < 16)
|
||||
maxMem = 16;
|
||||
if (hashMB > maxMem)
|
||||
hashMB = maxMem;
|
||||
}
|
||||
return hashMB;
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
@Override
|
||||
public boolean optionsOk(EngineOptions engineOptions) {
|
||||
if (!optionsInitialized)
|
||||
return true;
|
||||
if (hashMB != engineOptions.hashMB)
|
||||
if (hashMB != getHashMB(engineOptions.hashMB))
|
||||
return false;
|
||||
if (haveOption("gaviotatbpath") && !gaviotaTbPath.equals(engineOptions.gtbPath))
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user