diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml new file mode 100644 index 00000000..175463b3 --- /dev/null +++ b/.github/workflows/ci_linux.yml @@ -0,0 +1,53 @@ +name: CI on Linux + +on: + pull_request: + paths-ignore: + - "**.md" + push: + paths-ignore: + - "**.md" +env: + RUST_LOG: info + RUST_BACKTRACE: 1 +jobs: + build: + name: ${{ matrix.variance.name }} + runs-on: ubuntu-latest + container: + image: ${{ matrix.variance.image }} + strategy: + fail-fast: false + matrix: + variance: + # - name: Ubuntu-22.04/CUDA-11.8.0 + # image: "ghcr.io/rust-gpu/rust-cuda-ubuntu22-cuda11:latest" + - name: Ubuntu-22.04/CUDA-12.8.1 + image: "ghcr.io/rust-gpu/rust-cuda-ubuntu22-cuda12:latest" + - name: Ubuntu-24.04/CUDA-12.8.1 + image: "ghcr.io/rust-gpu/rust-cuda-ubuntu24-cuda12:latest" + - name: RockyLinux-9/CUDA-12.8.1 + image: "ghcr.io/rust-gpu/rust-cuda-rockylinux9-cuda12:latest" + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Verify CUDA, Rust installation + run: | + nvcc --version + rustup show + - name: Load Rust cache + uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.variance.name }} + - name: Rustfmt + run: cargo fmt --all -- --check + - name: Clippy + env: + RUSTFLAGS: -Dwarnings + run: cargo clippy --workspace --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "add" --exclude "ex*" --exclude "cudnn*" + - name: Build + run: cargo build --workspace --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "add" --exclude "ex*" --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 "add" --exclude "ex*" --exclude "cudnn*" --exclude "cust_raw" diff --git a/.github/workflows/container_images.yml b/.github/workflows/container_images.yml new file mode 100644 index 00000000..9ac28419 --- /dev/null +++ b/.github/workflows/container_images.yml @@ -0,0 +1,74 @@ +name: Build CI Container Images + +on: + workflow_dispatch: + pull_request: + paths: + - ".github/workflows/container_images.yml" + - "container/**" + push: + paths: + - ".github/workflows/container_images.yml" + - "container/**" +env: + REGISTRY: ghcr.io +jobs: + build-images: + name: ${{ matrix.variance.name }} + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + attestations: write + id-token: write + strategy: + fail-fast: false + matrix: + variance: + - name: Ubuntu-22.04/CUDA-11.8.0 + image: "${{ github.repository }}-ubuntu22-cuda11" + dockerfile: ./container/ubuntu22-cuda11/Dockerfile + - name: Ubuntu-22.04/CUDA-12.8.1 + image: "${{ github.repository }}-ubuntu22-cuda12" + dockerfile: ./container/ubuntu22-cuda12/Dockerfile + - name: Ubuntu-24.04/CUDA-12.8.1 + image: "${{ github.repository }}-ubuntu24-cuda12" + dockerfile: ./container/ubuntu24-cuda12/Dockerfile + - name: RockyLinux-9/CUDA-12.8.1 + image: "${{ github.repository }}-rockylinux9-cuda12" + dockerfile: ./container/rockylinux9-cuda12/Dockerfile + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for containers + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ matrix.variance.image }} + tags: | + type=ref,event=branch + type=sha,format=short + type=raw,value=latest + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push container images + id: push + uses: docker/build-push-action@v6 + with: + context: . + file: ${{ matrix.variance.dockerfile }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + push: ${{ github.event_name != 'pull_request' }} + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v2 + with: + subject-name: ${{ env.REGISTRY }}/${{ matrix.variance.image }} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f9b65388..6397509d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -22,21 +22,6 @@ jobs: fail-fast: false matrix: include: - - os: ubuntu-20.04 - target: x86_64-unknown-linux-gnu - cuda: "11.2.2" - linux-local-args: ["--toolkit"] - sub-packages: [] - - os: ubuntu-24.04 - target: x86_64-unknown-linux-gnu - cuda: "12.8.1" - linux-local-args: ["--toolkit"] - sub-packages: [] - - os: windows-latest - target: x86_64-pc-windows-msvc - cuda: "11.2.2" - linux-local-args: [] - sub-packages: ["nvcc", "nvrtc", "nvrtc_dev", "cudart", "cublas", "cublas_dev", "curand", "curand_dev"] - os: windows-latest target: x86_64-pc-windows-msvc cuda: "12.8.1" @@ -61,12 +46,7 @@ jobs: - name: Verify CUDA installation run: nvcc --version - - name: List CUDA_PATH files (Linux) - if: runner.os == 'Linux' - run: find "$CUDA_PATH" -type f - - - name: List CUDA_PATH files (Windows) - if: runner.os == 'Windows' + - name: List CUDA_PATH files shell: pwsh run: Get-ChildItem -Path $env:CUDA_PATH -Recurse | ForEach-Object { $_.FullName } @@ -77,37 +57,11 @@ jobs: - name: Add rustup components run: rustup component add rustfmt clippy - - name: Install dependencies for LLVM 7 - if: matrix.os == 'ubuntu-24.04' - run: | - wget -O libffi7.deb http://security.ubuntu.com/ubuntu/pool/universe/libf/libffi7/libffi7_3.3-5ubuntu1_amd64.deb - sudo apt-get update - sudo apt-get install -y ./*.deb - sudo apt-get install -y liblzma-dev - sudo apt-get install -y libssl-dev - sudo apt-get install -y libcurl4-openssl-dev - - - name: Install LLVM 7 - if: contains(matrix.os, 'ubuntu') - run: | - mkdir -p ~/llvm7 && cd ~/llvm7 - wget http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/llvm-7_7.0.1-12_amd64.deb \ - http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/llvm-7-dev_7.0.1-12_amd64.deb \ - http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/libllvm7_7.0.1-12_amd64.deb \ - http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/llvm-7-runtime_7.0.1-12_amd64.deb - sudo apt-get update - sudo apt-get install -y ./*.deb - sudo ln -s /usr/bin/llvm-config-7 /usr/local/bin/llvm-config - - name: Load Rust Cache uses: Swatinem/rust-cache@v2.7.7 with: key: ${{ matrix.os }}-${{ matrix.target }}-${{ matrix.cuda }} - - name: Rustfmt - if: contains(matrix.os, 'ubuntu') - run: cargo fmt --all -- --check - - name: Build run: cargo build --workspace --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "add" --exclude "ex*" --exclude "cudnn*" @@ -115,12 +69,6 @@ jobs: # - name: Test # run: cargo test --workspace - - name: Clippy - if: contains(matrix.os, 'ubuntu') - env: - RUSTFLAGS: -Dwarnings - run: cargo clippy --workspace --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "add" --exclude "ex*" --exclude "cudnn*" - - name: Check documentation env: RUSTDOCFLAGS: -Dwarnings diff --git a/container/rockylinux9-cuda12/Dockerfile b/container/rockylinux9-cuda12/Dockerfile index 2f9205a9..af6b2f23 100644 --- a/container/rockylinux9-cuda12/Dockerfile +++ b/container/rockylinux9-cuda12/Dockerfile @@ -1,6 +1,7 @@ FROM nvidia/cuda:12.8.1-cudnn-devel-rockylinux9 RUN dnf -y install \ + clang \ openssl-devel \ pkgconfig \ redhat-rpm-config \ @@ -8,6 +9,15 @@ RUN dnf -y install \ xz \ zlib-devel +# Needed to build `path_tracer`, `optix/ex03_window` example +RUN dnf -y install \ + cmake \ + fontconfig-devel \ + libX11-devel \ + libXcursor-devel \ + libXi-devel \ + libXrandr-devel + # Get LLVM 7 & libffi.so.6 WORKDIR /data/llvm7 RUN curl -sSf -L -O https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/Packages/l/libffi3.1-3.1-36.el9.x86_64.rpm @@ -23,9 +33,10 @@ RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y ENV PATH="/root/.cargo/bin:${PATH}" # Setup the workspace -ADD . /data/Rust-CUDA +ADD ./rust-toolchain.toml /data/Rust-CUDA/ WORKDIR /data/Rust-CUDA RUN rustup show +RUN rm -f "rust-toolchain.toml" ENV LLVM_LINK_STATIC=1 ENV RUST_LOG=info \ No newline at end of file diff --git a/container/ubuntu20-cuda12/Dockerfile b/container/ubuntu22-cuda11/Dockerfile similarity index 71% rename from container/ubuntu20-cuda12/Dockerfile rename to container/ubuntu22-cuda11/Dockerfile index 51a9ab28..37ef1418 100644 --- a/container/ubuntu20-cuda12/Dockerfile +++ b/container/ubuntu22-cuda11/Dockerfile @@ -1,15 +1,26 @@ -FROM nvidia/cuda:12.8.1-cudnn-devel-ubuntu20.04 +FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04 RUN apt-get update RUN DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \ build-essential \ curl \ + clang \ libssl-dev \ libtinfo-dev \ pkg-config \ xz-utils \ zlib1g-dev +# Needed to build `path_tracer`, `optix/ex03_window` example +RUN DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \ + cmake \ + libfontconfig-dev \ + libx11-xcb-dev \ + libxcursor-dev \ + libxi-dev \ + libxinerama-dev \ + libxrandr-dev + # Get LLVM 7 WORKDIR /data/llvm7 RUN curl -sSf -L -O http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/llvm-7_7.0.1-12_amd64.deb @@ -24,9 +35,10 @@ RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y ENV PATH="/root/.cargo/bin:${PATH}" # Setup the workspace -ADD . /data/Rust-CUDA +ADD ./rust-toolchain.toml /data/Rust-CUDA/ WORKDIR /data/Rust-CUDA RUN rustup show +RUN rm -f "rust-toolchain.toml" ENV LLVM_LINK_STATIC=1 ENV RUST_LOG=info \ No newline at end of file diff --git a/container/ubuntu20-cuda11/Dockerfile b/container/ubuntu22-cuda12/Dockerfile similarity index 71% rename from container/ubuntu20-cuda11/Dockerfile rename to container/ubuntu22-cuda12/Dockerfile index baeb1826..cc660ef2 100644 --- a/container/ubuntu20-cuda11/Dockerfile +++ b/container/ubuntu22-cuda12/Dockerfile @@ -1,15 +1,26 @@ -FROM nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04 +FROM nvidia/cuda:12.8.1-cudnn-devel-ubuntu22.04 RUN apt-get update RUN DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \ build-essential \ curl \ + clang \ libssl-dev \ libtinfo-dev \ pkg-config \ xz-utils \ zlib1g-dev +# Needed to build `path_tracer`, `optix/ex03_window` example +RUN DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \ + cmake \ + libfontconfig-dev \ + libx11-xcb-dev \ + libxcursor-dev \ + libxi-dev \ + libxinerama-dev \ + libxrandr-dev + # Get LLVM 7 WORKDIR /data/llvm7 RUN curl -sSf -L -O http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/llvm-7_7.0.1-12_amd64.deb @@ -24,9 +35,10 @@ RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y ENV PATH="/root/.cargo/bin:${PATH}" # Setup the workspace -ADD . /data/Rust-CUDA +ADD ./rust-toolchain.toml /data/Rust-CUDA/ WORKDIR /data/Rust-CUDA RUN rustup show +RUN rm -f "rust-toolchain.toml" ENV LLVM_LINK_STATIC=1 ENV RUST_LOG=info \ No newline at end of file diff --git a/container/ubuntu24-cuda12/Dockerfile b/container/ubuntu24-cuda12/Dockerfile index f2cc618c..29d5f104 100644 --- a/container/ubuntu24-cuda12/Dockerfile +++ b/container/ubuntu24-cuda12/Dockerfile @@ -3,6 +3,7 @@ FROM nvidia/cuda:12.8.1-cudnn-devel-ubuntu24.04 RUN apt-get update RUN DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \ build-essential \ + clang \ curl \ libssl-dev \ libtinfo-dev \ @@ -10,6 +11,16 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \ xz-utils \ zlib1g-dev +# Needed to build `path_tracer`, `optix/ex03_window` example +RUN DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \ + cmake \ + libfontconfig-dev \ + libx11-xcb-dev \ + libxcursor-dev \ + libxi-dev \ + libxinerama-dev \ + libxrandr-dev + # Get LLVM 7 & libffi7 WORKDIR /data/llvm7 RUN curl -sSf -L -O http://security.ubuntu.com/ubuntu/pool/universe/libf/libffi7/libffi7_3.3-5ubuntu1_amd64.deb @@ -25,9 +36,10 @@ RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y ENV PATH="/root/.cargo/bin:${PATH}" # Setup the workspace -ADD . /data/Rust-CUDA +ADD ./rust-toolchain.toml /data/Rust-CUDA/ WORKDIR /data/Rust-CUDA RUN rustup show +RUN rm -f "rust-toolchain.toml" ENV LLVM_LINK_STATIC=1 ENV RUST_LOG=info \ No newline at end of file diff --git a/rust-toolchain b/rust-toolchain deleted file mode 100644 index 78e5dc58..00000000 --- a/rust-toolchain +++ /dev/null @@ -1,9 +0,0 @@ -# If you see this, run `rustup self update` to get rustup 1.23 or newer. - -# NOTE: above comment is for older `rustup` (before TOML support was added), -# which will treat the first line as the toolchain name, and therefore show it -# to the user in the error, instead of "error: invalid channel name '[toolchain]'". - -[toolchain] -channel = "nightly-2025-03-02" -components = ["rust-src", "rustc-dev", "llvm-tools-preview"] \ No newline at end of file diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 00000000..5fd1c0ae --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "nightly-2025-03-02" +components = ["clippy", "llvm-tools-preview", "rust-src", "rustc-dev", "rustfmt"] \ No newline at end of file