From 1a4f8c720072687ccf4a10e23149aa3189bf8dba Mon Sep 17 00:00:00 2001 From: "David J. Bremer" <dbremer@llnl.gov> Date: Tue, 3 Mar 2009 01:34:05 +0000 Subject: [PATCH] Added the labelio flag, to support labelling i/o with a task number, when a separate file is written per node or per task. --- src/api/step_launch.c | 1 + src/common/slurm_protocol_defs.h | 1 + src/common/slurm_protocol_pack.c | 2 ++ src/slurmd/slurmstepd/slurmstepd_job.c | 1 + src/slurmd/slurmstepd/slurmstepd_job.h | 1 + 5 files changed, 6 insertions(+) diff --git a/src/api/step_launch.c b/src/api/step_launch.c index 1a0045a0638..82681a40129 100644 --- a/src/api/step_launch.c +++ b/src/api/step_launch.c @@ -248,6 +248,7 @@ int slurm_step_launch (slurm_step_ctx_t *ctx, launch.efname = params->remote_error_filename; launch.ifname = params->remote_input_filename; launch.buffered_stdio = params->buffered_stdio ? 1 : 0; + launch.labelio = params->labelio ? 1 : 0; ctx->launch_state->io.normal = client_io_handler_create(params->local_fds, ctx->step_req->num_tasks, diff --git a/src/common/slurm_protocol_defs.h b/src/common/slurm_protocol_defs.h index 894c7b14263..1fabd0bdea3 100644 --- a/src/common/slurm_protocol_defs.h +++ b/src/common/slurm_protocol_defs.h @@ -529,6 +529,7 @@ typedef struct launch_tasks_request_msg { char *efname; /* stderr filename pattern */ char *ifname; /* stdin filename pattern */ uint8_t buffered_stdio; /* 1 for line-buffered, 0 for unbuffered */ + uint8_t labelio; /* prefix output lines with the task number */ uint16_t num_io_port; uint16_t *io_port; /* array of available client IO listen ports */ /********** END "normal" IO only options **********/ diff --git a/src/common/slurm_protocol_pack.c b/src/common/slurm_protocol_pack.c index f94998f4490..1d73ef495d0 100644 --- a/src/common/slurm_protocol_pack.c +++ b/src/common/slurm_protocol_pack.c @@ -3470,6 +3470,7 @@ _pack_launch_tasks_request_msg(launch_tasks_request_msg_t * msg, Buf buffer) packstr(msg->efname, buffer); packstr(msg->ifname, buffer); pack8(msg->buffered_stdio, buffer); + pack8(msg->labelio, buffer); pack16(msg->num_io_port, buffer); for(i = 0; i < msg->num_io_port; i++) pack16(msg->io_port[i], buffer); @@ -3550,6 +3551,7 @@ _unpack_launch_tasks_request_msg(launch_tasks_request_msg_t ** safe_unpackstr_xmalloc(&msg->efname, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&msg->ifname, &uint32_tmp, buffer); safe_unpack8(&msg->buffered_stdio, buffer); + safe_unpack8(&msg->labelio, buffer); safe_unpack16(&msg->num_io_port, buffer); if (msg->num_io_port > 0) { msg->io_port = diff --git a/src/slurmd/slurmstepd/slurmstepd_job.c b/src/slurmd/slurmstepd/slurmstepd_job.c index 14b1f55f397..9b1eb5c2334 100644 --- a/src/slurmd/slurmstepd/slurmstepd_job.c +++ b/src/slurmd/slurmstepd/slurmstepd_job.c @@ -255,6 +255,7 @@ job_create(launch_tasks_request_msg_t *msg) srun = srun_info_create(msg->cred, &resp_addr, &io_addr); job->buffered_stdio = msg->buffered_stdio; + job->labelio = msg->labelio; job->task_prolog = xstrdup(msg->task_prolog); job->task_epilog = xstrdup(msg->task_epilog); diff --git a/src/slurmd/slurmstepd/slurmstepd_job.h b/src/slurmd/slurmstepd/slurmstepd_job.h index e4ca0e8aeaa..a9c37120d30 100644 --- a/src/slurmd/slurmstepd/slurmstepd_job.h +++ b/src/slurmd/slurmstepd/slurmstepd_job.h @@ -176,6 +176,7 @@ typedef struct slurmd_job { uint8_t buffered_stdio; /* stdio buffering flag, 1 for line-buffering, * 0 for no buffering */ + uint8_t labelio; /* 1 for labelling output with the task id */ pthread_t ioid; /* pthread id of IO thread */ pthread_t msgid; /* pthread id of message thread */ -- GitLab