Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 67 additions & 45 deletions container/rockylinux9-cuda12/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,32 @@
FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-rockylinux9
# Multi-stage build to keep final image slim while still providing CUDA, Python, LLVM 7, and Rust.
# Stage 1: build LLVM and install Rust.
FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-rockylinux9 AS builder

RUN dnf -y update && \
dnf -y install \
clang \
openssl-devel \
pkgconfig \
redhat-rpm-config \
which \
xz \
zlib-devel && \
clang \
cmake \
fontconfig-devel \
libX11-devel \
libXcursor-devel \
libXi-devel \
libXrandr-devel \
libffi-devel \
libxml2-devel \
libedit-devel \
ncurses-devel \
openssl-devel \
pkgconfig \
python3 \
redhat-rpm-config \
which \
xz \
zlib-devel \
make && \
dnf clean all

# Needed to build `path_tracer`, `optix/ex03_window` example
RUN dnf -y install \
cmake \
fontconfig-devel \
libX11-devel \
libXcursor-devel \
libXi-devel \
libXrandr-devel && \
dnf clean all

# Get LLVM 7
WORKDIR /data/llvm7

# Install dependencies for building LLVM
RUN dnf -y install epel-release && \
dnf -y install \
libffi-devel \
ncurses-devel \
libxml2-devel \
libedit-devel \
python3 \
make && \
dnf clean all

# Download and build LLVM 7.1.0 for all architectures
# Build LLVM 7.1.0 once and install into /opt/llvm-7
WORKDIR /opt/build
RUN curl -sSf -L -O https://github.com/llvm/llvm-project/releases/download/llvmorg-7.1.0/llvm-7.1.0.src.tar.xz && \
tar -xf llvm-7.1.0.src.tar.xz && \
cd llvm-7.1.0.src && \
Expand All @@ -58,25 +49,56 @@ RUN curl -sSf -L -O https://github.com/llvm/llvm-project/releases/download/llvmo
-DLLVM_INCLUDE_BENCHMARKS=OFF \
-DLLVM_ENABLE_ZLIB=ON \
-DLLVM_ENABLE_TERMINFO=ON \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_PREFIX=/opt/llvm-7 \
.. && \
make -j$(nproc) && \
make -j"$(nproc)" && \
make install && \
cd ../.. && \
rm -rf llvm-7.1.0.src* && \
ln -s /usr/bin/llvm-config /usr/bin/llvm-config-7 && \
cd /opt && \
rm -rf /opt/build

# Install Rust toolchain (minimal profile) and clean caches
RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y --profile minimal && \
/root/.cargo/bin/rustup component add rustfmt clippy && \
rm -rf /root/.cargo/registry /root/.cargo/git /root/.rustup/tmp
ENV PATH="/root/.cargo/bin:${PATH}"

# Stage 2: final runtime image
FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-rockylinux9 AS runtime

# Install runtime build dependencies (no compilers for LLVM build needed here)
RUN dnf -y update && \
dnf -y install \
clang \
cmake \
fontconfig-devel \
libX11-devel \
libXcursor-devel \
libXi-devel \
libXrandr-devel \
openssl-devel \
pkgconfig \
python3 \
redhat-rpm-config \
which \
xz \
zlib-devel && \
dnf clean all

# Get Rust
RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y
# Copy LLVM and Rust from builder stage
COPY --from=builder /opt/llvm-7 /opt/llvm-7
RUN ln -sf /opt/llvm-7/bin/llvm-config /usr/bin/llvm-config && \
ln -sf /opt/llvm-7/bin/llvm-config /usr/bin/llvm-config-7

COPY --from=builder /root/.cargo /root/.cargo
COPY --from=builder /root/.rustup /root/.rustup
ENV PATH="/root/.cargo/bin:${PATH}"
RUN /root/.cargo/bin/rustup show && \
rm -rf /root/.cargo/registry /root/.cargo/git /root/.rustup/tmp

# Setup the workspace
# Set up workspace environment defaults
WORKDIR /data/rust-cuda
RUN --mount=type=bind,source=rust-toolchain.toml,target=/data/rust-cuda/rust-toolchain.toml \
rustup show

# Add nvvm to LD_LIBRARY_PATH.
ENV LD_LIBRARY_PATH="/usr/local/cuda/nvvm/lib64:${LD_LIBRARY_PATH}"
ENV LLVM_LINK_STATIC=1
ENV RUST_LOG=info

CMD ["bash"]
116 changes: 69 additions & 47 deletions container/ubuntu22-cuda11/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,32 @@
FROM nvcr.io/nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04
# Multi-stage build to keep the final image lean while providing CUDA, LLVM 7, and Rust.
FROM nvcr.io/nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04 AS builder

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
build-essential \
curl \
clang \
libssl-dev \
libtinfo-dev \
pkg-config \
xz-utils \
zlib1g-dev && \
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get -y install \
build-essential \
clang \
cmake \
curl \
libffi-dev \
libfontconfig-dev \
libssl-dev \
libtinfo-dev \
libedit-dev \
libncurses5-dev \
libxml2-dev \
libx11-xcb-dev \
libxcursor-dev \
libxi-dev \
libxinerama-dev \
libxrandr-dev \
ninja-build \
pkg-config \
python3 \
xz-utils \
zlib1g-dev && \
rm -rf /var/lib/apt/lists/*

# Needed to build `path_tracer`, `optix/ex03_window` example
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
cmake \
libfontconfig-dev \
libx11-xcb-dev \
libxcursor-dev \
libxi-dev \
libxinerama-dev \
libxrandr-dev && \
rm -rf /var/lib/apt/lists/*

# Get LLVM 7
WORKDIR /data/llvm7

# Install dependencies for building LLVM
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
libffi-dev \
libedit-dev \
libncurses5-dev \
libxml2-dev \
python3 \
ninja-build && \
rm -rf /var/lib/apt/lists/*

# Download and build LLVM 7.1.0 for all architectures
WORKDIR /opt/build
RUN curl -sSf -L -O https://github.com/llvm/llvm-project/releases/download/llvmorg-7.1.0/llvm-7.1.0.src.tar.xz && \
tar -xf llvm-7.1.0.src.tar.xz && \
cd llvm-7.1.0.src && \
Expand All @@ -58,25 +49,56 @@ RUN curl -sSf -L -O https://github.com/llvm/llvm-project/releases/download/llvmo
-DLLVM_INCLUDE_BENCHMARKS=OFF \
-DLLVM_ENABLE_ZLIB=ON \
-DLLVM_ENABLE_TERMINFO=ON \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_PREFIX=/opt/llvm-7 \
.. && \
ninja -j$(nproc) && \
ninja -j"$(nproc)" && \
ninja install && \
cd ../.. && \
rm -rf llvm-7.1.0.src* && \
ln -s /usr/bin/llvm-config /usr/bin/llvm-config-7
cd /opt && rm -rf /opt/build

# Get Rust
RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y
RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y --profile minimal && \
/root/.cargo/bin/rustup component add rustfmt clippy && \
rm -rf /root/.cargo/registry /root/.cargo/git /root/.rustup/tmp
ENV PATH="/root/.cargo/bin:${PATH}"

# Setup the workspace
WORKDIR /data/rust-cuda
RUN --mount=type=bind,source=rust-toolchain.toml,target=/data/rust-cuda/rust-toolchain.toml \
rustup show
FROM nvcr.io/nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04 AS runtime

# Add nvvm to LD_LIBRARY_PATH.
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get -y install \
build-essential \
clang \
cmake \
curl \
libffi-dev \
libfontconfig-dev \
libssl-dev \
libtinfo-dev \
libedit-dev \
libncurses5-dev \
libxml2-dev \
libx11-xcb-dev \
libxcursor-dev \
libxi-dev \
libxinerama-dev \
libxrandr-dev \
pkg-config \
python3 \
xz-utils \
zlib1g-dev && \
rm -rf /var/lib/apt/lists/*

COPY --from=builder /opt/llvm-7 /opt/llvm-7
RUN ln -sf /opt/llvm-7/bin/llvm-config /usr/bin/llvm-config && \
ln -sf /opt/llvm-7/bin/llvm-config /usr/bin/llvm-config-7

COPY --from=builder /root/.cargo /root/.cargo
COPY --from=builder /root/.rustup /root/.rustup
ENV PATH="/root/.cargo/bin:${PATH}"
RUN /root/.cargo/bin/rustup show && \
rm -rf /root/.cargo/registry /root/.cargo/git /root/.rustup/tmp

WORKDIR /data/rust-cuda
ENV LD_LIBRARY_PATH="/usr/local/cuda/nvvm/lib64:${LD_LIBRARY_PATH}"
ENV LLVM_LINK_STATIC=1
ENV RUST_LOG=info

CMD ["bash"]
Loading
Loading