Script for interacting with the MLCloud cluster. https://portal.mlcloud.uni-tuebingen.de/user-guide/
Under the $HOME directory (e.g., /home/<group>/<your-id>/), copy the private key you have authorized into the .ssh folder (i.e., $HOME/.ssh).
This step is necessary to manually log in to the computational node from the login node.
For Galvani, set $WORK:
export WORK="/mnt/lustre/work/<group>/<user>"It is also helpful to keep local installations and config files in that directory:
export XDG_CONFIG_HOME=$WORK/.config/
export XDG_CACHE_HOME=$WORK/.cache/
export XDG_DATA_HOME=$WORK/.local/share/
export XDG_STATE_HOME=$WORK/.local/state/Then add local executables to $PATH:
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATHYou may also need to add CUDA binaries to $PATH:
PATH=$PATH:/usr/local/cuda/binIt is also important to set the directory for your logs:
export LOGDIR="/path/to/logs"Useful aliases:
alias v='nvim'
alias q='squeue --me'
alias p='sinfo -S+P -o "%18P %8a %20F"'
alias g='scontrol show node | grep "CfgTRES.*gres"'curl -LsSf https://astral.sh/uv/install.sh | sh
echo 'eval "$(uv generate-shell-completion bash)"' >> ~/.bashrcwget https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gzFor a Neovim release built with an older glibc, go here.
Move the mlcloud script into a standard executable location, for example ~/.local/bin/.
Then source it from your .bashrc or .zshrc:
source ~/.local/bin/mlcloudTo run jobs on the cluster, you need a config file that defines the requested resources and a command file that defines the commands to execute.
You can find the templates in ./config/config-template and ./cmd/cmd-template, respectively.
All functions expect -u <user>. The cluster selector is -g for Galvani or -f for Ferranti. The optional -l 1|2 flag selects the login node and defaults to 1.
mlcloud-ln: open an SSH session on a login node or run a command there.
mlcloud-ln -g -u <user>
mlcloud-ln -f -u <user> -l 2 squeue --memlcloud-job: submit a batch job using a settings file and either a command file or an inline command.
mlcloud-job -g -u <user> -o <path/to/config> -c <path/to/jupyter/cmd>
mlcloud-job -f -u <user> -l 2 -o <path/to/config> python train.pymlcloud-cn: attach to the compute node of a queued or running job. With-i, start an interactive job first.
mlcloud-cn -g -u <user>
mlcloud-cn -f -u <user> -l 2 -imlcloud-jupyter: print the Jupyter URL from the job log and open the SSH tunnel to the compute node.
mlcloud-jupyter -g -u <user>
mlcloud-jupyter -f -u <user> -l 2 my-job-namemlcloud-sync: copy files withrsync. Useg:orf:prefixes for remote paths.
mlcloud-sync -u <user> <client/path> g:<server/path> # client -> server
mlcloud-sync -u <user> -l 2 f:<server/path> <client/path> # server -> clientTo run Jupyter, create a command script like this:
<do stuff before running jupyter>
jupyter-lab --no-browser --port 8080
<do stuff after closing jupyter>Then run it as a job, for example:
mlcloud-job -g -u <user> -o <path/to/config> -c <path/to/jupyter/cmd>A job will be submitted. Now run:
mlcloud-jupyter -g -u <user> job-nameIf there is only one running job, job-name can be omitted.
This prints the Jupyter URL from the job log and opens the SSH tunnel to the compute node.