Skip to content

Commit 9647832

Browse files
committed
Multi-stage docker images
And remove the rust cache as it likely is not helping
1 parent a51d85f commit 9647832

File tree

6 files changed

+184
-155
lines changed

6 files changed

+184
-155
lines changed

.github/workflows/ci_linux.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,6 @@ jobs:
7373
nvcc --version
7474
rustup show
7575
76-
- name: Load Rust cache
77-
uses: Swatinem/rust-cache@v2
78-
with:
79-
key: ${{ matrix.variance.name }}-${{ github.sha }}
80-
8176
- name: Rustfmt
8277
run: cargo fmt --all -- --check
8378

container/rockylinux9-cuda12/Dockerfile

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,28 @@
1-
FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-rockylinux9
1+
FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-rockylinux9 AS llvm-builder
22

3-
RUN dnf -y update && \
4-
dnf -y install \
3+
RUN dnf -y install \
4+
--nobest \
5+
--allowerasing \
6+
--setopt=install_weak_deps=False \
57
clang \
68
openssl-devel \
79
pkgconfig \
810
redhat-rpm-config \
911
which \
1012
xz \
11-
zlib-devel && \
12-
dnf clean all
13-
14-
# Needed to build `path_tracer`, `optix/ex03_window` example
15-
RUN dnf -y install \
16-
cmake \
17-
fontconfig-devel \
18-
libX11-devel \
19-
libXcursor-devel \
20-
libXi-devel \
21-
libXrandr-devel && \
22-
dnf clean all
23-
24-
# Get LLVM 7
25-
WORKDIR /data/llvm7
26-
27-
# Install dependencies for building LLVM
28-
RUN dnf -y install epel-release && \
29-
dnf -y install \
13+
zlib-devel \
3014
libffi-devel \
3115
ncurses-devel \
3216
libxml2-devel \
3317
libedit-devel \
3418
python3 \
35-
make && \
19+
make \
20+
cmake && \
3621
dnf clean all
3722

38-
# Download and build LLVM 7.1.0 for all architectures
23+
WORKDIR /data/llvm7
24+
25+
# Download and build LLVM 7.1.0 for all architectures.
3926
RUN curl -sSf -L -O https://github.com/llvm/llvm-project/releases/download/llvmorg-7.1.0/llvm-7.1.0.src.tar.xz && \
4027
tar -xf llvm-7.1.0.src.tar.xz && \
4128
cd llvm-7.1.0.src && \
@@ -58,17 +45,36 @@ RUN curl -sSf -L -O https://github.com/llvm/llvm-project/releases/download/llvmo
5845
-DLLVM_INCLUDE_BENCHMARKS=OFF \
5946
-DLLVM_ENABLE_ZLIB=ON \
6047
-DLLVM_ENABLE_TERMINFO=ON \
61-
-DCMAKE_INSTALL_PREFIX=/usr \
48+
-DCMAKE_INSTALL_PREFIX=/opt/llvm-7 \
6249
.. && \
6350
make -j$(nproc) && \
6451
make install && \
6552
cd ../.. && \
6653
rm -rf llvm-7.1.0.src* && \
67-
ln -s /usr/bin/llvm-config /usr/bin/llvm-config-7 && \
6854
dnf clean all
6955

70-
# Get Rust
71-
RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y
56+
FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-rockylinux9
57+
58+
RUN dnf -y install \
59+
--nobest \
60+
--allowerasing \
61+
--setopt=install_weak_deps=False \
62+
clang \
63+
openssl-devel \
64+
pkgconfig \
65+
redhat-rpm-config \
66+
which \
67+
xz \
68+
zlib-devel \
69+
cmake && \
70+
dnf clean all
71+
72+
COPY --from=llvm-builder /opt/llvm-7 /opt/llvm-7
73+
RUN ln -s /opt/llvm-7/bin/llvm-config /usr/bin/llvm-config && \
74+
ln -s /opt/llvm-7/bin/llvm-config /usr/bin/llvm-config-7
75+
76+
# Get Rust (install rustup; toolchain installed from rust-toolchain.toml below)
77+
RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y --profile minimal --default-toolchain none
7278
ENV PATH="/root/.cargo/bin:${PATH}"
7379

7480
# Setup the workspace

container/ubuntu22-cuda11/Dockerfile

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,26 @@
1-
FROM nvcr.io/nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04
1+
FROM nvcr.io/nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04 AS llvm-builder
22

33
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
44
build-essential \
5-
curl \
65
clang \
6+
curl \
7+
libffi-dev \
8+
libedit-dev \
9+
libncurses5-dev \
710
libssl-dev \
811
libtinfo-dev \
12+
libxml2-dev \
13+
cmake \
14+
ninja-build \
915
pkg-config \
16+
python3 \
1017
xz-utils \
1118
zlib1g-dev && \
1219
rm -rf /var/lib/apt/lists/*
1320

14-
# Needed to build `path_tracer`, `optix/ex03_window` example
15-
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
16-
cmake \
17-
libfontconfig-dev \
18-
libx11-xcb-dev \
19-
libxcursor-dev \
20-
libxi-dev \
21-
libxinerama-dev \
22-
libxrandr-dev && \
23-
rm -rf /var/lib/apt/lists/*
24-
25-
# Get LLVM 7
2621
WORKDIR /data/llvm7
2722

28-
# Install dependencies for building LLVM
29-
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
30-
libffi-dev \
31-
libedit-dev \
32-
libncurses5-dev \
33-
libxml2-dev \
34-
python3 \
35-
ninja-build && \
36-
rm -rf /var/lib/apt/lists/*
37-
38-
# Download and build LLVM 7.1.0 for all architectures
23+
# Download and build LLVM 7.1.0 for all architectures.
3924
RUN curl -sSf -L -O https://github.com/llvm/llvm-project/releases/download/llvmorg-7.1.0/llvm-7.1.0.src.tar.xz && \
4025
tar -xf llvm-7.1.0.src.tar.xz && \
4126
cd llvm-7.1.0.src && \
@@ -58,16 +43,39 @@ RUN curl -sSf -L -O https://github.com/llvm/llvm-project/releases/download/llvmo
5843
-DLLVM_INCLUDE_BENCHMARKS=OFF \
5944
-DLLVM_ENABLE_ZLIB=ON \
6045
-DLLVM_ENABLE_TERMINFO=ON \
61-
-DCMAKE_INSTALL_PREFIX=/usr \
46+
-DCMAKE_INSTALL_PREFIX=/opt/llvm-7 \
6247
.. && \
6348
ninja -j$(nproc) && \
6449
ninja install && \
6550
cd ../.. && \
66-
rm -rf llvm-7.1.0.src* && \
67-
ln -s /usr/bin/llvm-config /usr/bin/llvm-config-7
51+
rm -rf llvm-7.1.0.src*
52+
53+
FROM nvcr.io/nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04
54+
55+
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
56+
build-essential \
57+
clang \
58+
curl \
59+
libssl-dev \
60+
libtinfo-dev \
61+
pkg-config \
62+
xz-utils \
63+
zlib1g-dev \
64+
cmake \
65+
libfontconfig-dev \
66+
libx11-xcb-dev \
67+
libxcursor-dev \
68+
libxi-dev \
69+
libxinerama-dev \
70+
libxrandr-dev && \
71+
rm -rf /var/lib/apt/lists/*
72+
73+
COPY --from=llvm-builder /opt/llvm-7 /opt/llvm-7
74+
RUN ln -s /opt/llvm-7/bin/llvm-config /usr/bin/llvm-config && \
75+
ln -s /opt/llvm-7/bin/llvm-config /usr/bin/llvm-config-7
6876

69-
# Get Rust
70-
RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y
77+
# Get Rust (install rustup; toolchain installed from rust-toolchain.toml below)
78+
RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y --profile minimal --default-toolchain none
7179
ENV PATH="/root/.cargo/bin:${PATH}"
7280

7381
# Setup the workspace
@@ -79,4 +87,3 @@ RUN --mount=type=bind,source=rust-toolchain.toml,target=/data/rust-cuda/rust-too
7987
ENV LD_LIBRARY_PATH="/usr/local/cuda/nvvm/lib64:${LD_LIBRARY_PATH}"
8088
ENV LLVM_LINK_STATIC=1
8189
ENV RUST_LOG=info
82-

container/ubuntu22-cuda12/Dockerfile

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,26 @@
1-
FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-ubuntu22.04
1+
FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-ubuntu22.04 AS llvm-builder
22

33
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
44
build-essential \
5-
curl \
65
clang \
6+
curl \
7+
libffi-dev \
8+
libedit-dev \
9+
libncurses5-dev \
710
libssl-dev \
811
libtinfo-dev \
12+
libxml2-dev \
13+
cmake \
14+
ninja-build \
915
pkg-config \
16+
python3 \
1017
xz-utils \
1118
zlib1g-dev && \
1219
rm -rf /var/lib/apt/lists/*
1320

14-
# Needed to build `path_tracer`, `optix/ex03_window` example
15-
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
16-
cmake \
17-
libfontconfig-dev \
18-
libx11-xcb-dev \
19-
libxcursor-dev \
20-
libxi-dev \
21-
libxinerama-dev \
22-
libxrandr-dev && \
23-
rm -rf /var/lib/apt/lists/*
24-
25-
# Get LLVM 7
2621
WORKDIR /data/llvm7
2722

28-
# Install dependencies for building LLVM
29-
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
30-
libffi-dev \
31-
libedit-dev \
32-
libncurses5-dev \
33-
libxml2-dev \
34-
python3 \
35-
ninja-build && \
36-
rm -rf /var/lib/apt/lists/*
37-
38-
# Download and build LLVM 7.1.0 for all architectures
23+
# Download and build LLVM 7.1.0 for all architectures.
3924
RUN curl -sSf -L -O https://github.com/llvm/llvm-project/releases/download/llvmorg-7.1.0/llvm-7.1.0.src.tar.xz && \
4025
tar -xf llvm-7.1.0.src.tar.xz && \
4126
cd llvm-7.1.0.src && \
@@ -58,16 +43,39 @@ RUN curl -sSf -L -O https://github.com/llvm/llvm-project/releases/download/llvmo
5843
-DLLVM_INCLUDE_BENCHMARKS=OFF \
5944
-DLLVM_ENABLE_ZLIB=ON \
6045
-DLLVM_ENABLE_TERMINFO=ON \
61-
-DCMAKE_INSTALL_PREFIX=/usr \
46+
-DCMAKE_INSTALL_PREFIX=/opt/llvm-7 \
6247
.. && \
6348
ninja -j$(nproc) && \
6449
ninja install && \
6550
cd ../.. && \
66-
rm -rf llvm-7.1.0.src* && \
67-
ln -s /usr/bin/llvm-config /usr/bin/llvm-config-7
51+
rm -rf llvm-7.1.0.src*
52+
53+
FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-ubuntu22.04
54+
55+
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
56+
build-essential \
57+
clang \
58+
curl \
59+
libssl-dev \
60+
libtinfo-dev \
61+
pkg-config \
62+
xz-utils \
63+
zlib1g-dev \
64+
cmake \
65+
libfontconfig-dev \
66+
libx11-xcb-dev \
67+
libxcursor-dev \
68+
libxi-dev \
69+
libxinerama-dev \
70+
libxrandr-dev && \
71+
rm -rf /var/lib/apt/lists/*
72+
73+
COPY --from=llvm-builder /opt/llvm-7 /opt/llvm-7
74+
RUN ln -s /opt/llvm-7/bin/llvm-config /usr/bin/llvm-config && \
75+
ln -s /opt/llvm-7/bin/llvm-config /usr/bin/llvm-config-7
6876

69-
# Get Rust
70-
RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y
77+
# Get Rust (install rustup; toolchain installed from rust-toolchain.toml below)
78+
RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y --profile minimal --default-toolchain none
7179
ENV PATH="/root/.cargo/bin:${PATH}"
7280

7381
# Setup the workspace
@@ -79,4 +87,3 @@ RUN --mount=type=bind,source=rust-toolchain.toml,target=/data/rust-cuda/rust-too
7987
ENV LD_LIBRARY_PATH="/usr/local/cuda/nvvm/lib64:${LD_LIBRARY_PATH}"
8088
ENV LLVM_LINK_STATIC=1
8189
ENV RUST_LOG=info
82-

0 commit comments

Comments
 (0)