Discussion:
Pass environmental variables to srun
Michael Robbert
2014-07-29 21:33:42 UTC
Permalink
Is it possible to pass environmental variables to srun so that they'll be included in the environment of the executable, but not that of srun?

What we're trying to do is profile uninstrumented applications with Tau on BG/Q. From what I gather this is normally done with tau_exec, but that is a bash shell script that won't run on the BG/Q compute node. There appears to be a -qsub option for that command that gathers up the needed environmental variables and passes them to the qsub command line using the --env option. So, I'm looking for a similar option in srun and can't find one. If there are other suggestions for how to do this that would be great as well. I've been told that we've tried setting the needed environmental variables in the script before srun, but then srun fails to run so it looks like these need to be set only for the application that we want to profile.

Thanks,
Mike Robbert
Colorado School of Mines
Lipari, Don
2014-07-30 00:04:37 UTC
Permalink
Mike,

runjob is the task launcher on BG/Q. Take a look at the --envs option documented in the runjob man page.

Then look at srun's man page for the --launcher-opts option.

I believe the answer may involve the use of the two. It will be something like:

srun [...] --launcher-opts=='--envs MY_ENV=myenv' a.out

Don
-----Original Message-----
Sent: Tuesday, July 29, 2014 2:34 PM
To: slurm-dev
Subject: [slurm-dev] Pass environmental variables to srun
Is it possible to pass environmental variables to srun so that they'll be
included in the environment of the executable, but not that of srun?
What we're trying to do is profile uninstrumented applications with Tau on
BG/Q. From what I gather this is normally done with tau_exec, but that is a
bash shell script that won't run on the BG/Q compute node. There appears to
be a -qsub option for that command that gathers up the needed environmental
variables and passes them to the qsub command line using the --env option.
So, I'm looking for a similar option in srun and can't find one. If there
are other suggestions for how to do this that would be great as well. I've
been told that we've tried setting the needed environmental variables in the
script before srun, but then srun fails to run so it looks like these need
to be set only for the application that we want to profile.
Thanks,
Mike Robbert
Michael Robbert
2014-07-31 16:28:38 UTC
Permalink
Don,
Thanks! I think that is what we needed. I've passed this on to the person doing the work and it appears to be working passing the variables, but we're still working to get Tau to generate the profile files that we're expecting.

Moe,
The variable that needs to be set is LD_PRELOAD. We don't want to profile srun which is why this needs to be set specifically and only for the application to be run.

Thanks for the quick responses,
Mike Robbert
Post by Lipari, Don
Mike,
runjob is the task launcher on BG/Q. Take a look at the --envs option documented in the runjob man page.
Then look at srun's man page for the --launcher-opts option.
srun [...] --launcher-opts=='--envs MY_ENV=myenv' a.out
Don
-----Original Message-----
Sent: Tuesday, July 29, 2014 2:34 PM
To: slurm-dev
Subject: [slurm-dev] Pass environmental variables to srun
Is it possible to pass environmental variables to srun so that they'll be
included in the environment of the executable, but not that of srun?
What we're trying to do is profile uninstrumented applications with Tau on
BG/Q. From what I gather this is normally done with tau_exec, but that is a
bash shell script that won't run on the BG/Q compute node. There appears to
be a -qsub option for that command that gathers up the needed environmental
variables and passes them to the qsub command line using the --env option.
So, I'm looking for a similar option in srun and can't find one. If there
are other suggestions for how to do this that would be great as well. I've
been told that we've tried setting the needed environmental variables in the
script before srun, but then srun fails to run so it looks like these need
to be set only for the application that we want to profile.
Thanks,
Mike Robbert
Colorado School of Mines
Loading...