The lab field guide 01 / Compute

A good start
on ccn2.

Your first connection, your shared home, your first GPU job. A practical manual for working comfortably—and considerately—on the cluster.

Let’s get you connected

Linux / Bash examples · Updated September 21, 2026

01 / The mental model

Shared storage. Separate compute.

ccn2 is a group of Linux machines, called nodes. SSH puts you on one specific node. That node has its own CPU, memory, GPU devices, processes, and local disk. The /ccn2/u/ filesystem is shared: your directory should be available at the same path from every node you use.

Shared across nodes

Your files under /ccn2/u/your_username/: repositories, environments, model caches, checkpoints, and logs.

Local to one node

Running jobs, GPU allocations, tmux sessions, and usually /tmp. Node6’s GPU 0 is not node7’s GPU 0.

A mounted directory is not a backup guarantee. Ask about quotas, retention, and backup arrangements before relying on them.

02 / Your first connection

Get an account. Then SSH in.

  1. Get access from the lab. Ask your lab contact or cluster administrator for your username, approved nodes, and any Stanford network/VPN or gateway requirements. This guide does not grant access.
  2. Open Terminal on your Mac or Linux laptop. Replace your_username below with your cluster account, not necessarily your laptop username. Node6 is an example; use the node you were assigned.
On your laptop
ssh your_username@node6-ccn2cluster.stanford.edu

On first connection, verify the server’s host-key fingerprint with the administrator before accepting it. Use the approved authentication method. Never disable host-key checking to get past a warning.

Once connected · confirm where you are
hostname
whoami
pwd
Make repeated connections easier with an SSH key

If you do not already have an approved key, generate a dedicated one on your laptop. Choose a passphrase. If this filename exists, reuse an approved key or choose a new filename—do not overwrite it.

On your laptop
ssh-keygen -t ed25519 -f ~/.ssh/ccn2_ed25519 -C "ccn2 access"

Give the administrator only ccn2_ed25519.pub, the public key, using the approved registration process. Keep the private key on your laptop. After registration:

Use the registered key
ssh -i ~/.ssh/ccn2_ed25519 your_username@node6-ccn2cluster.stanford.edu

Optionally merge this entry into your laptop’s ~/.ssh/config; preserve any existing entries. Then connect with ssh ccn2-node6.

Laptop ~/.ssh/config
Host ccn2-node6
    HostName node6-ccn2cluster.stanford.edu
    User your_username
    IdentityFile ~/.ssh/ccn2_ed25519
    IdentitiesOnly yes
    ServerAliveInterval 60
    ServerAliveCountMax 3

Configuration reference: OpenSSH client options.

03 / Finding your way around

A node is an SSH destination.

The hostname pattern is nodeN-ccn2cluster.stanford.edu. Use a full hostname from your laptop or from another cluster node. Shared files do not imply that SSH authentication is automatically shared.

From your laptop or a permitted cluster node
ssh your_username@node6-ccn2cluster.stanford.edu

Common node numbers: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15.

For node-to-node SSH, arrange an approved authentication method with the administrator. Do not copy your laptop’s private key onto the cluster or turn on agent forwarding by default.

My approved cluster key is in the shared home, but SSH cannot find it

SSH may still look under the account’s configured home rather than the shared shell home. If you already have a dedicated, approved cluster-side key at the path below, name it explicitly. This is not an instruction to upload a laptop key.

On a cluster node · existing cluster-side key only
ssh -i /ccn2/u/your_username/.ssh/ccn2_ed25519 \
    your_username@node7-ccn2cluster.stanford.edu

Protect your own .ssh directory with mode 700 and private keys with 600. Have the administrator confirm the correct authorized_keys location; changing shell variables does not change the SSH server’s account lookup.

04 / One place for your work

Your home belongs under /ccn2/u/.

Each person should have their own /ccn2/u/your_username/ directory, owned by their account. Use it as the consistent home/workspace across nodes. Ask the administrator to create or confirm it and configure the account’s home path consistently on every node you use.

On each node you use · inspect, do not change
printf 'Shell home: %s\n' "$HOME"
getent passwd "$(id -un)" | cut -d: -f1,6
ls -ld "/ccn2/u/$(id -un)"
df -h "/ccn2/u/$(id -un)"

If a node still uses a local home, keep only the necessary startup wiring there and load a shared environment file. Do not delete, move, or replace an existing home or .ssh directory with a symlink without a migration plan. Missing shared mount? Stop and ask for help; do not create a local look-alike under /ccn2.

05 / Download once, use across nodes

Put caches beside your work.

Keep persistent configuration, environments, and large model caches under your own shared home—not duplicated in each node’s /home. The following Bash snippet assumes your shared directory already exists and is mounted. Save it as /ccn2/u/your_username/.config/ccn2/env.sh, creating the parent directory if needed.

Shared env.sh · no credentials
CCN2_USER="$(id -un)"
CCN2_ROOT="/ccn2/u/$CCN2_USER"

if [ -d "$CCN2_ROOT" ] && [ -w "$CCN2_ROOT" ]; then
    export XDG_CONFIG_HOME="$CCN2_ROOT/.config"
    export XDG_CACHE_HOME="$CCN2_ROOT/.cache"
    export XDG_DATA_HOME="$CCN2_ROOT/.local/share"
    export XDG_STATE_HOME="$CCN2_ROOT/.local/state"
    export HF_HOME="$XDG_CACHE_HOME/huggingface"
    export HF_HUB_CACHE="$HF_HOME/hub"
    export TORCH_HOME="$XDG_CACHE_HOME/torch"
    export PIP_CACHE_DIR="$XDG_CACHE_HOME/pip"
    export CUDA_CACHE_PATH="$XDG_CACHE_HOME/nv/ComputeCache"
    export CONDA_ENVS_PATH="$CCN2_ROOT/envs"
    export CONDA_PKGS_DIRS="$XDG_CACHE_HOME/conda/pkgs"
else
    printf 'Shared ccn2 home unavailable; check the mount.\n' >&2
    return 1
fi

Load this file from the Bash startup file actually used on each node, and explicitly from job scripts. Merge the line into existing configuration; do not overwrite your startup files. Noninteractive SSH commands may not load the same startup files as your terminal.

Bash startup or job script
source "/ccn2/u/$(id -un)/.config/ccn2/env.sh"

Activate your project’s environment after loading this file. Use your own Conda installation or the lab-approved environment setup; another person’s installation path is not a template to copy. Shared environments still need compatible CUDA libraries and node hardware.

Verify the paths before downloading a model
printf '%s\n' "$XDG_CACHE_HOME" "$HF_HOME" "$HF_HUB_CACHE"
python -m pip cache dir
conda info --envs
  • Pointing is not migrating. These settings affect future reads and writes; they do not move existing caches or environments. Coordinate a migration while your jobs are stopped, then verify before removing anything.
  • Keep secrets private. Configuration and Hugging Face home directories can contain login tokens. Never publish them, copy another user’s credentials, or make them world-readable. Use approved login tools and owner-only permissions for credential files.
  • Not everything belongs on shared storage. Leave runtime sockets and XDG_RUNTIME_DIR node-local. Use administrator-approved local scratch for heavy temporary I/O; do not blindly redirect TMPDIR. Monitor space in both locations.

References: XDG directory conventions · Hugging Face cache settings. Some tools need their own cache setting; check each project’s documentation.

06 / Be a good cluster neighbor

Check first. Use only what you need.

Follow the lab’s current reservation or scheduling process before starting work. Check the node you are permitted to use. A low utilization reading is a snapshot—not a reservation or proof that a GPU is free.

On your selected node
hostname
nvidia-smi
nvidia-smi --query-gpu=index,name,memory.used,utilization.gpu,temperature.gpu,power.draw --format=csv
nvidia-smi --query-compute-apps=gpu_uuid,pid,process_name,used_memory --format=csv

Look for low memory use and low utilization together; temperature and power provide additional context. A process holding memory may be someone’s active or paused experiment. Coordinate with its owner rather than assuming you can take over.

01

Start with one GPU

Run a small sanity check. Scale only when the experiment needs it and the resources have been agreed.

02

Never evict a neighbor

Do not kill another person’s process or reset a device. If you are unsure who owns a job, ask.

03

Leave room for others

Do not occupy extra nodes “just in case.” Be considerate with CPU threads, RAM, disk, and network I/O too.

Select the GPU explicitly for your process. For example, only if GPU 2 has been cleared for you:

Example · substitute your approved GPU and project command
CUDA_VISIBLE_DEVICES=2 python train.py

train.py is a placeholder for your project. This mask limits visibility; it does not reserve a GPU. Physical GPU 2 normally appears as cuda:0 inside that process. Do not override an allocation provided by a scheduler. NVIDIA’s device visibility reference.

07 / Keep your job, not your laptop, running

Use tmux. Keep a small run record.

For an approved long-running job, start a named tmux session on the target node. It keeps your shell alive if the SSH connection drops. It does not reserve resources or survive a node reboot.

On the target node
tmux new -s first-run

Inside tmux, load your shared configuration, activate your environment, and run your command. This template uses one approved GPU and a unique log filename. Replace the project and command with your own.

Inside tmux · example job
source "/ccn2/u/$(id -un)/.config/ccn2/env.sh" || exit 1
# Activate your project's environment here.
cd "/ccn2/u/$(id -un)/Code/your_project" || exit 1
mkdir -p "/ccn2/u/$(id -un)/runs/first-run" || exit 1
CCN2_LOG="/ccn2/u/$(id -un)/runs/first-run/$(date +%Y%m%d-%H%M%S)-$(hostname)-$$.log"
set -o pipefail
CUDA_VISIBLE_DEVICES=2 python -u train.py 2>&1 | tee "$CCN2_LOG"

Detach with Ctrl + b, then d. To return, SSH into the same node and reattach:

Reconnect to the original node first
tmux ls
tmux attach -t first-run

Record the node, GPU IDs, tmux session, environment, command, log path, and output/checkpoint directory. Check logs and nvidia-smi while the job runs. Give concurrent jobs separate output directories.

More terminal basics: tmux’s getting-started guide.

08 / A few common snags

Pause, check, then ask.

SSH times out or cannot resolve the hostname

Check the full hostname and your approved network/VPN or gateway connection. Confirm the node is available with the lab. Do not change firewall settings, start a public tunnel, or scan other nodes to work around access restrictions.

Permission denied (publickey)

Confirm your cluster username, registered public key, and chosen identity file. Check which account home SSH uses. Ask the administrator to check key registration and permissions. Never send anyone your private key or a password in chat.

The server’s host key changed

Stop and verify the new fingerprint with the administrator. It may be a legitimate rebuild, but do not bypass checking or delete a known-host entry before verification.

A cache is filling /home or downloading again on every node

Check HOME, the account record, and the cache variables in the actual job shell. Confirm the shared mount and that the job sources your shared environment file before importing libraries. Check tool-specific settings. Do not delete a cache another process is using.

My tmux session disappeared

Check hostname and return to the node where it was created. Sessions are not shared even though the filesystem is. If the node rebooted or the session ended, inspect logs and checkpoints before restarting to avoid duplicate work.

CUDA out of memory, or a job is unexpectedly slow

Check your GPU mask, memory use, batch size, CPU workers, and data-loading path. Stop or adjust only your own work. Ask for help before moving to more GPUs or nodes; using additional hardware is not always the fix.

Before the first real run

You’re ready when…

  • You know which node and GPU you are permitted to use.
  • Your shared home and cache paths resolve correctly on that node.
  • A small test succeeds in the intended environment.
  • You know where the logs go, how to reconnect, and how to stop your job.