Fix: -compute-method not set when configuration file present (#268)
This commit is contained in:
@@ -361,10 +361,16 @@ public class SettingsLoader {
|
||||
config.setUsePriority(priority);
|
||||
}
|
||||
try {
|
||||
if ((config.getComputeMethod() == null && computeMethod != null) || (computeMethod != null && config.getComputeMethod() != ComputeType
|
||||
if (config.getComputeMethod() == null && computeMethod == null) {
|
||||
config.setComputeMethod(ComputeType.CPU);
|
||||
}
|
||||
else if ((config.getComputeMethod() == null && computeMethod != null) || (computeMethod != null && config.getComputeMethod() != ComputeType
|
||||
.valueOf(computeMethod))) {
|
||||
if (config.getComputeMethod() == null) {
|
||||
config.setComputeMethod(ComputeType.valueOf(computeMethod));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
System.err.println("SettingsLoader::merge failed to handle compute method (raw value: '" + computeMethod + "')");
|
||||
|
||||
@@ -112,7 +112,7 @@ public class Worker {
|
||||
return;
|
||||
}
|
||||
|
||||
ComputeType compute_method = ComputeType.CPU;
|
||||
ComputeType compute_method = null;
|
||||
Configuration config = new Configuration(null, login, password);
|
||||
config.setPrintLog(print_log);
|
||||
config.setUsePriority(priority);
|
||||
@@ -223,10 +223,7 @@ public class Worker {
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (config.getGPUDevice() == null) {
|
||||
compute_method = ComputeType.CPU;
|
||||
}
|
||||
else {
|
||||
if (config.getGPUDevice() != null) {
|
||||
compute_method = ComputeType.GPU;
|
||||
}
|
||||
}
|
||||
@@ -246,6 +243,7 @@ public class Worker {
|
||||
config.setExtras(extras);
|
||||
}
|
||||
|
||||
if (compute_method != null) {
|
||||
if (compute_method == ComputeType.CPU && config.getGPUDevice() != null) {
|
||||
System.err.println(
|
||||
"ERROR: The compute method is set to use CPU only, but a GPU has also been specified. Change the compute method to CPU_GPU or remove the GPU");
|
||||
@@ -263,6 +261,7 @@ public class Worker {
|
||||
else if (compute_method == ComputeType.CPU) {
|
||||
config.setGPUDevice(null); // remove the GPU
|
||||
}
|
||||
}
|
||||
|
||||
config.setComputeMethod(compute_method);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user