diff --git a/slurm/slurm.h.in b/slurm/slurm.h.in index 8d02b9587ab2a930c23e7f52c5ee7f2e042be6d4..f2f8f37c576da49ca206c7b3eb333205cff26ca8 100644 --- a/slurm/slurm.h.in +++ b/slurm/slurm.h.in @@ -1927,6 +1927,7 @@ typedef struct { bool no_alloc; uint32_t slurmd_debug; /* remote slurmd debug level */ uint32_t pack_offset; /* Pack job offset or NO_VAL */ + uint32_t task_offset; /* Pack job tsk offset or NO_VAL */ bool parallel_debug; uint32_t profile; /* Level of acct_gather_profile {all | none} */ char *task_prolog; diff --git a/src/api/step_io.c b/src/api/step_io.c index 03810c2be0fa4b93a3307d1f32555f7e66a028e5..43407e128c6439d561b9c7a228bae3c446cd8a9f 100644 --- a/src/api/step_io.c +++ b/src/api/step_io.c @@ -598,6 +598,7 @@ static int _file_write(eio_obj_t *obj, List objs) info->out_remaining, info->out_msg->header.gtaskid, info->cio->pack_offset, + info->cio->task_offset, info->cio->label, info->cio->taskid_width)) < 0) { list_enqueue(info->cio->free_outgoing, info->out_msg); @@ -1069,7 +1070,8 @@ _estimate_nports(int nclients, int cli_per_port) client_io_t *client_io_handler_create(slurm_step_io_fds_t fds, int num_tasks, int num_nodes, slurm_cred_t *cred, - bool label, uint32_t pack_offset) + bool label, uint32_t pack_offset, + uint32_t task_offset) { client_io_t *cio; int i; @@ -1085,6 +1087,7 @@ client_io_t *client_io_handler_create(slurm_step_io_fds_t fds, int num_tasks, cio->num_tasks = num_tasks; cio->num_nodes = num_nodes; cio->pack_offset = pack_offset; + cio->task_offset = task_offset; cio->label = label; if (cio->label) diff --git a/src/api/step_io.h b/src/api/step_io.h index 3c2bd8a138fdfe70cf20df2cb5d5267622bc8888..f1e7553fe0242c1853e23b0223566de908c46e1c 100644 --- a/src/api/step_io.h +++ b/src/api/step_io.h @@ -45,7 +45,9 @@ struct client_io { int num_nodes; bool label; int taskid_width; /* characters needed for task_id label */ - uint32_t pack_offset; + uint32_t pack_offset; /* offset within a pack-job or NO_VAL */ + uint32_t task_offset; /* task offset within a pack-job or NO_VAL */ + char *io_key; /* internal variables */ @@ -103,7 +105,8 @@ typedef struct client_io client_io_t; */ client_io_t *client_io_handler_create(slurm_step_io_fds_t fds, int num_tasks, int num_nodes, slurm_cred_t *cred, - bool label, uint32_t pack_offset); + bool label, uint32_t pack_offset, + uint32_t task_offset); int client_io_handler_start(client_io_t *cio); diff --git a/src/api/step_launch.c b/src/api/step_launch.c index dfef26eda6854b0964c044f2d7b722749284842e..64fb7d8597c41a79fa4de31f210e22ef0b88d85f 100644 --- a/src/api/step_launch.c +++ b/src/api/step_launch.c @@ -165,6 +165,7 @@ void slurm_step_launch_params_t_init (slurm_step_launch_params_t *ptr) ptr->cpu_freq_max = NO_VAL; ptr->cpu_freq_gov = NO_VAL; ptr->pack_offset = NO_VAL; + ptr->task_offset = NO_VAL; } /* @@ -372,7 +373,8 @@ extern int slurm_step_launch(slurm_step_ctx_t *ctx, launch.nnodes, ctx->step_resp->cred, params->labelio, - params->pack_offset); + params->pack_offset, + params->task_offset); if (ctx->launch_state->io.normal == NULL) { rc = SLURM_ERROR; goto fail1; @@ -566,7 +568,8 @@ extern int slurm_step_launch_add(slurm_step_ctx_t *ctx, launch.nnodes, ctx->step_resp->cred, params->labelio, - params->pack_offset); + params->pack_offset, + params->task_offset); if (ctx->launch_state->io.normal == NULL) { rc = SLURM_ERROR; goto fail1; diff --git a/src/common/write_labelled_message.c b/src/common/write_labelled_message.c index fd6868f737bc5d71e5a5101a9ada4b269060dfd1..a5ded00a9b832540a23a5e9306959ba989b671fa 100644 --- a/src/common/write_labelled_message.c +++ b/src/common/write_labelled_message.c @@ -48,18 +48,20 @@ #include "src/common/xmalloc.h" #include "src/common/xstring.h" -static char *_build_label(int taskid, int taskid_width, uint32_t pack_offset); +static char *_build_label(int task_id, int task_id_width, uint32_t pack_offset, + uint32_t task_offset); static int _write_line(int fd, char *prefix, char *suffix, void *buf, int len); /* - * fd is the file descriptor to write to - * buf is the char buffer to write - * len is the buffer length in bytes - * taskid is will be used in the label - * pack_offset is the offset within a pack-job or NO_VAL - * label if true, prepend each line of the buffer with a + * fd is the file descriptor to write to + * buf is the char buffer to write + * len is the buffer length in bytes + * task_id is will be used in the label + * pack_offset is the offset within a pack-job or NO_VAL + * task_offset is the task offset within a pack-job or NO_VAL + * label if true, prepend each line of the buffer with a * label for the task id - * taskid_width is the number of digits to use for the task id + * task_id_width is the number of digits to use for the task id * * Write as many lines from the message as possible. Return * the number of bytes from the message that have been written, @@ -69,9 +71,9 @@ static int _write_line(int fd, char *prefix, char *suffix, void *buf, int len); * in a '\n'), then add a newline to the output file, but only * in label mode. */ -extern int write_labelled_message(int fd, void *buf, int len, int taskid, - uint32_t pack_offset, bool label, - int taskid_width) +extern int write_labelled_message(int fd, void *buf, int len, int task_id, + uint32_t pack_offset, uint32_t task_offset, + bool label, int task_id_width) { void *start, *end; char *prefix = NULL, *suffix = NULL; @@ -80,8 +82,11 @@ extern int write_labelled_message(int fd, void *buf, int len, int taskid, int line_len; int rc = -1; - if (label) - prefix = _build_label(taskid, taskid_width, pack_offset); + if (label) { + prefix = _build_label(task_id, task_id_width, pack_offset, + task_offset); + } + while (remaining > 0) { start = buf + written; end = memchr(start, '\n', remaining); @@ -118,14 +123,22 @@ done: /* * Build line label. Call xfree() to release returned memory */ -static char *_build_label(int taskid, int taskid_width, uint32_t pack_offset) +static char *_build_label(int task_id, int task_id_width, + uint32_t pack_offset, uint32_t task_offset) { char *buf = NULL; - if (pack_offset == NO_VAL) - xstrfmtcat(buf, "%*d: ", taskid_width, taskid); - else - xstrfmtcat(buf, "P%u %*d: ", pack_offset, taskid_width, taskid); + if (pack_offset != NO_VAL) { + if (task_offset == NO_VAL) { + xstrfmtcat(buf, "P%u %*d: ", pack_offset, task_id_width, + task_id); + } else { + xstrfmtcat(buf, "%*d: ", task_id_width, + (task_id + task_offset)); + } + } else { + xstrfmtcat(buf, "%*d: ", task_id_width, task_id); + } return buf; } diff --git a/src/common/write_labelled_message.h b/src/common/write_labelled_message.h index 12ec33155de98232618f85d60f334ede050f12aa..4c9d76bce0d33813e5121ca503ba359558e18ac9 100644 --- a/src/common/write_labelled_message.h +++ b/src/common/write_labelled_message.h @@ -42,14 +42,15 @@ #include "slurm/slurm.h" /* - * fd is the file descriptor to write to - * buf is the char buffer to write - * len is the buffer length in bytes - * taskid is will be used in the label - * pack_offset is the offset within a pack-job or NO_VAL - * label if true, prepend each line of the buffer with a + * fd is the file descriptor to write to + * buf is the char buffer to write + * len is the buffer length in bytes + * task_id is will be used in the label + * pack_offset is the offset within a pack-job or NO_VAL + * task_offset is the task offset within a pack-job or NO_VAL + * label if true, prepend each line of the buffer with a * label for the task id - * taskid_width is the number of digits to use for the task id + * task_id_width is the number of digits to use for the task id * * Write as many lines from the message as possible. Return * the number of bytes from the message that have been written, @@ -59,8 +60,8 @@ * in a '\n'), then add a newline to the output file, but only * in label mode. */ -extern int write_labelled_message(int fd, void *buf, int len, int taskid, - uint32_t pack_offset, bool label, - int taskid_width); +extern int write_labelled_message(int fd, void *buf, int len, int task_id, + uint32_t pack_offset, uint32_t task_offset, + bool label, int task_id_width); #endif diff --git a/src/plugins/launch/aprun/launch_aprun.c b/src/plugins/launch/aprun/launch_aprun.c index 6f35b0e3ee2f2c75c051655ea214c409e3964576..3978e3ab75781f4b027ee6d06ced529787a6a1cd 100644 --- a/src/plugins/launch/aprun/launch_aprun.c +++ b/src/plugins/launch/aprun/launch_aprun.c @@ -703,8 +703,7 @@ extern int launch_p_handle_multi_prog_verify(int command_pos, opt_t *opt_local) extern int launch_p_create_job_step(srun_job_t *job, bool use_all_cpus, void (*signal_function)(int), - sig_atomic_t *destroy_job, opt_t *opt_local, - int pack_offset) + sig_atomic_t *destroy_job, opt_t *opt_local) { if (opt_local->launch_cmd) { int i = 0; @@ -773,8 +772,7 @@ extern int launch_p_step_launch(srun_job_t *job, slurm_step_io_fds_t *cio_fds, return rc; } -extern int launch_p_step_wait(srun_job_t *job, bool got_alloc, opt_t *opt_local, - int pack_offset) +extern int launch_p_step_wait(srun_job_t *job, bool got_alloc, opt_t *opt_local) { return SLURM_SUCCESS; } diff --git a/src/plugins/launch/poe/launch_poe.c b/src/plugins/launch/poe/launch_poe.c index 0419cf53227943cd5e8217eff3d5b4ceaaa04789..82ea5b0d53adf9fbb9cbdef6b00c21cc77a8464a 100644 --- a/src/plugins/launch/poe/launch_poe.c +++ b/src/plugins/launch/poe/launch_poe.c @@ -173,7 +173,7 @@ static void _setenv(const char *name, const char *value, int overwrite, { char *key = NULL; - if (pack_offset == -1) { + if (pack_offset == NO_VAL) { setenv(name, value, overwrite); } else { xstrfmtcat(key, "%s_PACK_GROUP_%d", name, pack_offset); @@ -357,8 +357,7 @@ extern int launch_p_handle_multi_prog_verify(int command_pos, opt_t *opt_local) extern int launch_p_create_job_step(srun_job_t *job, bool use_all_cpus, void (*signal_function)(int), - sig_atomic_t *destroy_job, opt_t *opt_local, - int pack_offset) + sig_atomic_t *destroy_job, opt_t *opt_local) { char dname[512], value[32]; char *protocol = "mpi"; @@ -773,7 +772,7 @@ extern int launch_p_create_job_step(srun_job_t *job, bool use_all_cpus, " -stdoutmode unordered"); } - _propagate_srun_opts(nnodes, ntasks, opt_local, pack_offset); + _propagate_srun_opts(nnodes, ntasks, opt_local, job->pack_offset); setenv("SLURM_STARTED_STEP", "YES", 1); //disable_status = opt_local->disable_status; //quit_on_intr = opt_local->quit_on_intr; @@ -849,8 +848,7 @@ extern int launch_p_step_launch(srun_job_t *job, slurm_step_io_fds_t *cio_fds, return rc; } -extern int launch_p_step_wait(srun_job_t *job, bool got_alloc, opt_t *opt_local, - int pack_offset) +extern int launch_p_step_wait(srun_job_t *job, bool got_alloc, opt_t *opt_local) { return SLURM_SUCCESS; } diff --git a/src/plugins/launch/runjob/launch_runjob.c b/src/plugins/launch/runjob/launch_runjob.c index 519099a1f9b35dfa1b77b609d15eaec816a4bcdf..ea460ce61210fbaff2dc46e14a58d919fc65cf87 100644 --- a/src/plugins/launch/runjob/launch_runjob.c +++ b/src/plugins/launch/runjob/launch_runjob.c @@ -443,8 +443,7 @@ extern int launch_p_handle_multi_prog_verify(int command_posm, opt_t *opt_local) extern int launch_p_create_job_step(srun_job_t *job, bool use_all_cpus, void (*signal_function)(int), - sig_atomic_t *destroy_job, opt_t *opt_local, - int pack_offset) + sig_atomic_t *destroy_job, opt_t *opt_local) { if (opt_local->launch_cmd) { int i = 0; @@ -486,8 +485,7 @@ extern int launch_p_step_launch(srun_job_t *job, slurm_step_io_fds_t *cio_fds, return SLURM_SUCCESS; } -extern int launch_p_step_wait(srun_job_t *job, bool got_alloc, opt_t *opt_local, - int pack_offset, uint32_t task_offset) +extern int launch_p_step_wait(srun_job_t *job, bool got_alloc, opt_t *opt_local) { return SLURM_SUCCESS; } diff --git a/src/plugins/launch/slurm/launch_slurm.c b/src/plugins/launch/slurm/launch_slurm.c index c88ed4d155acccad7c080c45e00635b565b63bce..7536275aa5acd79f39f49ea4a9d702df1e131ee4 100644 --- a/src/plugins/launch/slurm/launch_slurm.c +++ b/src/plugins/launch/slurm/launch_slurm.c @@ -555,8 +555,7 @@ extern int launch_p_handle_multi_prog_verify(int command_pos, opt_t *opt_local) extern int launch_p_create_job_step(srun_job_t *job, bool use_all_cpus, void (*signal_function)(int), - sig_atomic_t *destroy_job, opt_t *opt_local, - int pack_offset) + sig_atomic_t *destroy_job, opt_t *opt_local) { if (launch_common_create_job_step(job, use_all_cpus, signal_function, destroy_job, @@ -666,6 +665,7 @@ extern int launch_p_step_launch(srun_job_t *job, slurm_step_io_fds_t *cio_fds, launch_params.remote_input_filename = fname_remote_string(job->ifname); launch_params.remote_error_filename = fname_remote_string(job->efname); launch_params.pack_offset = job->pack_offset; + launch_params.task_offset = job->task_offset; launch_params.partition = job->partition; launch_params.profile = opt_local->profile; launch_params.task_prolog = opt_local->task_prolog; @@ -788,8 +788,7 @@ cleanup: return rc; } -extern int launch_p_step_wait(srun_job_t *job, bool got_alloc, opt_t *opt_local, - int pack_offset) +extern int launch_p_step_wait(srun_job_t *job, bool got_alloc, opt_t *opt_local) { int rc = 0; @@ -800,9 +799,9 @@ extern int launch_p_step_wait(srun_job_t *job, bool got_alloc, opt_t *opt_local, retry_step_begin = false; slurm_step_ctx_destroy(job->step_ctx); if (got_alloc) - rc = create_job_step(job, true, opt_local, pack_offset); + rc = create_job_step(job, true, opt_local); else - rc = create_job_step(job, false, opt_local,pack_offset); + rc = create_job_step(job, false, opt_local); if (rc < 0) exit(error_exit); rc = -1; diff --git a/src/sattach/sattach.c b/src/sattach/sattach.c index 1703c93b7900a8cd1c5134b352c05069fc4849f8..d0e12e4b59ac76022f89c0d8e4154844d1e093cf 100644 --- a/src/sattach/sattach.c +++ b/src/sattach/sattach.c @@ -174,7 +174,7 @@ int sattach(int argc, char **argv) io = client_io_handler_create(opt.fds, layout->task_cnt, layout->node_cnt, fake_cred, - opt.labelio, NO_VAL); + opt.labelio, NO_VAL, NO_VAL); client_io_handler_start(io); if (opt.pty) { diff --git a/src/slurmd/slurmstepd/io.c b/src/slurmd/slurmstepd/io.c index b38d40792acc63848f26101ffdb39967c33d9ffe..f9e0b8a8098d9ab6292848066f2b960615e171a5 100644 --- a/src/slurmd/slurmstepd/io.c +++ b/src/slurmd/slurmstepd/io.c @@ -533,8 +533,10 @@ _local_file_write(eio_obj_t *obj, List objs) io_hdr_packed_size(); } - /* This code to make a buffer, fill it, unpack its contents, and free - it is just used to read the header to get the global task id. */ + /* + * This code to make a buffer, fill it, unpack its contents, and free + * it is just used to read the header to get the global task id. + */ header_tmp_buf = create_buf(client->out_msg->data, client->out_msg->length); if (!header_tmp_buf) { @@ -545,8 +547,10 @@ _local_file_write(eio_obj_t *obj, List objs) header_tmp_buf->head = NULL; /* CLANG false positive bug here */ free_buf(header_tmp_buf); - /* A zero-length message indicates the end of a stream from one - of the tasks. Just free the message and return. */ + /* + * A zero-length message indicates the end of a stream from one + * of the tasks. Just free the message and return. + */ if (header.length == 0) { _free_outgoing_msg(client->out_msg, client->job); client->out_msg = NULL; @@ -558,7 +562,8 @@ _local_file_write(eio_obj_t *obj, List objs) (client->out_msg->length - client->out_remaining); n = write_labelled_message(obj->fd, buf, client->out_remaining, header.gtaskid, client->job->pack_offset, - client->labelio, client->taskid_width); + client->job->task_offset, client->labelio, + client->taskid_width); if (n < 0) { client->out_eof = true; _free_all_outgoing_msgs(client->msg_queue, client->job); diff --git a/src/slurmd/slurmstepd/slurmstepd_job.h b/src/slurmd/slurmstepd/slurmstepd_job.h index 62b057c99edd9438f8b35e95a0a14396c390d3d3..6438e745408689d224bbc3e175165572864cfb81 100644 --- a/src/slurmd/slurmstepd/slurmstepd_job.h +++ b/src/slurmd/slurmstepd/slurmstepd_job.h @@ -135,6 +135,8 @@ typedef struct { uint32_t nodeid; /* relative position of this node in job */ uint32_t node_tasks; /* number of tasks on *this* node */ uint32_t pack_offset; /* pack job offset or NO_VAL */ +//FIXME-PACK - To populate + uint32_t task_offset; /* pack job task offset or NO_VAL */ uint16_t *task_cnts; /* Number of tasks on each node in job */ uint32_t cpus_per_task; /* number of cpus desired per task */ uint32_t debug; /* debug level for job slurmd */ diff --git a/src/srun/libsrun/allocate.c b/src/srun/libsrun/allocate.c index d159e554bee72366311f19929a61eb0e0612bae6..2f92e8818fc27ea70132e1cef49da934f70b0fac 100644 --- a/src/srun/libsrun/allocate.c +++ b/src/srun/libsrun/allocate.c @@ -1139,10 +1139,9 @@ job_desc_msg_destroy(job_desc_msg_t *j) } } -extern int create_job_step(srun_job_t *job, bool use_all_cpus, opt_t *opt_local, - int pack_offset) +extern int create_job_step(srun_job_t *job, bool use_all_cpus, opt_t *opt_local) { return launch_g_create_job_step(job, use_all_cpus, _signal_while_allocating, - &destroy_job, opt_local, pack_offset); + &destroy_job, opt_local); } diff --git a/src/srun/libsrun/allocate.h b/src/srun/libsrun/allocate.h index e250ec80333beebe65c8e672f1e893b9207a610d..07e55cb067b258077ace4347caa944f1a3924b36 100644 --- a/src/srun/libsrun/allocate.h +++ b/src/srun/libsrun/allocate.h @@ -105,12 +105,10 @@ extern List existing_allocation(void); * After returning, 'j' is filled in with information for job step. * IN use_all_cpus - true to use every CPU allocated to the job * IN opt_local - options used to create job step - * IN pack_offset - offset within a pack job, -1 if not part of pack job * * Returns -1 if job step creation failure, 0 otherwise */ -int create_job_step(srun_job_t *j, bool use_all_cpus, opt_t *opt_local, - int pack_offset); +int create_job_step(srun_job_t *j, bool use_all_cpus, opt_t *opt_local); /* set the job for debugging purpose */ void set_allocate_job(srun_job_t *job); diff --git a/src/srun/libsrun/launch.c b/src/srun/libsrun/launch.c index c589ed39b12075bdfcb548b872854b1dd9cce440..a1e754ba5552bb1fa8839ee721ac636c1f868e18 100644 --- a/src/srun/libsrun/launch.c +++ b/src/srun/libsrun/launch.c @@ -52,15 +52,15 @@ typedef struct { int (*handle_multi_prog) (int command_pos, opt_t *opt_local); int (*create_job_step) (srun_job_t *job, bool use_all_cpus, void (*signal_function)(int), - sig_atomic_t *destroy_job, opt_t *opt_local, - int pack_offset); + sig_atomic_t *destroy_job, + opt_t *opt_local); int (*step_launch) (srun_job_t *job, slurm_step_io_fds_t *cio_fds, uint32_t *global_rc, slurm_step_launch_callbacks_t * step_callbacks, opt_t *opt_local); int (*step_wait) (srun_job_t *job, bool got_alloc, - opt_t *opt_local, int pack_offset); + opt_t *opt_local); int (*step_terminate) (void); void (*print_status) (void); void (*fwd_signal) (int signal); @@ -508,14 +508,13 @@ extern int launch_g_handle_multi_prog_verify(int command_pos, opt_t *opt_local) extern int launch_g_create_job_step(srun_job_t *job, bool use_all_cpus, void (*signal_function)(int), - sig_atomic_t *destroy_job, opt_t *opt_local, - int pack_offset) + sig_atomic_t *destroy_job, opt_t *opt_local) { if (launch_init() < 0) return SLURM_ERROR; return (*(ops.create_job_step))(job, use_all_cpus, signal_function, - destroy_job, opt_local, pack_offset); + destroy_job, opt_local); } extern int launch_g_step_launch(srun_job_t *job, slurm_step_io_fds_t *cio_fds, @@ -530,13 +529,12 @@ extern int launch_g_step_launch(srun_job_t *job, slurm_step_io_fds_t *cio_fds, opt_local); } -extern int launch_g_step_wait(srun_job_t *job, bool got_alloc, opt_t *opt_local, - int pack_offset) +extern int launch_g_step_wait(srun_job_t *job, bool got_alloc, opt_t *opt_local) { if (launch_init() < 0) return SLURM_ERROR; - return (*(ops.step_wait))(job, got_alloc, opt_local, pack_offset); + return (*(ops.step_wait))(job, got_alloc, opt_local); } extern int launch_g_step_terminate(void) diff --git a/src/srun/libsrun/launch.h b/src/srun/libsrun/launch.h index d7c9a26c087c4165502e1f89bf5d2d57bf680a09..e064200daddf14e4a8f5b3992cd6e746482215d9 100644 --- a/src/srun/libsrun/launch.h +++ b/src/srun/libsrun/launch.h @@ -124,14 +124,13 @@ extern int launch_g_handle_multi_prog_verify(int command_pos, opt_t *opt_local); * IN destroy_job - pointer to a global flag signifying if the job was * canceled while allocating. * IN opt_local - options used for step creation - * IN pack_offset - offset within a pack job, -1 if not part of pack job * * RETURN SLURM_SUCCESS on success || SLURM_ERROR else wise */ extern int launch_g_create_job_step(srun_job_t *job, bool use_all_cpus, void (*signal_function)(int), - sig_atomic_t *destroy_job, opt_t *opt_local, - int pack_offset); + sig_atomic_t *destroy_job, + opt_t *opt_local); /* * launch_g_step_launch() is called to launch the job step that @@ -155,12 +154,11 @@ extern int launch_g_step_launch(srun_job_t *job, slurm_step_io_fds_t *cio_fds, * IN/OUT job - the job waiting to finish. * IN got_alloc - if the resource allocation was created inside srun * IN opt_local - options used for step creation - * IN pack_offset - offset within a pack job, -1 if not part of pack job * * RETURN SLURM_SUCCESS on success || SLURM_ERROR else wise */ -extern int launch_g_step_wait(srun_job_t *job, bool got_alloc, opt_t *opt_local, - int pack_offset); +extern int launch_g_step_wait(srun_job_t *job, bool got_alloc, + opt_t *opt_local); /* * launch_g_step_terminate() is called to end the job step. diff --git a/src/srun/libsrun/opt.c b/src/srun/libsrun/opt.c index 996fd8380ee9e94a9672ba021007be300a28bee2..2b970f00f877edf6ebfed9bc36030358666e7bb4 100644 --- a/src/srun/libsrun/opt.c +++ b/src/srun/libsrun/opt.c @@ -584,7 +584,7 @@ extern int initialize_and_process_args(int argc, char **argv, int *argc_off) /* Massage ntasks value earlier than normal */ if (!opt.ntasks_set) opt.ntasks = _get_task_count(); - launch_g_create_job_step(NULL, 0, NULL, NULL, &opt, -1); + launch_g_create_job_step(NULL, 0, NULL, NULL, &opt); exit(0); } pending_append = true; diff --git a/src/srun/libsrun/srun_job.c b/src/srun/libsrun/srun_job.c index b8a56108103306ae7f685978833333da4cbdde18..371ebc1e12302aeda415d9297f12b989ff7a7c3f 100644 --- a/src/srun/libsrun/srun_job.c +++ b/src/srun/libsrun/srun_job.c @@ -647,7 +647,8 @@ static int _create_job_step(srun_job_t *job, bool use_all_cpus, { ListIterator opt_iter = NULL, job_iter; opt_t *opt_local = &opt; - int pack_offset = 0, rc = 0; + uint32_t pack_offset = 0, task_offset = 0; + int rc = 0; if (srun_job_list) { if (opt_list) @@ -658,18 +659,20 @@ static int _create_job_step(srun_job_t *job, bool use_all_cpus, opt_local = (opt_t *) list_next(opt_iter); if (!opt_local) fatal("%s: opt_list too short", __func__); - rc = create_job_step(job, use_all_cpus, opt_local, - pack_offset); + job->pack_offset = pack_offset; + job->task_offset = task_offset; + rc = create_job_step(job, use_all_cpus, opt_local); if (rc < 0) break; pack_offset++; + task_offset += job->ntasks; } list_iterator_destroy(job_iter); if (opt_iter) list_iterator_destroy(opt_iter); return rc; } else if (job) { - return create_job_step(job, use_all_cpus, &opt, -1); + return create_job_step(job, use_all_cpus, &opt); } else { return -1; } @@ -682,7 +685,7 @@ extern void create_srun_job(void **p_job, bool *got_alloc, List job_resp_list = NULL, srun_job_list = NULL; ListIterator opt_iter, resp_iter; srun_job_t *job = NULL; - int max_pack_offset, pack_offset = -1; + int i, max_pack_offset, pack_offset = -1; opt_t *opt_local; uint32_t my_job_id = 0; bool begin_error_logged = false; @@ -714,7 +717,7 @@ extern void create_srun_job(void **p_job, bool *got_alloc, error("Job creation failure."); exit(error_exit); } - if (create_job_step(job, false, &opt, -1) < 0) + if (create_job_step(job, false, &opt) < 0) exit(error_exit); } else if ((job_resp_list = existing_allocation())) { srun_job_list = list_create(NULL); @@ -812,11 +815,14 @@ extern void create_srun_job(void **p_job, bool *got_alloc, } /* More pack job components */ list_iterator_destroy(resp_iter); - if (list_count(srun_job_list) == 0) { + i = list_count(srun_job_list); + if (i == 0) { error("No directives to start application on any available " "pack job components"); exit(error_exit); } + if (i == 1) + FREE_NULL_LIST(srun_job_list); /* Just use "job" */ max_pack_offset = get_max_pack_group(); pack_offset = list_count(job_resp_list) - 1; if (max_pack_offset > pack_offset) { @@ -1094,6 +1100,8 @@ static srun_job_t *_job_create_structure(allocation_info_t *ainfo, job->nodelist = xstrdup(ainfo->nodelist); job->partition = xstrdup(ainfo->partition); job->stepid = ainfo->stepid; + job->pack_offset = NO_VAL; + job->task_offset = NO_VAL; #if defined HAVE_BG //#if defined HAVE_BGQ && defined HAVE_BG_FILES diff --git a/src/srun/libsrun/srun_job.h b/src/srun/libsrun/srun_job.h index 93c648dd057174317bd5e020d32e55ef0f38f3dc..7c0c54148a085ed84e6e8e4ea8b992a72255e850 100644 --- a/src/srun/libsrun/srun_job.h +++ b/src/srun/libsrun/srun_job.h @@ -81,7 +81,9 @@ typedef struct srun_job { int fir_nodeid; uint32_t jobid; /* assigned job id */ uint32_t stepid; /* assigned step id */ - uint32_t pack_offset; /* pack job offset */ + uint32_t pack_offset; /* pack job offset or NO_VAL */ +//FIXME-PACK - Where is this set?? + uint32_t task_offset; /* pack job tsk offset or NO_VAL */ uint32_t cpu_count; /* allocated CPUs */ uint32_t nhosts; /* node count */ diff --git a/src/srun/srun.c b/src/srun/srun.c index f26f173d5ca2fc9f8243ff3335af857b63f9d58d..9e0bdee969e99ef73460cb2e3a6913ee5eec9d81 100644 --- a/src/srun/srun.c +++ b/src/srun/srun.c @@ -202,8 +202,10 @@ static void *_launch_one_app(void *data) slurm_step_io_fds_t cio_fds = SLURM_STEP_IO_FDS_INITIALIZER; slurm_step_launch_callbacks_t step_callbacks; +//FIXME-PACK - Perhaps we set pack_offset at some earlier point? +//FIXME-PACK - Add support for overlapping rank IDs if (opt_local->pack_grp_bits) - job->pack_offset = bit_ffs(opt_local->pack_grp_bits); + job->pack_offset = bit_ffs(opt_local->pack_grp_bits); // SET HERE else job->pack_offset = NO_VAL; @@ -234,7 +236,7 @@ relaunch: if (!launch_g_step_launch(job, &cio_fds, &global_rc, &step_callbacks, opt_local)) { - if (launch_g_step_wait(job, got_alloc, opt_local, -1) == -1) + if (launch_g_step_wait(job, got_alloc, opt_local) == -1) goto relaunch; }