Slurm interactive mode - run pre-specified command at beginning

823 views Asked by At

On my cluster, I can get a shell for interactive mode if I run:

srun -N 1 --ntasks-per-node=1 --gres=gpu:1 --pty zsh

However, on this cluster, each node that is allocated has an empty $HOME directory (without the .zshrc), which is stored on a shared drive. How can I run in interactive mode with a pre-specified command to load my .zshrc automatically on login? i.e., I would ideally want something like this

srun -N 1 --ntasks-per-node=1 --gres=gpu:1 --pty zsh --runCommandOnLaunch='source /shared_drive/razvan/.zshrc'

1

There are 1 answers

0
damienfrancois On

Try with

$ZDOTDIR=/shared_drive/razvan/ srun -N 1 --ntasks-per-node=1 --gres=gpu:1 --pty zsh

Upon startup, Zsh will look for a startup file (zshrc) in $ZDOTDIR. (See more details here). As srun will, by default, export all environment variables to the remote commands it spawns, Zsh should load your RC file upon startup.