Revert "Reverting"

This reverts commit 3e4a6c5c1c.
This commit is contained in:
Laurence 2019-12-02 11:02:37 +01:00
parent ddc29978b7
commit 3fdf87d0ba
2 changed files with 8 additions and 9 deletions

View File

@ -915,17 +915,11 @@ bool PLAN_CLASS_SPEC::check(
hu.avg_ncpus = avg_ncpus;
} else {
if (can_use_multicore) {
hu.avg_ncpus = max_threads;
// Limits the number of threads to the number of CPUs
if (max_threads > g_wreq->effective_ncpus) {
hu.avg_ncpus = g_wreq->effective_ncpus;
}
// Limits the number of threads to the max_cpus volunteer's project preference
if (g_wreq->project_prefs.max_cpus) {
if (hu.avg_ncpus > g_wreq->project_prefs.max_cpus) {
hu.avg_ncpus = g_wreq->project_prefs.max_cpus;
}
}
} else {
hu.avg_ncpus = max_threads;
}
// if per-CPU mem usage given
//

View File

@ -145,6 +145,11 @@ void WORK_REQ::get_job_limits() {
if (n > config.max_ncpus) n = config.max_ncpus;
if (n < 1) n = 1;
if (n > MAX_CPUS) n = MAX_CPUS;
if (project_prefs.max_cpus) {
if (n > project_prefs.max_cpus) {
n = project_prefs.max_cpus;
}
}
ninstances[PROC_TYPE_CPU] = n;
effective_ncpus = n;