yw-div-env / SETUP_GUIDE.md
Ugness's picture
Upload folder using huggingface_hub
d260439 verified
|
Raw
History Blame Contribute Delete
5.45 kB

yw_div conda environment — H100 / CUDA 12.6 setup guide

This guide reproduces the conda environment yw_div on a target server.

  • Source machine: Linux x86_64, NVIDIA RTX A6000, CUDA 12.6, Python 3.11.12
  • Target machine: Linux x86_64, NVIDIA H100, CUDA 12.6 (driver ≥ 555/560)
  • Core stack: Python 3.11.12, PyTorch 2.7.0+cu126, torchvision 0.22.0+cu126, torchaudio 2.7.0+cu126, Triton 3.3.0, NumPy 2.2.5

The PyTorch wheels for cu126 ship their own CUDA 12.6 runtime, cuDNN 9.5, NCCL 2.26, etc. — you do not need a system-wide CUDA toolkit, only an NVIDIA driver that supports CUDA 12.6.


0. Prerequisites on the target server

# Verify the driver supports CUDA 12.6 (driver >= 555). H100 should show CC 9.0.
nvidia-smi
# Expect: "CUDA Version: 12.6" (or higher) in the top-right of the table.

# Conda (Miniconda/Anaconda/Mambaforge) must be installed.
conda --version    # any modern conda (>= 23.x) is fine

If conda is not installed:

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh
bash /tmp/miniconda.sh -b -p "$HOME/miniconda3"
source "$HOME/miniconda3/etc/profile.d/conda.sh"
conda init bash   # then restart your shell

1. Files in this bundle

File Purpose
SETUP_GUIDE.md This guide.
setup_yw_div.sh One-shot install script (recommended).
requirements_torch.txt Pinned PyTorch wheels (must use the cu126 index).
requirements_pip.txt All other Python packages (PyPI).
environment_full.yml Full conda export from the source machine (reference only).
environment_from_history.yml Minimal conda spec (reference only).
requirements_full.txt Raw pip freeze from the source machine (reference only).

Copy the entire yw_div_env/ directory to the target server (e.g. via scp -r).


2. Quick install (recommended)

cd /path/to/yw_div_env
bash setup_yw_div.sh

The script performs:

  1. conda create -n yw_div python=3.11.12 pip (channel: conda-forge)
  2. Pin baseline pip / setuptools / wheel
  3. Install PyTorch stack from https://download.pytorch.org/whl/cu126
  4. Install the rest of the packages from requirements_pip.txt
  5. Print a sanity check (torch version, CUDA visible, device names)

To use a different env name: ENV_NAME=my_env bash setup_yw_div.sh.

Activate after install:

conda activate yw_div

3. Manual install (step by step)

If you'd rather run the steps yourself:

# 1. Create the env
conda create -y -n yw_div -c conda-forge python=3.11.12 pip
conda activate yw_div

# 2. Pin pip toolchain
pip install --upgrade pip==25.0.1 setuptools==75.8.2 wheel==0.45.1

# 3. PyTorch + torchvision + torchaudio (CUDA 12.6 wheels)
pip install --index-url https://download.pytorch.org/whl/cu126 \
    torch==2.7.0+cu126 \
    torchvision==0.22.0+cu126 \
    torchaudio==2.7.0+cu126

# 4. Everything else
pip install -r requirements_pip.txt

4. Verification

conda activate yw_div
python - <<'PY'
import torch, torchvision, torchaudio, triton, numpy
print("torch       :", torch.__version__)
print("torchvision :", torchvision.__version__)
print("torchaudio  :", torchaudio.__version__)
print("triton      :", triton.__version__)
print("numpy       :", numpy.__version__)
print("cuda build  :", torch.version.cuda)
print("cudnn       :", torch.backends.cudnn.version())
print("nccl        :", torch.cuda.nccl.version())
print("cuda avail  :", torch.cuda.is_available())
for i in range(torch.cuda.device_count()):
    name = torch.cuda.get_device_name(i)
    cc   = torch.cuda.get_device_capability(i)
    print(f"  gpu[{i}]  {name}  cc={cc}")
# Tiny H100 sanity op
x = torch.randn(4096, 4096, device="cuda", dtype=torch.bfloat16)
y = x @ x
torch.cuda.synchronize()
print("matmul ok   :", y.shape, y.dtype, y.device)
PY

Expected on an H100 node:

  • cuda build : 12.6
  • cuda avail : True
  • gpu[0] NVIDIA H100 ... cc=(9, 0)

5. Notes & troubleshooting

  • +cu126 is required. Do not pip install torch without the index URL — that pulls a CPU build and silently breaks GPU code.
  • Driver too old. If nvidia-smi reports CUDA Version: 12.5 or lower, ask the admin to upgrade the driver to one that supports 12.6 (≥ 555.x). The toolkit on disk doesn't matter; the driver does.
  • H100 + bf16 / FP8. torch==2.7.0+cu126 already supports torch.bfloat16 and the H100 transformer engine paths via cuDNN 9.5. No extra steps required.
  • flash-attn / xformers. Not in this snapshot. If your project needs them, install separately, e.g. pip install flash-attn --no-build-isolation (requires nvcc/CUDA dev toolkit) or use a prebuilt wheel matching torch 2.7 + cu126.
  • Conda channel pollution. The base env on the source machine includes some conda-only packages (conda-build, libmambapy, lief, …) that are not installed in yw_div. They are conda-runtime utilities, not project dependencies.
  • Re-running the script is safe to re-attempt installs but will fail at step 1 if the env already exists. Either remove it (conda env remove -n yw_div) or pass a different ENV_NAME=.
  • HF cache / wandb. huggingface_hub, wandb, tensorboard are pre-installed; configure tokens (huggingface-cli login, wandb login) before first run.

6. Removing the env

conda env remove -n yw_div