diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index 656920c2..e60d2f3f 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -24,8 +24,6 @@ jobs: build: name: Build / ${{ matrix.variance.name }} runs-on: ${{ matrix.variance.runner }} - container: - image: ${{ matrix.variance.image }} strategy: fail-fast: false matrix: @@ -56,6 +54,47 @@ jobs: artifact_path: ${{ steps.artifact_details.outputs.path }} steps: + - name: Free up space + # Without this the job will likely run out of disk space. + run: | + df -h + + # Remove Java + sudo rm -rf /usr/lib/jvm + + # Remove .NET + sudo rm -rf /usr/share/dotnet + + # Remove Swift + sudo rm -rf /usr/share/swift + + # Remove Haskell + sudo rm -rf /usr/local/.ghcup + + # Remove Julia + sudo rm -rf /usr/local/julia* + + # Remove Android SDKs + sudo rm -rf /usr/local/lib/android + + # Remove Chromium + sudo rm -rf /usr/local/share/chromium + + # Remove Microsoft/Edge and Google Chrome builds + sudo rm -rf /opt/microsoft /opt/google + + # Remove Azure CLI + sudo rm -rf /opt/az + + # Remove PowerShell + sudo rm -rf /usr/local/share/powershell + + # Remove CodeQL and other toolcaches + sudo rm -rf /opt/hostedtoolcache + + docker system prune -af || true + docker builder prune -af || true + df -h - name: Checkout repository uses: actions/checkout@v4 @@ -68,39 +107,91 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Verify CUDA, Rust installation + - name: Pull build image + run: docker pull ${{ matrix.variance.image }} + + - name: Record host UID/GID run: | - nvcc --version - rustup show + echo "HOST_UID=$(id -u)" >> $GITHUB_ENV + echo "HOST_GID=$(id -g)" >> $GITHUB_ENV - - name: Load Rust cache - uses: Swatinem/rust-cache@v2 - with: - key: ${{ matrix.variance.name }}-${{ github.sha }} + - name: Set container name + run: echo "CONTAINER_NAME=ci-build-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.variance.runner }}" >> $GITHUB_ENV + + - name: Start build container + run: | + docker create --name "$CONTAINER_NAME" \ + -v "$PWD":/workspace \ + -w /workspace \ + -e RUST_LOG \ + -e RUST_BACKTRACE \ + ${{ matrix.variance.image }} \ + sleep infinity + docker start "$CONTAINER_NAME" + + - name: Verify CUDA, Rust installation + run: | + docker exec "$CONTAINER_NAME" bash -lc 'set -euo pipefail + nvcc --version + rustup show + ' - name: Rustfmt - run: cargo fmt --all -- --check + run: | + docker exec "$CONTAINER_NAME" bash -lc 'set -euo pipefail + cargo fmt --all -- --check + ' - name: Build all bindings - run: cargo build --all-features -p cust_raw + run: | + docker exec "$CONTAINER_NAME" bash -lc 'set -euo pipefail + cargo build --all-features -p cust_raw + ' - name: Build workspace - run: cargo build --workspace --exclude "optix*" --exclude "path-tracer" --exclude "denoiser" --exclude "ex0*" --exclude "cudnn*" + run: | + docker exec "$CONTAINER_NAME" bash -lc 'set -euo pipefail + cargo build --workspace \ + --exclude "optix*" \ + --exclude "path-tracer" \ + --exclude "denoiser" \ + --exclude "ex0*" \ + --exclude "cudnn*" + ' - name: Clippy - env: - RUSTFLAGS: -Dwarnings - run: cargo clippy --workspace --exclude "optix*" --exclude "path-tracer" --exclude "denoiser" --exclude "ex0*" --exclude "cudnn*" - - # Don't currently test because many tests rely on the system having a CUDA GPU - # - name: Test - # run: cargo test --workspace + run: | + docker exec "$CONTAINER_NAME" bash -lc 'set -euo pipefail + export RUSTFLAGS=-Dwarnings + cargo clippy --workspace \ + --exclude "optix*" \ + --exclude "path-tracer" \ + --exclude "denoiser" \ + --exclude "ex0*" \ + --exclude "cudnn*" + ' - name: Check documentation - env: - RUSTDOCFLAGS: -Dwarnings - run: cargo doc --workspace --all-features --document-private-items --no-deps --exclude "optix*" --exclude "path-tracer" --exclude "denoiser" --exclude "ex0*" --exclude "cudnn*" --exclude "cust_raw" + run: | + docker exec "$CONTAINER_NAME" bash -lc 'set -euo pipefail + export RUSTDOCFLAGS=-Dwarnings + cargo doc --workspace --all-features --document-private-items --no-deps \ + --exclude "optix*" \ + --exclude "path-tracer" \ + --exclude "denoiser" \ + --exclude "ex0*" \ + --exclude "cudnn*" \ + --exclude "cust_raw" + ' + + - name: Normalize build artifacts ownership + run: | + docker exec "$CONTAINER_NAME" bash -lc "rm -rf /workspace/target/debug/incremental || true" + docker exec "$CONTAINER_NAME" bash -lc "chown -R ${HOST_UID}:${HOST_GID} /workspace/target || true" + - name: Stop build container + run: | + docker rm -f "$CONTAINER_NAME" || true - name: Prepare artifact details id: artifact_details run: | @@ -159,18 +250,24 @@ jobs: - name: Ubuntu-24.04 / CUDA-12.8.1 / ARM64 image: "ghcr.io/rust-gpu/rust-cuda-ubuntu24-cuda12:latest" runner: ubuntu-24.04-arm - - name: RockyLinux-9 / CUDA-12.8.1 / x86_64 - image: "ghcr.io/rust-gpu/rust-cuda-rockylinux9-cuda12:latest" - runner: ubuntu-latest steps: + - name: Compute artifact name + id: test_artifact + run: | + SANITIZED_NAME=$(echo '${{ matrix.variance.name }}' | sed 's/[^a-zA-Z0-9.-]/-/g') + ARTIFACT_NAME="target_debug-${SANITIZED_NAME}-${{ github.run_id }}" + ARTIFACT_PATH="target/debug" + echo "name=${ARTIFACT_NAME}" >> $GITHUB_OUTPUT + echo "path=${ARTIFACT_PATH}" >> $GITHUB_OUTPUT + - name: Download build artifacts uses: actions/download-artifact@v4 with: - name: ${{ needs.build.outputs.artifact_name }} - path: ${{ needs.build.outputs.artifact_path }} + name: ${{ steps.test_artifact.outputs.name }} + path: ${{ steps.test_artifact.outputs.path }} - name: List downloaded files - run: ls -lR ${{ needs.build.outputs.artifact_path }} + run: ls -lR ${{ steps.test_artifact.outputs.path }} - name: Run remote tests env: diff --git a/.github/workflows/container_images.yml b/.github/workflows/container_images.yml index c056d144..eb66d98a 100644 --- a/.github/workflows/container_images.yml +++ b/.github/workflows/container_images.yml @@ -43,6 +43,47 @@ jobs: image: "rust-gpu/rust-cuda-rockylinux9-cuda12" dockerfile: ./container/rockylinux9-cuda12/Dockerfile steps: + - name: Free up space + # Without this the job will likely run out of disk space. + run: | + df -h + + # Remove Java + sudo rm -rf /usr/lib/jvm + + # Remove .NET + sudo rm -rf /usr/share/dotnet + + # Remove Swift + sudo rm -rf /usr/share/swift + + # Remove Haskell + sudo rm -rf /usr/local/.ghcup + + # Remove Julia + sudo rm -rf /usr/local/julia* + + # Remove Android SDKs + sudo rm -rf /usr/local/lib/android + + # Remove Chromium + sudo rm -rf /usr/local/share/chromium + + # Remove Microsoft/Edge and Google Chrome builds + sudo rm -rf /opt/microsoft /opt/google + + # Remove Azure CLI + sudo rm -rf /opt/az + + # Remove PowerShell + sudo rm -rf /usr/local/share/powershell + + # Remove CodeQL and other toolcaches + sudo rm -rf /opt/hostedtoolcache + + docker system prune -af || true + docker builder prune -af || true + df -h - name: Checkout repository uses: actions/checkout@v4 - name: Validate platform diff --git a/container/rockylinux9-cuda12/Dockerfile b/container/rockylinux9-cuda12/Dockerfile index 8e0e4444..844fd31f 100644 --- a/container/rockylinux9-cuda12/Dockerfile +++ b/container/rockylinux9-cuda12/Dockerfile @@ -1,41 +1,26 @@ -FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-rockylinux9 +FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-rockylinux9 AS llvm-builder -RUN dnf -y update && \ - dnf -y install \ - clang \ +RUN dnf -y install \ + --nobest \ + --allowerasing \ + --setopt=install_weak_deps=False \ openssl-devel \ pkgconfig \ - redhat-rpm-config \ which \ xz \ - zlib-devel && \ - 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 \ + zlib-devel \ libffi-devel \ ncurses-devel \ libxml2-devel \ libedit-devel \ python3 \ - make && \ + make \ + cmake && \ dnf clean all -# Download and build LLVM 7.1.0 for all architectures +WORKDIR /data/llvm7 + +# Download and build LLVM 7.1.0 for all architectures. 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 && \ @@ -58,17 +43,34 @@ 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 install && \ cd ../.. && \ rm -rf llvm-7.1.0.src* && \ - ln -s /usr/bin/llvm-config /usr/bin/llvm-config-7 && \ dnf clean all -# Get Rust -RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y +FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-rockylinux9 + +RUN dnf -y install \ + --nobest \ + --allowerasing \ + --setopt=install_weak_deps=False \ + openssl-devel \ + pkgconfig \ + which \ + xz \ + zlib-devel \ + cmake && \ + dnf clean all + +COPY --from=llvm-builder /opt/llvm-7 /opt/llvm-7 +RUN ln -s /opt/llvm-7/bin/llvm-config /usr/bin/llvm-config && \ + ln -s /opt/llvm-7/bin/llvm-config /usr/bin/llvm-config-7 + +# Get Rust (install rustup; toolchain installed from rust-toolchain.toml below) +RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y --profile minimal --default-toolchain none ENV PATH="/root/.cargo/bin:${PATH}" # Setup the workspace diff --git a/container/ubuntu22-cuda11/Dockerfile b/container/ubuntu22-cuda11/Dockerfile index a4df7c66..6f4996ec 100644 --- a/container/ubuntu22-cuda11/Dockerfile +++ b/container/ubuntu22-cuda11/Dockerfile @@ -1,41 +1,26 @@ -FROM nvcr.io/nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04 +FROM nvcr.io/nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04 AS llvm-builder RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \ build-essential \ - curl \ clang \ + curl \ + libffi-dev \ + libedit-dev \ + libncurses5-dev \ libssl-dev \ libtinfo-dev \ + libxml2-dev \ + cmake \ + 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 +# Download and build LLVM 7.1.0 for all architectures. 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 && \ @@ -58,16 +43,39 @@ 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 install && \ cd ../.. && \ - rm -rf llvm-7.1.0.src* && \ - ln -s /usr/bin/llvm-config /usr/bin/llvm-config-7 + rm -rf llvm-7.1.0.src* + +FROM nvcr.io/nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04 + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \ + build-essential \ + clang \ + curl \ + libssl-dev \ + libtinfo-dev \ + pkg-config \ + xz-utils \ + zlib1g-dev \ + cmake \ + libfontconfig-dev \ + libx11-xcb-dev \ + libxcursor-dev \ + libxi-dev \ + libxinerama-dev \ + libxrandr-dev && \ + rm -rf /var/lib/apt/lists/* + +COPY --from=llvm-builder /opt/llvm-7 /opt/llvm-7 +RUN ln -s /opt/llvm-7/bin/llvm-config /usr/bin/llvm-config && \ + ln -s /opt/llvm-7/bin/llvm-config /usr/bin/llvm-config-7 -# Get Rust -RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y +# Get Rust (install rustup; toolchain installed from rust-toolchain.toml below) +RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y --profile minimal --default-toolchain none ENV PATH="/root/.cargo/bin:${PATH}" # Setup the workspace @@ -79,4 +87,3 @@ RUN --mount=type=bind,source=rust-toolchain.toml,target=/data/rust-cuda/rust-too ENV LD_LIBRARY_PATH="/usr/local/cuda/nvvm/lib64:${LD_LIBRARY_PATH}" ENV LLVM_LINK_STATIC=1 ENV RUST_LOG=info - diff --git a/container/ubuntu22-cuda12/Dockerfile b/container/ubuntu22-cuda12/Dockerfile index df8fbb82..d24bbebb 100644 --- a/container/ubuntu22-cuda12/Dockerfile +++ b/container/ubuntu22-cuda12/Dockerfile @@ -1,41 +1,26 @@ -FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-ubuntu22.04 +FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-ubuntu22.04 AS llvm-builder RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \ build-essential \ - curl \ clang \ + curl \ + libffi-dev \ + libedit-dev \ + libncurses5-dev \ libssl-dev \ libtinfo-dev \ + libxml2-dev \ + cmake \ + 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 +# Download and build LLVM 7.1.0 for all architectures. 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 && \ @@ -58,16 +43,39 @@ 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 install && \ cd ../.. && \ - rm -rf llvm-7.1.0.src* && \ - ln -s /usr/bin/llvm-config /usr/bin/llvm-config-7 + rm -rf llvm-7.1.0.src* + +FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-ubuntu22.04 + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \ + build-essential \ + clang \ + curl \ + libssl-dev \ + libtinfo-dev \ + pkg-config \ + xz-utils \ + zlib1g-dev \ + cmake \ + libfontconfig-dev \ + libx11-xcb-dev \ + libxcursor-dev \ + libxi-dev \ + libxinerama-dev \ + libxrandr-dev && \ + rm -rf /var/lib/apt/lists/* + +COPY --from=llvm-builder /opt/llvm-7 /opt/llvm-7 +RUN ln -s /opt/llvm-7/bin/llvm-config /usr/bin/llvm-config && \ + ln -s /opt/llvm-7/bin/llvm-config /usr/bin/llvm-config-7 -# Get Rust -RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y +# Get Rust (install rustup; toolchain installed from rust-toolchain.toml below) +RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y --profile minimal --default-toolchain none ENV PATH="/root/.cargo/bin:${PATH}" # Setup the workspace @@ -79,4 +87,3 @@ RUN --mount=type=bind,source=rust-toolchain.toml,target=/data/rust-cuda/rust-too ENV LD_LIBRARY_PATH="/usr/local/cuda/nvvm/lib64:${LD_LIBRARY_PATH}" ENV LLVM_LINK_STATIC=1 ENV RUST_LOG=info - diff --git a/container/ubuntu24-cuda12-llvmdebug/Dockerfile b/container/ubuntu24-cuda12-llvmdebug/Dockerfile index bbc1c33d..d8a42a83 100644 --- a/container/ubuntu24-cuda12-llvmdebug/Dockerfile +++ b/container/ubuntu24-cuda12-llvmdebug/Dockerfile @@ -1,41 +1,26 @@ -FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-ubuntu24.04 +FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-ubuntu24.04 AS llvm-builder RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \ build-essential \ clang \ curl \ + libffi-dev \ + libedit-dev \ + libncurses5-dev \ libssl-dev \ libtinfo-dev \ + libxml2-dev \ + cmake \ + 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 +# Download and build LLVM 7.1.0 for all architectures. 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 && \ @@ -58,16 +43,39 @@ 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 install && \ cd ../.. && \ - rm -rf llvm-7.1.0.src* && \ - ln -s /usr/bin/llvm-config /usr/bin/llvm-config-7 + rm -rf llvm-7.1.0.src* + +FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-ubuntu24.04 -# Get Rust -RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \ + build-essential \ + clang \ + curl \ + libssl-dev \ + libtinfo-dev \ + pkg-config \ + xz-utils \ + zlib1g-dev \ + cmake \ + libfontconfig-dev \ + libx11-xcb-dev \ + libxcursor-dev \ + libxi-dev \ + libxinerama-dev \ + libxrandr-dev && \ + rm -rf /var/lib/apt/lists/* + +COPY --from=llvm-builder /opt/llvm-7 /opt/llvm-7 +RUN ln -s /opt/llvm-7/bin/llvm-config /usr/bin/llvm-config && \ + ln -s /opt/llvm-7/bin/llvm-config /usr/bin/llvm-config-7 + +# Get Rust (install rustup; toolchain installed from rust-toolchain.toml below) +RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y --profile minimal --default-toolchain none ENV PATH="/root/.cargo/bin:${PATH}" # Setup the workspace @@ -79,4 +87,3 @@ RUN --mount=type=bind,source=rust-toolchain.toml,target=/data/Rust-CUDA/rust-too ENV LD_LIBRARY_PATH="/usr/local/cuda/nvvm/lib64:${LD_LIBRARY_PATH}" ENV LLVM_LINK_STATIC=1 ENV RUST_LOG=info - diff --git a/container/ubuntu24-cuda12/Dockerfile b/container/ubuntu24-cuda12/Dockerfile index b4ba12f5..34f68922 100644 --- a/container/ubuntu24-cuda12/Dockerfile +++ b/container/ubuntu24-cuda12/Dockerfile @@ -1,41 +1,26 @@ -FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-ubuntu24.04 +FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-ubuntu24.04 AS llvm-builder RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \ build-essential \ clang \ curl \ + libffi-dev \ + libedit-dev \ + libncurses5-dev \ libssl-dev \ libtinfo-dev \ + libxml2-dev \ + cmake \ + 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 +# Download and build LLVM 7.1.0 for all architectures. 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 && \ @@ -58,16 +43,39 @@ 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 install && \ cd ../.. && \ - rm -rf llvm-7.1.0.src* && \ - ln -s /usr/bin/llvm-config /usr/bin/llvm-config-7 + rm -rf llvm-7.1.0.src* + +FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-ubuntu24.04 -# Get Rust -RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \ + build-essential \ + clang \ + curl \ + libssl-dev \ + libtinfo-dev \ + pkg-config \ + xz-utils \ + zlib1g-dev \ + cmake \ + libfontconfig-dev \ + libx11-xcb-dev \ + libxcursor-dev \ + libxi-dev \ + libxinerama-dev \ + libxrandr-dev && \ + rm -rf /var/lib/apt/lists/* + +COPY --from=llvm-builder /opt/llvm-7 /opt/llvm-7 +RUN ln -s /opt/llvm-7/bin/llvm-config /usr/bin/llvm-config && \ + ln -s /opt/llvm-7/bin/llvm-config /usr/bin/llvm-config-7 + +# Get Rust (install rustup; toolchain installed from rust-toolchain.toml below) +RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y --profile minimal --default-toolchain none ENV PATH="/root/.cargo/bin:${PATH}" # Setup the workspace @@ -79,4 +87,3 @@ RUN --mount=type=bind,source=rust-toolchain.toml,target=/data/rust-cuda/rust-too ENV LD_LIBRARY_PATH="/usr/local/cuda/nvvm/lib64:${LD_LIBRARY_PATH}" ENV LLVM_LINK_STATIC=1 ENV RUST_LOG=info -