Skip to content
Snippets Groups Projects
Commit d411b34a authored by Moe Jette's avatar Moe Jette
Browse files

srun mod to support un-even task distribution across nodes.

parent d79f1624
No related branches found
No related tags found
No related merge requests found
...@@ -108,19 +108,17 @@ launch(void *arg) ...@@ -108,19 +108,17 @@ launch(void *arg)
task_ids[i] = (uint32_t *) xmalloc(job->ntask[i]*sizeof(uint32_t)); task_ids[i] = (uint32_t *) xmalloc(job->ntask[i]*sizeof(uint32_t));
taskid = 0; taskid = 0;
if (opt.distribution == SRUN_DIST_BLOCK) { if (opt.distribution == SRUN_DIST_BLOCK) {
for (i = 0; i < job->nhosts; i++) { for (i=0; ((i<job->nhosts) && (taskid<opt.nprocs)); i++) {
for (j = 0; j < job->ntask[i]; j++) for (j=0; ((j<job->ntask[i]) && (taskid<opt.nprocs)); j++) {
task_ids[i][j] = taskid++; task_ids[i][j] = taskid++;
}
} }
} else { /* (opt.distribution == SRUN_DIST_CYCLIC) */ } else { /* (opt.distribution == SRUN_DIST_CYCLIC) */
for (k=0; ; k++) { /* cycle counter */ for (k=0; (taskid<opt.nprocs); k++) { /* cycle counter */
int last_taskid = taskid; for (i=0; ((i<job->nhosts) && (taskid<opt.nprocs)); i++) {
for (i = 0; i < job->nhosts; i++) {
if (k < job->ntask[i]) if (k < job->ntask[i])
task_ids[i][k] = taskid++; task_ids[i][k] = taskid++;
} }
if (taskid == last_taskid)
break;
} }
} }
......
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