set the minimum core amount to 2 (1 on single core cpus)
This commit is contained in:
committed by
Sheepit Renderfarm
parent
9a5cd74609
commit
6ca2067cbe
@@ -37,6 +37,7 @@ import com.sheepit.client.os.OS;
|
||||
import lombok.Data;
|
||||
|
||||
@Data public class Configuration {
|
||||
|
||||
public enum ComputeType {
|
||||
CPU_GPU, CPU, GPU
|
||||
} // accept job for ...
|
||||
|
||||
@@ -50,6 +50,7 @@ import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.JavaNetCookieJar;
|
||||
|
||||
import com.sheepit.client.hardware.cpu.CPU;
|
||||
import com.sheepit.client.Configuration.ComputeType;
|
||||
import com.sheepit.client.Error.ServerCode;
|
||||
import com.sheepit.client.datamodel.CacheFileMD5;
|
||||
@@ -195,7 +196,7 @@ public class Server extends Thread {
|
||||
.add("cpu_family", os.getCPU().family())
|
||||
.add("cpu_model", os.getCPU().model())
|
||||
.add("cpu_model_name", os.getCPU().name())
|
||||
.add("cpu_cores", String.valueOf(user_config.getNbCores() == -1 ? os.getCPU().cores() : user_config.getNbCores()))
|
||||
.add("cpu_cores", String.valueOf(user_config.getNbCores() == -1 ? os.getCPU().cores() : Math.max(CPU.MIN_CORES, user_config.getNbCores())))
|
||||
.add("os", os.name())
|
||||
.add("os_version", os.getVersion())
|
||||
.add("ram", String.valueOf(os.getMemory()))
|
||||
@@ -275,7 +276,8 @@ public class Server extends Thread {
|
||||
.addQueryParameter("computemethod", String.valueOf(user_config.computeMethodToInt()))
|
||||
.addQueryParameter("network_dl", String.valueOf(dlStats.getRawAverageSessionSpeed()))
|
||||
.addQueryParameter("network_up", String.valueOf(ulStats.getRawAverageSessionSpeed()))
|
||||
.addQueryParameter("cpu_cores", String.valueOf(user_config.getNbCores() == -1 ? os.getCPU().cores() : user_config.getNbCores()))
|
||||
.addQueryParameter("cpu_cores", String.valueOf(user_config.getNbCores() == -1 ? os.getCPU().cores() :
|
||||
(Math.max(user_config.getNbCores(), CPU.MIN_CORES))))
|
||||
.addQueryParameter("ram_max", String.valueOf(maxMemory))
|
||||
.addQueryParameter("rendertime_max", String.valueOf(user_config.getMaxRenderTime()));
|
||||
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
package com.sheepit.client.hardware.cpu;
|
||||
|
||||
public class CPU {
|
||||
final public static int MIN_RENDERBUCKET_SIZE = 32;
|
||||
public static final int MIN_RENDERBUCKET_SIZE = 32;
|
||||
public static final int MIN_CORES = Runtime.getRuntime().availableProcessors() > 1 ? 2 : 1;
|
||||
private String name;
|
||||
private String model;
|
||||
private String family;
|
||||
|
||||
@@ -71,7 +71,7 @@ public class Worker {
|
||||
|
||||
@Option(name = "-compute-method", usage = "CPU: only use cpu, GPU: only use gpu, CPU_GPU: can use cpu and gpu (not at the same time) if -gpu is not use it will not use the gpu", metaVar = "CPU", required = false) private String method = null;
|
||||
|
||||
@Option(name = "-cores", usage = "Number of cores/threads to use for the render", metaVar = "3", required = false) private int nb_cores = -1;
|
||||
@Option(name = "-cores", usage = "Number of cores/threads to use for the render. The minimum is two cores unless your system only has one", metaVar = "3", required = false) private int nb_cores = -1;
|
||||
|
||||
@Option(name = "-memory", usage = "Maximum memory allow to be used by renderer, number with unit (800M, 2G, ...)", required = false) private String max_ram = null;
|
||||
|
||||
|
||||
@@ -368,7 +368,7 @@ public class Settings implements Activity {
|
||||
display = (double) cpu.cores() / step;
|
||||
}
|
||||
|
||||
cpuCores = new JSlider(1, cpu.cores());
|
||||
cpuCores = new JSlider(CPU.MIN_CORES, cpu.cores());
|
||||
cpuCores.setMajorTickSpacing((int) (step));
|
||||
cpuCores.setMinorTickSpacing(1);
|
||||
cpuCores.setPaintTicks(true);
|
||||
@@ -379,7 +379,7 @@ public class Settings implements Activity {
|
||||
}
|
||||
});
|
||||
cpuCores.setPaintLabels(true);
|
||||
cpuCores.setValue(config.getNbCores() != -1 ? config.getNbCores() : cpuCores.getMaximum());
|
||||
cpuCores.setValue(config.getNbCores() != -1 ? (Math.max(config.getNbCores(), CPU.MIN_CORES)): cpuCores.getMaximum());
|
||||
JLabel coreLabel = new JLabel("CPU cores:");
|
||||
coreLabel.setToolTipText(SwingTooltips.CPU_CORES.getText());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user