Skip to content
Snippets Groups Projects
Commit 877f3759 authored by Mark Grondona's avatar Mark Grondona
Browse files

o set more env vars in allocate mode so that srun with no args does the "right thing"

parent a89b57d6
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 The Regents of the University of California. * Copyright (C) 2002 The Regents of the University of California.
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
* Written by Mark Grondona <grondona@llnl.gov>, Moe Jette <jette1@llnl.gov>, et. al. * Written by Mark Grondona <grondona@llnl.gov>,
* Moe Jette <jette1@llnl.gov>, et. al.
* UCRL-CODE-2002-040. * UCRL-CODE-2002-040.
* *
* This file is part of SLURM, a resource management program. * This file is part of SLURM, a resource management program.
...@@ -257,6 +258,7 @@ main(int ac, char **av) ...@@ -257,6 +258,7 @@ main(int ac, char **av)
(job->out[i] == IO_DONE)) (job->out[i] == IO_DONE))
n++; n++;
} }
verbose("end of job n = %d", n);
if (n < opt.nprocs) if (n < opt.nprocs)
pthread_join(job->ioid, NULL); pthread_join(job->ioid, NULL);
else else
...@@ -798,16 +800,31 @@ existing_allocation( void ) ...@@ -798,16 +800,31 @@ existing_allocation( void )
/* allocation option specified, spawn a script and wait for it to exit */ /* allocation option specified, spawn a script and wait for it to exit */
void run_job_script (uint32_t job_id) void run_job_script (uint32_t job_id)
{ {
char jobid_str[16], *shell = NULL; char *shell = NULL;
int i; int i;
pid_t child; pid_t child;
sprintf(jobid_str, "%u", job_id); if (setenvf("SLURM_JOBID=%u", job_id)) {
if (setenv("SLURM_JOBID", jobid_str, 1)) {
error("Unable to set SLURM_JOBID environment variable"); error("Unable to set SLURM_JOBID environment variable");
return; return;
} }
if (setenvf("SLURM_NNODES=%u", opt.nodes)) {
error("Unable to set SLURM_NNODES environment variable");
return;
}
if (setenvf("SLURM_NPROCS=%u", opt.nprocs)) {
error("Unable to set SLURM_NPROCS environment variable");
return;
}
if (setenvf("SLURM_DISTRIBUTION=%s",
opt.distribution == SRUN_DIST_BLOCK ? "block" : "cyclic")) {
error("Unable to set SLURM_DISTRIBUTION environment variable");
return;
}
/* determine shell from script (if any) or user default */ /* determine shell from script (if any) or user default */
if (remote_argc) { if (remote_argc) {
char ** new_argv; char ** new_argv;
......
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