Skip to content

Commit b1d2cc8

Browse files
brandonrosclaude
andcommitted
feat(container): add ubuntu24-cuda13 image with LLVM 19.1.7
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent fd259eb commit b1d2cc8

2 files changed

Lines changed: 104 additions & 0 deletions

File tree

.github/workflows/container_images.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ jobs:
4242
- name: RockyLinux-9/CUDA-13.0.2
4343
image: "rust-gpu/rust-cuda-rockylinux9-cuda13"
4444
dockerfile: ./container/rockylinux9-cuda13/Dockerfile
45+
- name: Ubuntu-24.04/CUDA-13.0.2/LLVM-19.1.7
46+
image: "rust-gpu/rust-cuda-ubuntu24-cuda13-llvm19"
47+
dockerfile: ./container/ubuntu24-cuda13-llvm19/Dockerfile
4548
steps:
4649
- name: Free up space
4750
# Without this the job will likely run out of disk space.
@@ -165,6 +168,8 @@ jobs:
165168
image: "rust-gpu/rust-cuda-rockylinux9-cuda12"
166169
- name: RockyLinux-9/CUDA-13.0.2
167170
image: "rust-gpu/rust-cuda-rockylinux9-cuda13"
171+
- name: Ubuntu-24.04/CUDA-13.0.2/LLVM-19.1.7
172+
image: "rust-gpu/rust-cuda-ubuntu24-cuda13-llvm19"
168173
steps:
169174
- name: Set artifact name
170175
run: |
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
FROM nvcr.io/nvidia/cuda:13.0.2-cudnn-devel-ubuntu24.04 AS llvm-builder
2+
3+
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
4+
build-essential \
5+
clang \
6+
curl \
7+
libffi-dev \
8+
libedit-dev \
9+
libncurses5-dev \
10+
libssl-dev \
11+
libtinfo-dev \
12+
libxml2-dev \
13+
cmake \
14+
ninja-build \
15+
pkg-config \
16+
python3 \
17+
xz-utils \
18+
zlib1g-dev && \
19+
rm -rf /var/lib/apt/lists/*
20+
21+
WORKDIR /data/llvm19
22+
23+
# Download and build LLVM 19.1.7 (the active LLVM 19 pin used by `rustc_codegen_nvvm`).
24+
# LLVM 8+ ships as a monorepo tarball; cmake source root is the `llvm/` subdir.
25+
RUN curl -sSf -L -O https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.7/llvm-project-19.1.7.src.tar.xz && \
26+
tar -xf llvm-project-19.1.7.src.tar.xz && \
27+
cd llvm-project-19.1.7.src && \
28+
mkdir build && cd build && \
29+
ARCH=$(dpkg --print-architecture) && \
30+
if [ "$ARCH" = "amd64" ]; then \
31+
TARGETS="X86;NVPTX"; \
32+
else \
33+
TARGETS="AArch64;NVPTX"; \
34+
fi && \
35+
cmake -G Ninja \
36+
-DCMAKE_BUILD_TYPE=Release \
37+
-DLLVM_TARGETS_TO_BUILD="$TARGETS" \
38+
-DLLVM_BUILD_LLVM_DYLIB=ON \
39+
-DLLVM_LINK_LLVM_DYLIB=ON \
40+
-DLLVM_ENABLE_ASSERTIONS=OFF \
41+
-DLLVM_ENABLE_BINDINGS=OFF \
42+
-DLLVM_INCLUDE_EXAMPLES=OFF \
43+
-DLLVM_INCLUDE_TESTS=OFF \
44+
-DLLVM_INCLUDE_BENCHMARKS=OFF \
45+
-DLLVM_ENABLE_ZLIB=ON \
46+
-DLLVM_ENABLE_TERMINFO=ON \
47+
-DCMAKE_INSTALL_PREFIX=/opt/llvm-19 \
48+
../llvm && \
49+
ninja -j$(nproc) && \
50+
ninja install && \
51+
cd ../.. && \
52+
rm -rf llvm-project-19.1.7.src*
53+
54+
FROM nvcr.io/nvidia/cuda:13.0.2-cudnn-devel-ubuntu24.04
55+
56+
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
57+
build-essential \
58+
clang \
59+
curl \
60+
libssl-dev \
61+
libtinfo-dev \
62+
pkg-config \
63+
xz-utils \
64+
zlib1g-dev \
65+
cmake \
66+
libfontconfig-dev \
67+
libx11-xcb-dev \
68+
libxcursor-dev \
69+
libxi-dev \
70+
libxinerama-dev \
71+
libxrandr-dev && \
72+
rm -rf /var/lib/apt/lists/*
73+
74+
COPY --from=llvm-builder /opt/llvm-19 /opt/llvm-19
75+
RUN ln -s /opt/llvm-19/bin/llvm-config /usr/bin/llvm-config && \
76+
ln -s /opt/llvm-19/bin/llvm-config /usr/bin/llvm-config-19 && \
77+
ln -s /opt/llvm-19/bin/llvm-as /usr/bin/llvm-as-19
78+
79+
# Get Rust (install rustup; toolchain installed from rust-toolchain.toml below)
80+
RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y --profile minimal --default-toolchain none
81+
ENV PATH="/root/.cargo/bin:${PATH}"
82+
83+
# Setup the workspace
84+
WORKDIR /data/rust-cuda
85+
RUN --mount=type=bind,source=rust-toolchain.toml,target=/data/rust-cuda/rust-toolchain.toml \
86+
rustup show
87+
88+
# Add nvvm + LLVM 19 dylib to the runtime linker path.
89+
ENV LD_LIBRARY_PATH="/opt/llvm-19/lib:/usr/local/cuda/nvvm/lib64:${LD_LIBRARY_PATH}"
90+
91+
# `rustc_codegen_nvvm`'s build.rs probes `LLVM_CONFIG_19` to locate the LLVM 19
92+
# toolchain when the `llvm19` cargo feature is on. The feature itself is gated;
93+
# downstream crates that depend on `cuda_builder` must build with
94+
# `--features llvm19` for this to take effect — that propagates through to
95+
# `nvvm/llvm19` (default `NvvmArch` = Blackwell) and `rustc_codegen_nvvm/llvm19`
96+
# (LLVM 19 codegen path) per crates/cuda_builder/Cargo.toml.
97+
ENV LLVM_CONFIG_19=/opt/llvm-19/bin/llvm-config
98+
ENV LLVM_LINK_STATIC=1
99+
ENV RUST_LOG=info

0 commit comments

Comments
 (0)