Skip to content

Commit e9f2a2d

Browse files
Better sbatch script
1 parent 33fff7b commit e9f2a2d

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

docs/clusters/cscs.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Please ask [Michael](mailto:michael.zhang@epfl.ch) or [Peter](mailto:peter.ahumu
1212

1313
## Connect to the login node
1414

15-
To connect to the login node, you will need to refresh your key every 24 hours. To refresh your keys, you need to execute the following script. Make sure to replace `$CSCS_USERNAME` with your CSCS username and the `$CSCS_PASSWORD` with your CSCS password.
15+
To connect to the login node, you will need to refresh your key every 24 hours. To refresh your keys, you need to execute the following script. Store the following script in a `.sh` file (e.g. `cscs_connect.sh`). Make sure to replace `$CSCS_USERNAME` with your CSCS username and the `$CSCS_PASSWORD` with your CSCS password.
1616

1717
```bash
1818
#!/bin/bash
@@ -184,7 +184,7 @@ eval `ssh-agent -s`
184184
ssh-add -t 1d ~/.ssh/cscs-key
185185
```
186186

187-
We strongly suggest to store this script in a file as you will have to execute it every day. If you don't want to have your login ID stored in a script, you can comment out the lines:
187+
You will have to execute this bash script every day. If you don't want to have your login ID stored in a script, you can comment out the lines:
188188

189189
```bash
190190
#read -p "Username : " USERNAME
@@ -419,6 +419,7 @@ To launch a non-interactive job, you need to create a sbatch script. Create a fi
419419
export WANDB_DIR=/capstor/store/cscs/swissai/a127/homes/$CSCS_USERNAME/wandb
420420
export WANDB_MODE="offline"
421421
export HF_TOKEN=$HF_TOKEN
422+
export SETUP="cd /users/$CSCS_USERNAME/meditron/multimodal/MultiMeditron && pip install -e ."
422423

423424
export CUDA_LAUNCH_BLOCKING=1
424425
echo "START TIME: $(date)"
@@ -471,7 +472,7 @@ SRUN_ARGS=" \
471472
--reservation=sai-a127
472473
"
473474
# bash -c is needed for the delayed interpolation of env vars to work
474-
srun $SRUN_ARGS bash -c "$CMD"
475+
srun $SRUN_ARGS bash -c "$SETUP && $CMD"
475476
echo "END TIME: $(date)"
476477
```
477478

0 commit comments

Comments
 (0)