In our taskprolog file we have something like

#!/bin/sh
echo export SCRATCHDIR=/scratch/${SLURM_JOBID}


________________________________
From: slurm-users <slurm-users-boun...@lists.schedmd.com> on behalf of Herc 
Silverstein <herc.silverst...@schrodinger.com>
Sent: Friday, February 12, 2021 3:12 PM
To: slurm-us...@schedmd.com <slurm-us...@schedmd.com>
Subject: [slurm-users] prolog not passing env var to job


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

Reply via email to