Skip to content
Snippets Groups Projects
Commit 18bca034 authored by Morris Jette's avatar Morris Jette
Browse files

fix --ntasks-per-socket with --cpus-per-task

Previous logic was counting CPUs, but assuming each task would
only use one CPU.
parent 9304aad4
No related branches found
No related tags found
No related merge requests found
...@@ -770,9 +770,13 @@ static int _cyclic_sync_core_bitmap(struct job_record *job_ptr, ...@@ -770,9 +770,13 @@ static int _cyclic_sync_core_bitmap(struct job_record *job_ptr,
cpus = job_res->cpus[i]; cpus = job_res->cpus[i];
if (ntasks_per_socket != 0xffff) { if (ntasks_per_socket != 0xffff) {
int x_cpus; int x_cpus, cpus_per_socket;
uint32_t total_cpus = 0; uint32_t total_cpus = 0;
uint32_t *cpus_cnt = xmalloc(sizeof(uint32_t)* sockets); uint32_t *cpus_cnt;
cpus_per_socket = ntasks_per_socket *
job_ptr->details->cpus_per_task;
cpus_cnt = xmalloc(sizeof(uint32_t) * sockets);
for (s = 0; s < sockets; s++) { for (s = 0; s < sockets; s++) {
for (j = sock_start[s]; j < sock_end[s]; j++) { for (j = sock_start[s]; j < sock_end[s]; j++) {
if (bit_test(core_map, j)) if (bit_test(core_map, j))
...@@ -781,14 +785,14 @@ static int _cyclic_sync_core_bitmap(struct job_record *job_ptr, ...@@ -781,14 +785,14 @@ static int _cyclic_sync_core_bitmap(struct job_record *job_ptr,
total_cpus += cpus_cnt[s]; total_cpus += cpus_cnt[s];
} }
for (s = 0; s < sockets && total_cpus > cpus; s++) { for (s = 0; s < sockets && total_cpus > cpus; s++) {
if (cpus_cnt[s] > ntasks_per_socket) { if (cpus_cnt[s] > cpus_per_socket) {
x_cpus = cpus_cnt[s] -ntasks_per_socket; x_cpus = cpus_cnt[s] - cpus_per_socket;
cpus_cnt[s] = ntasks_per_socket; cpus_cnt[s] = cpus_per_socket;
total_cpus -= x_cpus; total_cpus -= x_cpus;
} }
} }
for (s = 0; s < sockets && total_cpus > cpus; s++) { for (s = 0; s < sockets && total_cpus > cpus; s++) {
if ((cpus_cnt[s] <= ntasks_per_socket) && if ((cpus_cnt[s] <= cpus_per_socket) &&
(total_cpus - cpus_cnt[s] >= cpus)) { (total_cpus - cpus_cnt[s] >= cpus)) {
sock_avoid[s] = true; sock_avoid[s] = true;
total_cpus -= cpus_cnt[s]; total_cpus -= cpus_cnt[s];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment