set the minimum core amount to 2 (1 on single core cpus)

This commit is contained in:
harlekin
2021-07-07 16:18:45 +00:00
committed by Sheepit Renderfarm
parent 9a5cd74609
commit 6ca2067cbe
5 changed files with 10 additions and 6 deletions

View File

@@ -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;

View File

@@ -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());