diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..a23feaf --- /dev/null +++ b/.gitattributes @@ -0,0 +1,14 @@ +# Shell scripts and python run inside WSL/Linux. Checking them out with CRLF +# breaks them at the first line: `bash: $'\r': command not found`. +# Force LF regardless of the platform doing the checkout. +*.sh text eol=lf +*.py text eol=lf +*.yaml text eol=lf +*.yml text eol=lf + +*.md text +*.html text + +*.ply binary +*.obj binary +*.pth binary diff --git a/SETUP.md b/SETUP.md index b64ff63..abc8708 100644 --- a/SETUP.md +++ b/SETUP.md @@ -13,8 +13,18 @@ RTX 3090(24GB) 머신에서 SUM Parts + PointVector 학습을 재현하는 절 |---|---| | OS | Windows + WSL2 (Ubuntu 22.04) 또는 네이티브 Linux | | GPU | RTX 3090 24GB, 드라이버가 WSL에서 인식될 것 | -| 디스크 | 40GB 이상 여유 (데이터 13GB + 환경 + 체크포인트) | +| 디스크 | **35GB 이상 여유** | | 계정 | HuggingFace 계정 (데이터 게이트 수락에 필요) | +| 도구 | `git`, `curl` (sudo는 불필요) | + +디스크 내역 — 전부 이 절차가 만들어낸다: + +| 항목 | 크기 | +|---|---| +| miniconda + 환경 | 12 GB | +| 업스트림 소스 | 1.7 GB | +| 데이터셋 (아카이브 포함) | 18 GB | +| 체크포인트·로그 | 1.5 GB | WSL이면 `nvidia-smi`가 WSL 안에서 GPU를 보여야 한다. 안 보이면 여기서 멈추고 드라이버부터. @@ -42,10 +52,28 @@ grep -rl '/mnt/d/MYCLAUDE_PROJECT/sum-parts-test/scripts' scripts/ \ --- -## 2. 환경 구축 (약 40분) +## 2. 환경 구축 (약 50분) + +먼저 부트스트랩. **새 머신에는 miniconda도 업스트림 소스도 없다** — +이 레포에는 우리 스크립트만 들어 있고, 벤치마크 본체는 별도 clone이 필요하다. ```bash -bash scripts/setup_env.sh # conda + CUDA 11.8 + torch 2.0.1 +bash scripts/bootstrap.sh # miniconda 설치 + 업스트림 clone + GPU 확인 +``` + +이게 만드는 것: + +| 경로 | 내용 | 크기 | +|---|---|---| +| `~/miniconda3` | conda (sudo 불필요, $HOME에 설치) | 0.5 GB | +| `~/sum-parts` | [SUM-Parts-Benchmarks](https://github.com/tudelft3d/SUM-Parts-Benchmarks) clone | 1.7 GB | + +부트스트랩 끝에 GPU 용량을 찍어준다. **24GB면 `voxel_max=64000` 가능**하다고 알려준다. + +이어서 환경: + +```bash +bash scripts/setup_env.sh # conda env + CUDA 11.8 + torch 2.0.1 bash scripts/setup_pointnext.sh # 의존성 + CUDA 확장 5종 빌드 ``` diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh new file mode 100644 index 0000000..7a459d7 --- /dev/null +++ b/scripts/bootstrap.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +# SUM Parts - bring a bare machine to the point where setup_env.sh can run +# +# setup_env.sh and setup_pointnext.sh both assume two things already exist: +# ~/miniconda3 (they call conda directly) +# ~/sum-parts (the upstream benchmark clone they build inside) +# +# On a fresh machine neither is there, so this runs first. Idempotent: an +# existing miniconda or clone is left alone. +# +# No sudo anywhere. Miniconda installs to $HOME, and the CUDA toolkit comes +# from conda rather than apt, so this works on locked-down machines. +set -euo pipefail + +CONDA_ROOT="$HOME/miniconda3" +REPO_DIR="$HOME/sum-parts" +UPSTREAM="https://github.com/tudelft3d/SUM-Parts-Benchmarks.git" + +echo "=== [1/3] miniconda ===" +if [ -x "$CONDA_ROOT/bin/conda" ]; then + echo " present: $($CONDA_ROOT/bin/conda --version)" +else + echo " installing to $CONDA_ROOT" + TMP=$(mktemp -d) + curl -fsSL -o "$TMP/miniconda.sh" \ + https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh + bash "$TMP/miniconda.sh" -b -p "$CONDA_ROOT" + rm -rf "$TMP" + echo " installed: $($CONDA_ROOT/bin/conda --version)" +fi + +echo +echo "=== [2/3] upstream benchmark repo ===" +if [ -d "$REPO_DIR/.git" ]; then + echo " present: $REPO_DIR ($(cd "$REPO_DIR" && git log --oneline -1))" +else + echo " cloning $UPSTREAM" + git clone --depth 1 "$UPSTREAM" "$REPO_DIR" + echo " cloned: $(cd "$REPO_DIR" && git log --oneline -1)" +fi + +BUNDLE="$REPO_DIR/semantic_segmentation/PointNeXt_bundle" +if [ ! -d "$BUNDLE" ]; then + echo "error: $BUNDLE missing -- upstream layout changed?" >&2 + exit 1 +fi +echo " bundle: $BUNDLE" + +echo +echo "=== [3/3] GPU visible ===" +if ! command -v nvidia-smi > /dev/null; then + echo " WARNING: nvidia-smi not found. On WSL2 this means the driver is not" + echo " exposing the GPU; fix that before continuing -- nothing below works" + echo " without it." +else + nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv,noheader + TOTAL=$(nvidia-smi --query-gpu=memory.total --format=csv,noheader,nounits | head -1) + echo + if [ "$TOTAL" -ge 20000 ]; then + echo " ${TOTAL} MiB -- the paper setting voxel_max=64000 (needs ~16.5 GB) fits." + else + echo " ${TOTAL} MiB -- voxel_max=64000 needs ~16.5 GB and will NOT fit." + echo " Use scripts/sweep_voxel_max.sh to find the largest value that does." + fi +fi + +echo +echo "BOOTSTRAP DONE -- next: bash scripts/setup_env.sh"