Skip to content

[CI] Switch Docker base image to CPU-only ubuntu base - #260

Merged
YWHyuk merged 1 commit into
developfrom
claude/lucid-cerf-d0wvoh
Jun 17, 2026
Merged

[CI] Switch Docker base image to CPU-only ubuntu base#260
YWHyuk merged 1 commit into
developfrom
claude/lucid-cerf-d0wvoh

Conversation

@YWHyuk

@YWHyuk YWHyuk commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Why

The CI image was built on a CUDA devel PyTorch base (pytorch/pytorch:2.8.0-cuda12.6-cudnn9-devel), which is large and pulls in CUDA/cuDNN that PyTorchSim never uses. The npu PrivateUse1 backend (third_party/openreg) simulates CUDA on the CPU and forces math-only SDPA, and flash_attn is never imported anywhere in the repo.

The only thing that actually required CUDA was pip install -e . for PyTorchSimDevice: find_package(Torch REQUIRED) inherits a CUDA requirement from a CUDA-built torch wheel (Caffe2Config.cmake hard-errors when CUDA libs are absent). Installing the CPU torch wheels removes that requirement entirely, so the whole CUDA base image can go.

Local verification

On a CPU-only machine (no nvcc), reproduced both states with the device package:

  • CUDA-built torch + no CUDA → fails at Caffe2Config.cmake:90 via CMakeLists.txt:31 find_package(Torch) (the observed failure).
  • CPU torch (USE_CUDA off) → openreg, torch_openreg, torch_bindings all compile, link, and install. ldd libtorch_bindings.so shows only torch_cpu / c10 / torch_pythonzero CUDA libraries.

Changes

Dockerfile.base:

  • Base image ubuntu:22.04 instead of the cuda-cudnn-devel image. Kept on ubuntu 22.04 deliberately to match the prebuilt gem5/llvm/spike release ABIs (libpython3.11, libprotobuf.so.23).
  • Python 3.11 via deadsnakes + CPU torch==2.8.0 / torchvision==0.23.0 from the download.pytorch.org/whl/cpu index.
  • Remove flash-attn (unused; required CUDA/nvcc to build).
  • Remove duplicate onnx/matplotlib/conan/ninja installs.
  • Fix the RISC-V toolchain step: download + extract the elf toolchain once (the glibc tarball was downloaded but never extracted; the elf tarball was extracted twice).
  • Drop conda/nvidia entries from LD_LIBRARY_PATH.

thirdparty/github-releases.json:

  • pytorch_image -> ubuntu:22.04. This changes the base pin from a1c21b0fdd36 to a2861275228a, so Check base image exists misses and CI builds a fresh base image (no skip).

What CI still needs to confirm (couldn't run Docker locally)

  1. The prebuilt gem5/spike/llvm binaries run on ubuntu:22.04 (soname compat — the reason the distro was kept at 22.04).
  2. riscv-pk builds (elf toolchain provides riscv64-unknown-elf-gcc).

Follow-up (not in this PR)

tutorial/jupyterhub/Dockerfile.tutorial shares the same pytorch_image manifest value but assumes a PyTorch/conda base (it does not install torch itself). It only triggers on pushes to ispass2026, so it does not affect this PR's CI, but it will need the same CPU treatment or its own pinned base before that workflow is run again.

🤖 Generated with Claude Code


Generated by Claude Code

@YWHyuk
YWHyuk force-pushed the claude/lucid-cerf-d0wvoh branch from d49de48 to c7c27ab Compare June 17, 2026 06:54
PyTorchSim never executes CUDA: the npu PrivateUse1 backend
(third_party/openreg) simulates CUDA on the CPU and forces math-only
SDPA, and flash-attn is never imported. The only thing that required
CUDA was find_package(Torch) inheriting it from the CUDA-built torch
wheel; installing the CPU wheels removes it, so the whole CUDA base
image can go.

Dockerfile.base:
- Base image ubuntu:22.04 instead of the cuda-cudnn-devel image, kept on
  22.04 to match the prebuilt gem5/llvm/spike ABIs (libpython3.11,
  libprotobuf.so.23).
- Python 3.11 via deadsnakes and CPU torch/torchvision wheels.
- Remove flash-attn (unused, needed CUDA/nvcc to build).
- Install psutil and the other yolov5 hub runtime deps (pyyaml, requests,
  tqdm, py-cpuinfo) that the old fat base provided implicitly; ultralytics
  is installed with --no-deps.
- Remove duplicate onnx/matplotlib/conan/ninja installs.
- Fix the RISC-V toolchain step to download and extract the elf toolchain
  once (the glibc tarball was downloaded but unused, the elf tarball was
  extracted twice).
- Drop conda/nvidia paths from LD_LIBRARY_PATH.

thirdparty/github-releases.json: pytorch_image -> ubuntu:22.04.

DeepSeek: its remote modeling file (trust_remote_code) imports flash_attn,
which transformers check_imports requires installed even though flash
attention is never executed on the npu. Register an import shim in
tests/models/DeepSeek/test_deepseek_v3_base.py that satisfies the static
import check while leaving is_flash_attn_2_available() False.

CI runners: the CPU-only image (~3.7 GB compressed) is small enough to
pull on GitHub-hosted runners, so the base build, app build, and the
op/model test jobs run on ubuntu-latest. Only test_deepseek (largest
model), test_diffusion (UNet2D simulation OOMs the hosted runner), and
test_accuracy (accuracy + speedup) stay on self-hosted.
@YWHyuk
YWHyuk force-pushed the claude/lucid-cerf-d0wvoh branch from c7c27ab to 5ead5b8 Compare June 17, 2026 07:21
@YWHyuk
YWHyuk merged commit 6b68da2 into develop Jun 17, 2026
74 checks passed
@YWHyuk
YWHyuk deleted the claude/lucid-cerf-d0wvoh branch July 8, 2026 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants