# Student guide

| What | Where |
| --- | --- |
| Papers | <https://overleaf.smtornado.com> |
| Files and office documents | <https://nextcloud.smtornado.com> |
| Password and account | <https://auth.smtornado.com> |
| Experiments | <https://mlflow.smtornado.com> |
| Bot (notifications, keys, jobs) | `@smtornado_bot` in Telegram |
| Shell, jobs, notebooks | `ssh lab-nas` (set up below) |

## Your account

1. Open the invitation link from your email (sent once, in English and Russian). If it did not arrive, ask the administrator to resend it.
2. Enter your first and last name; your username is created for you. Verify your email and choose a password.
3. Link Telegram when asked. This is required: job and account notices come through the bot.
4. You get only the apps you asked for. SSH, VPN and compute wait for the administrator's approval.

One password works for every web app. Change it at <https://auth.smtornado.com>. SSH uses a key instead (below).

In Nextcloud, **Files → New → Document, Spreadsheet or Presentation** opens the built-in office editor.

If you used the old Overleaf, tell the administrator before your first sign-in and keep the same email. Your projects will be linked to the new account. Do not create a second Overleaf account.

The invitation deadline only limits when you can accept it. Your account has its own end date, which the administrator can extend.

## VPN (optional)

If VPN is approved, add your private subscription to Happ and refresh it to see three profiles:

| Profile | Route |
| --- | --- |
| **🇷🇺→🇳🇱 RU-NL-hop** | Russian sites via Timeweb, everything else via the Netherlands. |
| **🇳🇱 NL-direct** | Enter in the Netherlands; Russian sites return via Timeweb. |
| **🇷🇺 RU-direct** | Everything exits in Russia (useful abroad). |

All profiles share one monthly allowance (upload plus download; 3 GiB by default). Keep the subscription link private. VPN does not give SSH or compute access, and you do not need it for SSH.

## SSH to the NAS

Your account page must show SSH as **granted**.

1. Create a key on your own computer (this never overwrites an existing file):

   ```sh
   test -e ~/.ssh/lab_ed25519 || ssh-keygen -t ed25519 -f ~/.ssh/lab_ed25519
   ```

2. Give only the public file, `~/.ssh/lab_ed25519.pub`, through registration or as the administrator tells you. Never send the private key. `ssh-copy-id` is not used.
3. Add to `~/.ssh/config` on your computer, with your lab username:

   ```
   Host lab-nas 45.93.201.108
       HostName 45.93.201.108
       Port 2223
       User YOUR_APPROVED_USERNAME
       IdentityFile ~/.ssh/lab_ed25519
       IdentitiesOnly yes
       ServerAliveInterval 30
   ```

4. Run `ssh lab-nas`. The first time, the key fingerprint must be exactly:

   ```
   ED25519 key fingerprint is SHA256:C5euGH2t7cX9gEDW7MtFsBhV46Axr1Ahj5ls65vp61s
   ```

   Answer `yes` only if it matches. If it differs, or SSH later says the key changed, stop and tell the administrator.

Port 2223 accepts keys only. You never need Tailscale or a VPN for SSH, jobs or notebooks.

The NAS shell is for editing, `git`, small file work and submitting jobs. Each person gets one CPU core and 1 GiB of memory there. Run anything heavier, and anything on a GPU, as a Slurm job.

### VS Code

VS Code uses its own entry on port **2224**. Add it next to `lab-nas`, with the same username and key:

```sshconfig
Host lab-nas-vscode
    HostName 45.93.201.108
    Port 2224
    User YOUR_APPROVED_USERNAME
    IdentityFile ~/.ssh/lab_ed25519
    IdentitiesOnly yes
```

It shows the same fingerprint, **ED25519 SHA256:C5euGH2t7cX9gEDW7MtFsBhV46Axr1Ahj5ls65vp61s**.

1. On your computer, run `ssh lab-nas lab-account --vscode`. It prints settings with **your own** editor port.
2. In VS Code, open **Preferences: Open User Settings (JSON)** and merge those settings in. Never copy someone else's port.
3. Run **Remote-SSH: Kill VS Code Server on Host…** for `lab-nas-vscode` (and `lab-nas`, if you used it for VS Code before).
4. Run **Remote-SSH: Connect to Host… → lab-nas-vscode**.

Keep `lab-nas` (port 2223) for jobs, node2 and notebook tunnels. If the editor reports that its port is in use, tell the administrator.

## Running jobs

All computing goes through Slurm from the NAS. `debug` runs on node2 (RTX 3060) with QOS `student-node2`, up to 4 hours.

```sh
sinfo                      # machines
squeue -u "$USER"          # your jobs
# quick test, CPU only
srun --partition=debug --qos=student-node2 --time=00:10:00 --cpus-per-task=1 --mem=1G hostname
# quick test, one GPU
srun --partition=debug --qos=student-node2 --time=00:10:00 --cpus-per-task=2 --mem=4G --gres=gpu:1 nvidia-smi
```

For real work, write `job.sh` and run `sbatch job.sh`:

```sh
#!/bin/bash
#SBATCH --partition=debug
#SBATCH --qos=student-node2
#SBATCH --time=00:30:00
#SBATCH --cpus-per-task=2
#SBATCH --mem=4G
#SBATCH --gres=gpu:1
#SBATCH --output=slurm-%j.out
set -euo pipefail
export PYTHONNOUSERSITE=1
/opt/lab/envs/teaching-2026d/bin/python train.py
```

Drop `--gres` for CPU-only work (or use the `ingest` partition). Waiting in the queue is normal. Cancel with `scancel JOB_ID`.

If Slurm says **Invalid account or account/partition combination**, run `sacctmgr -nP show assoc user="$USER" cluster=lab format=Account,QOS,DefaultQOS`. An empty result means compute access is not set up yet: ask the administrator, and do not try other accounts or QOS names.

The rig (RTX 3090, `batch` partition) is waiting for an OS reinstall. Use it only after the administrator announces it.

**Limits per person:** 4 `debug`, 8 `long` and 20 `scavenger` jobs queued or running (every array task counts). At the end of your last job on a node, files left in the top level of `/tmp`, `/dev/shm` and `/var/tmp` are deleted; use `$TMPDIR`, `$SCRATCH` or `/local/$USER`.

### Watching GPU use

With a job running, open a second terminal:

```sh
ssh -t lab-nas
srun --jobid JOB_ID --overlap --ntasks=1 --cpus-per-task=1 --pty nvtop
```

This runs `nvtop` inside your existing job; it does not start a new one. Look at the RTX 3060 (not the Intel GPU). Press `q` to quit; training continues. Follow the log with `tail -f slurm-JOB_ID.out`.

### Long and preemptible jobs

Longer GPU work goes to the `long` partition with the preemptible QOS `scavenger-node2` (up to 7 days; you have it automatically):

```sh
sbatch -p long --qos=scavenger-node2 --gres=gpu:1 --time=2-00:00:00 --requeue --signal=B:USR1@600 job.sbatch
```

When someone starts a notebook or `debug` job, your job gets `USR1` and has 10 minutes to save to `$LAB_CHECKPOINTS` and exit. It is then requeued and resumes when the GPU is free. A job that ignores the signal is killed and starts over. After each start it runs at least 5 minutes before it can be preempted again.

The easiest way is **`lab-train`**, which writes the job for you:

```sh
lab-train submit -- /opt/lab/envs/teaching-2026d/bin/python train.py --your-args
lab-train status [JOBID]     # your jobs, or every segment of one job
lab-train stop JOBID         # save and end safely
lab-train template           # copy the tested example
```

Your script finds its checkpoint folder in `$LAB_RUN_DIR`; on `SIGUSR1` it should save and exit. Options: `--debug` (up to 4 h, never preempted), `--machine rig`, `--time`, `--gpus`, `--mem`, `--name`, and `--print` to show the job without submitting.

Or start from the template by hand:

```sh
mkdir -p ~/projects/mytrain && cp /opt/lab/templates/preemptible/* ~/projects/mytrain/ && cd ~/projects/mytrain
sbatch --job-name=mytrain train-preemptible.sbatch
```

- **Watch:** `squeue -u $USER` (`PD` waiting, `R` running); `sacct -j JOBID --duplicates -o JobID,State,Start,End` lists every segment; `progress.jsonl` in the checkpoint folder records progress.
- **Stop:** `lab-train stop JOBID`. A plain `scancel JOBID` kills the job without saving.
- **Resume:** submit the same command with the same `--job-name`.
- **More than 7 days:** use `--time=7-00:00:00`; the job saves and requeues itself before the limit.
- **Checkpoints** are on node2's HDD and are not backed up. Keep only the last few and delete finished runs.

Non-preemptible long jobs (`long-node2`, extendable with `lab-job-extend JOB_ID D-HH:MM:SS`) are available on request.

## Notebooks

On the NAS:

```sh
lab-jupyter --partition debug --time 00:10:00 --mem 2G
lab-jupyter-info JOB_ID          # once the job is RUNNING
```

Add the node2 hop to `~/.ssh/config` on your computer:

```
Host lab-node2 100.97.86.62
    HostName 100.97.86.62
    User YOUR_APPROVED_USERNAME
    IdentityFile ~/.ssh/lab_ed25519
    IdentitiesOnly yes
    ProxyJump lab-nas
```

The node2 fingerprint is `SHA256:N+/vr124iHWu/Oq1QCOmypRxkSFeXQ5VjGQtTz7klU4`; check it on first use.

Run the tunnel command that `lab-jupyter-info` prints, on your own computer, then open the printed localhost link. With the entry above, `ssh -N -L PORT:127.0.0.1:PORT lab-node2` does the same, using the printed port. Keep the token private. `100.97.86.62` is internal: it only works through `lab-nas`, never directly.

New notebooks use **Lab teaching-2026d** (Python 3.12). Older notebooks can switch with **Kernel → Change Kernel**; **Lab teaching-2026b** stays available, also as `lab-jupyter --kernel teaching-2026b`.

Closing the browser does not end the job. Run `scancel JOB_ID` when you are done.

## Idle GPU jobs

Every 5 minutes, running GPU jobs are checked. A job is idle when GPU use is under 5 %, no files were written, CPU use is under a quarter of a core, and (for notebooks) no kernel is busy. If anything cannot be measured, the job counts as active.

After **2 hours** idle (**6 hours** in `long`) you get a Telegram warning. If it is still idle **30 minutes** later, it is cancelled. Any activity resets the clock. Nothing is cancelled unless the warning reached your Telegram. `/scratch/JOB_ID` is deleted with the job; home and `/local/$USER` are kept.

If idling is intentional, mark the job (you will get a notice whenever a job carries the mark):

```sh
sbatch --comment=idle=keep job.sbatch            # when submitting
scontrol update JobId=JOB_ID Comment=idle=keep   # on a running job
lab-jupyter --keep-idle                          # a notebook
scontrol update JobId=JOB_ID Comment=            # remove the mark
```

A kept job still uses the GPU and your GPU-hours. Do not use busy loops to look active.

## Files, datasets and Python

> ⚠️ **`/mnt/bulk/datasets/shared` has no backup, and anyone can delete anyone's files.** A deletion there cannot be undone.
> - Work only in `shared/$USER/` or a project folder agreed with its owners.
> - Never delete, move or overwrite other people's files.
> - Before `rm -r`, `rsync --delete` or a bulk `mv`, print the path and check it is yours.
> - Check what an AI assistant is about to run there.
>
> Damaging someone else's data, even by accident, is serious. If it happens, tell the administrator and the owner at once.

The same paths work on the NAS and node2:

| Path | Use |
| --- | --- |
| `/mnt/bulk/datasets/public` | Curated datasets, read-only: `qanats/`, `solar/`, `yolo_filtered_dataset/`. |
| `/mnt/bulk/datasets/public/qanats/yolo` | Qanats YOLO data; the full set is in `FINAL_FULL_DATASET/`. Read `qanats/README-YOLO.md` first. |
| `/mnt/bulk/datasets/shared` | Shared area, read/write: **1 TB for all students together**. |
| `/mnt/bulk/datasets/private-projects/NAME` | Members-only project folder, on request. Start a new login or job after you are added. |

```sh
mkdir -p /mnt/bulk/datasets/shared/$USER/my-project
df -h /mnt/bulk/datasets/shared            # space left
du -sh /mnt/bulk/datasets/shared/$USER     # your usage
```

Do not keep private files, secrets or your only copy of anything in the shared area. Never use `chmod 777`.

In a job on node2, check that the datasets are really mounted before training:

```sh
mountpoint -q /mnt/bulk/datasets/public || { echo "NAS datasets not mounted" >&2; exit 1; }
```

The rig has no NAS mounts yet. Copy only the files you need, for example `rsync -av lab-nas:/mnt/bulk/datasets/shared/YOUR_APPROVED_USERNAME/my-project/subset/ ./subset/`.

**Storage limits**

| Where | Limit | Backed up |
| --- | --- | --- |
| Home | 5 GiB | No: keep your own copy (for example in git) |
| node2 SSD: `/local/$USER` and `/scratch` | 60 GiB (hard stop 80) | No |
| node2 HDD: `$LAB_HDD`, `$LAB_CHECKPOINTS` | 400 GiB (hard stop 500) | No |

Check node2 usage with `quota -s` inside a job. For large models, put the cache on the HDD: `export HF_HUB_CACHE=$LAB_HDD/hf`. Ask the administrator for more space.

**Python:** use the shared environment `/opt/lab/envs/teaching-2026d` with `PYTHONNOUSERSITE=1`. It is read-only: never run `pip`, `uv sync`, Conda or `%pip` against it. Ask for missing packages to be added to the next release.

## MLflow

Request MLflow access if you do not have it, then sign in at <https://mlflow.smtornado.com>. Only you and the administrator see your experiments unless you share them.

On the NAS, run `lab-mlflow --login` once (again after a password change). In a job:

```sh
lab-mlflow -- /opt/lab/envs/teaching-2026d/bin/python train.py
```

```python
import mlflow
mlflow.set_experiment("YOUR_USERNAME/project-name")
with mlflow.start_run():
    mlflow.log_params({"seed": 42, "learning_rate": 0.001})
    mlflow.log_metric("validation_loss", 0.25, step=1)
```

Log summaries and chosen files, not datasets or every checkpoint. Never put a password in a script.

## Telegram bot

`/me`, `/quota`, `/expiry`, `/jobs`, `/queue`, `/jupyter` (reports a running notebook; it never sends the token) and `/help`.

Job notices: `/notify telegram important` (default: failures, time limits, cancellations), `/notify telegram all` (also starts and completions) or `/notify telegram off`. Changes apply within about five minutes. Idle-GPU warnings always arrive.

**Another computer:** use one key per computer and never copy a private key. Send the new public key to the bot:

```text
/addkey ssh-ed25519 AAAA… my-laptop
```

Compare the fingerprint the bot shows with `ssh-keygen -lf ~/.ssh/id_ed25519.pub`. You get a message once it is approved (up to 20 keys). If a laptop is lost, ask the administrator to remove its key.

## Everything else

- **Account end:** emails 30, 14, 7 and 1 days before, and a Telegram message the day before. Reply to any lab email to ask for an extension. Nothing is deleted; your home becomes read-only.
- **Paused submissions:** a temporary pause blocks new jobs until the shown time; running jobs continue.
- **Maintenance:** a node under maintenance stops accepting jobs, and a reboot loses notebook memory. Save often and request only the time you need.
- **Object storage (S3):** request `svc-s3` to get `~/.aws/credentials` (profile `lab`, region `lab`, path-style). Garage has no versioning, so an overwrite replaces data. Never share the key.
- **MATLAB** (after the rig returns): the **MATLAB (Slurm CPU)** shortcut, or `lab-matlab --gui` (4 CPUs, 8 GiB, 4 hours by default; more with `--cpus 8 --mem-gb 16`).
- **Coding assistants:** give yours [AGENT_USAGE.md](AGENT_USAGE.md) before it runs anything. For Overleaf from Claude Code or Codex, see the [Overleaf MCP guide](OVERLEAF_MCP.md).
- **Status page:** machines, queue and cooling are public; per-person GPU-hours are visible only to the administrator.
