User can set the number of cpu core for the render process from the swing ui

This commit is contained in:
Laurent Clouet
2015-04-20 21:26:07 +01:00
parent 0506433146
commit e2550e5f03
2 changed files with 46 additions and 3 deletions

View File

@@ -20,6 +20,7 @@ public class SettingsLoader {
private String password;
private String computeMethod;
private String gpu;
private String cores;
private String cacheDir;
private String autoSignIn;
private String ui;
@@ -32,13 +33,16 @@ public class SettingsLoader {
path = path_;
}
public SettingsLoader(String login_, String password_, ComputeType computeMethod_, GPUDevice gpu_, String cacheDir_, boolean autoSignIn_, String ui_) {
public SettingsLoader(String login_, String password_, ComputeType computeMethod_, GPUDevice gpu_, int cores_, String cacheDir_, boolean autoSignIn_, String ui_) {
path = getDefaultFilePath();
login = login_;
password = password_;
cacheDir = cacheDir_;
autoSignIn = String.valueOf(autoSignIn_);
ui = ui_;
if (cores_ > 0) {
cores = String.valueOf(cores_);
}
if (computeMethod_ != null) {
try {
@@ -79,6 +83,10 @@ public class SettingsLoader {
prop.setProperty("compute-gpu", gpu);
}
if (cores != null) {
prop.setProperty("cpu-cores", cores);
}
if (login != null) {
prop.setProperty("login", login);
}
@@ -143,6 +151,10 @@ public class SettingsLoader {
this.gpu = prop.getProperty("compute-gpu");
}
if (prop.containsKey("cpu-cores")) {
this.cores = prop.getProperty("cpu-cores");
}
if (prop.containsKey("login")) {
this.login = prop.getProperty("login");
}
@@ -207,6 +219,9 @@ public class SettingsLoader {
config.setUseGPU(device);
}
}
if (config.getNbCores() == -1 && cores != null) {
config.setUseNbCores(Integer.valueOf(cores));
}
if (config.getUserSpecifiedACacheDir() == false && cacheDir != null) {
config.setCacheDir(new File(cacheDir));
}