Hi,
I have a prolog script that is being run via the slurm.conf
Prolog= setting. I've verified that it's being executed on the
compute node. My problem is that I cannot get environment
variables that I set in this prolog to be set/seen in the job.
For example the prolog:
#!/bin/bash
...
export CUDA_MPS_PIPE_DIRECTORY=blah
...
is not part of the job's env vars. Someone had suggested that a "print" statement needs to be used. So I tried:
print export CUDA_MPS_PIPE_DIRECTORY=blah
but this doesn't work either. Is this is really just for print-ing as its name implies? Or is that how one actually has to do it and somehow the syntax I'm using isn't quite right?
The documentation says:
The task prolog is executed with the same environment as the user tasks to be initiated. The standard output of that program is read and processed as follows:
export name=value
sets an environment variable for the user task
unset name
clears an environment variable from the user task
print ...
writes to the task's standard output.
The above functionality is limited to the task prolog
script.
Basically, I'd like to know how to get an arbitrary environment
variable passed on to the job via the prolog.
We are using slurm 20.02.5 on CentOS 7.
Thanks,
Herc
Drexel Internal Data
It seems to me, if you are using srun directly to get an interactive shell, you can just run the script once you get your shell.
You can set the variables and then run srun. It automatically exports the environment.
If you want to change a particular one (or more), use something like --export=ALL,MYVAR=othervalue
do 'man srun' and look at the --export option
Brian Andrus
#!/bin/bashif [[ -z ${SLURM_ARRAY_JOB_ID+x} ]]thenexport TMP="/local/scratch/${SLURM_JOB_ID}"export TMPDIR="${TMP}"export LOCAL_TMPDIR="${TMP}"export BEEGFS_TMPDIR="/beegfs/scratch/${SLURM_JOB_ID}"elseexport TMP="/local/scratch/${SLURM_ARRAY_JOB_ID}.${SLURM_ARRAY_TASK_ID}"export TMPDIR="${TMP}"export LOCAL_TMPDIR="${TMP}"export BEEGFS_TMPDIR="/beegfs/scratch/${SLURM_ARRAY_JOB_ID}.${SLURM_ARRAY_TASK_ID}"fi
echo DEBUG srun_set_tmp.shecho I am `whoami`
/usr/bin/mkdir -p ${TMP}chmod 700 ${TMP}/usr/bin/mkdir -p ${BEEGFS_TMPDIR}chmod 700 ${BEEGFS_TMPDIR}
picotte001::~$ whoamidwc62
picotte001::~$ srun -p def --mem 1000 -n 4 -t 600 --pty /bin/bashDEBUG srun_set_tmp.shI am dwc62node001::~$ echo $TMP/local/scratch/80472node001::~$ ll !$ll $TMP/bin/ls: cannot access '/local/scratch/80472': No such file or directorynode001::~$ mkdir $TMPnode001::~$ ll -d !$ll -d $TMPdrwxrwxr-x 2 dwc62 dwc62 6 Mar 4 11:52 /local/scratch/80472/node001::~$ exit
Drexel Internal Data
I think it isn't running how you think or there is something not provided in the description.
You have:
export TMP="/local/scratch/${SLURM_ARRAY_JOB_ID}.${SLURM_ARRAY_TASK_ID}"
node001::~$ echo $TMP/local/scratch/80472
Drexel Internal Data
SrunProlog runs on the node where the "srun" is executing.
Drexel Internal Data