I (administrator) would like to add environment variables effective in user's job script. The system has two CPU types (Intel, AMD), and the following environment variables are only required for AMD compute nodes. export MKL_DEBUG_CPU_TYPE=5 export MKL_ENABLE_INSTRUCTIONS=AVX2 I tried setting the following shell script to Prolog, SrunProlog and TaskProlog, then none of them added the variables. Could you tell me what to do? ################################### #!/bin/sh amd=`grep vendor_id /proc/cpuinfo | uniq | grep AMD | wc -l`; if [ $amd -eq 1 ]; then export MKL_DEBUG_CPU_TYPE=5 export MKL_ENABLE_INSTRUCTIONS=AVX2 fi ###################################
You can set the variable from TaskProlog, but you need to use syntax like: >echo 'export MKL_ENABLE_INSTRUCTIONS=AVX2' Technically user job is forked separately from prolog, script environment is not "inherited" by the job. However, the standard output of the script is interpreted by Slurm, and if it contains "export ..." line than the variable is set during execv call to job script.[1] Let me know if you have further questions on that. cheers, Marcin [1]https://slurm.schedmd.com/prolog_epilog.html
Hi, Thank you! Now I can get expected results as follows. Please close this bug. $ sbatch -p amd --wrap "hostname; env | grep MKL" Submitted batch job 5169 $ cat slurm-5169.out amd-node1 MKL_DEBUG_CPU_TYPE=5 MKL_ENABLE_INSTRUCTIONS=AVX2 $ sbatch -p intel --wrap "hostname; env | grep MKL" Submitted batch job 5170 $ cat slurm-5170.out intel-node1
(In reply to Marcin Stolarek from comment #1) > You can set the variable from TaskProlog, but you need to use syntax like: > >echo 'export MKL_ENABLE_INSTRUCTIONS=AVX2' > > Technically user job is forked separately from prolog, script environment is > not "inherited" by the job. However, the standard output of the script is > interpreted by Slurm, and if it contains "export ..." line than the variable > is set during execv call to job script.[1] > > Let me know if you have further questions on that. > > cheers, > Marcin > [1]https://slurm.schedmd.com/prolog_epilog.html Hi Marcin, I've more or less the same issue, but in my case I needed to unset a user environment variable only for a specific partition. This way is working (using TaskProlog) if [[ ${SLURM_JOB_PARTITION} == xfer ]]; then echo 'unset LD_PRELOAD' fi I wonder if this would be feasible on the Prolog, or in another place, so in case there are jobs with many tasks, this is started just once (we have user that hav lots of task and I'm worried about scasle/performance issues) Thank you Marco Induni
Marco, Since it's a different topic - not "how to add", but rather is it worth or possible to do that differently. Could you please open a separate ticket to get appropriate attention our side? I'm closing back this one. cheers, Marcin