Skip to content

Commit

Permalink
quattor/functions/hardware: Fix thread calculation
Browse files Browse the repository at this point in the history
Cores is a mandatory property, so don't check if it is defined.
Threads must be the sum of cores, not a count of CPUs.
  • Loading branch information
jrha committed Sep 12, 2024
1 parent 00425ec commit 7aebd73
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions quattor/functions/hardware.pan
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,11 @@ function get_num_of_cores_max_threads = {
'threads', 0,
);
foreach (i; cpu; hw_config['cpu']) {
result['cores'] = result['cores'] + cpu['cores'];
if (is_defined(cpu['max_threads'])) {
result['threads'] = result['threads'] + cpu['max_threads'];
} else {
result['threads'] = result['threads'] + 1;
};
if (is_defined(cpu['cores'])) {
result['cores'] = result['cores'] + cpu['cores'];
} else {
result['cores'] = result['cores'] + 1;
result['threads'] = result['threads'] + cpu['cores'];
};
};
debug('%s: num of CPUs=%d, num of cores=%d', OBJECT, length(hw_config['cpu']), cores);
Expand Down

0 comments on commit 7aebd73

Please sign in to comment.