From 86da83e6c0c4645897889c6f0f7e65699f51f5be Mon Sep 17 00:00:00 2001 From: Christian Legnitto Date: Tue, 15 Apr 2025 17:38:04 -0400 Subject: [PATCH 01/10] Add a custom no-op cargo test runner --- .ci/cargo_glue.sh | 11 +++++++++++ .ci/config.toml | 8 ++++++++ .github/workflows/ci_linux.yml | 3 ++- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 .ci/cargo_glue.sh create mode 100644 .ci/config.toml diff --git a/.ci/cargo_glue.sh b/.ci/cargo_glue.sh new file mode 100644 index 0000000..727b6a1 --- /dev/null +++ b/.ci/cargo_glue.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +# This script is used by cargo to run the test runner with the +# specified arguments. +# +# We need this script because the cwd that cargo runs the runner in changes +# depending on crate. + +cd "$GITHUB_WORKSPACE/.ci/; +echo "In glue script with cwd: $(pwd)" diff --git a/.ci/config.toml b/.ci/config.toml new file mode 100644 index 0000000..d860b86 --- /dev/null +++ b/.ci/config.toml @@ -0,0 +1,8 @@ +[target.x86_64-unknown-linux-gnu] +# The command to execute instead of the compiled test binary. Cargo will append the +# actual path to the compiled test executable and any arguments (like --list, --exact, +# --nocapture) after this command. +# We use a tool without a slash in it so cargo will search $PATH. +# +# Before calling the `cargo test` we append the location of the glue to the path. +runner = ["cargo_glue.sh"] diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index 45ea255..f16ed26 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -152,4 +152,5 @@ jobs: MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }} MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }} run: | - echo "Stubbed out" + export PATH="$PATH:$GITHUB_WORKSPACE/.ci" + cargo --config .ci/config.toml test --workspace --exclude "optix" --exclude "path_tracer" --exclude "denoiser" --exclude "add" --exclude "ex*" From f4eaab489db2e0118e584772145c2b66c10a9d04 Mon Sep 17 00:00:00 2001 From: Christian Legnitto Date: Tue, 15 Apr 2025 17:40:40 -0400 Subject: [PATCH 02/10] Output args so we can see --- .ci/cargo_glue.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/cargo_glue.sh b/.ci/cargo_glue.sh index 727b6a1..e1da206 100644 --- a/.ci/cargo_glue.sh +++ b/.ci/cargo_glue.sh @@ -9,3 +9,4 @@ set -e cd "$GITHUB_WORKSPACE/.ci/; echo "In glue script with cwd: $(pwd)" +echo "Got args: $@" From eecebdc8d04e6c1611e0c0da5ac7a5a33653523d Mon Sep 17 00:00:00 2001 From: Christian Legnitto Date: Tue, 15 Apr 2025 19:33:14 -0400 Subject: [PATCH 03/10] Install rust when testing --- .github/workflows/ci_linux.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index f16ed26..854205a 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -147,6 +147,10 @@ jobs: - name: List downloaded files run: ls -lR ${{ needs.build.outputs.artifact_path }} + # random command that forces rustup to install stuff in rust-toolchain + - name: Install rust-toolchain + run: cargo version + - name: Run remote tests env: MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }} From 52bd24e03f1d67140425321df435da5e058c6e75 Mon Sep 17 00:00:00 2001 From: Christian Legnitto Date: Tue, 15 Apr 2025 19:45:27 -0400 Subject: [PATCH 04/10] Checkout repo --- .github/workflows/ci_linux.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index 854205a..a31bf75 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -147,10 +147,13 @@ jobs: - name: List downloaded files run: ls -lR ${{ needs.build.outputs.artifact_path }} + - name: Checkout repository + uses: actions/checkout@v4 + # random command that forces rustup to install stuff in rust-toolchain - name: Install rust-toolchain run: cargo version - + - name: Run remote tests env: MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }} From 35024c4f940e8f3892fdf22c1bfecdc56399d89f Mon Sep 17 00:00:00 2001 From: Christian Legnitto Date: Tue, 15 Apr 2025 19:58:14 -0400 Subject: [PATCH 05/10] Make checkout first Otherwise it deletes the downloaded artifacts --- .github/workflows/ci_linux.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index a31bf75..8d93cea 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -138,6 +138,13 @@ jobs: - 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 + + # random command that forces rustup to install stuff in rust-toolchain + - name: Install rust-toolchain + run: cargo version + - name: Download build artifacts uses: actions/download-artifact@v4 with: @@ -147,13 +154,6 @@ jobs: - name: List downloaded files run: ls -lR ${{ needs.build.outputs.artifact_path }} - - name: Checkout repository - uses: actions/checkout@v4 - - # random command that forces rustup to install stuff in rust-toolchain - - name: Install rust-toolchain - run: cargo version - - name: Run remote tests env: MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }} From 036b070f0762f06448aa56af75ad822d20f05090 Mon Sep 17 00:00:00 2001 From: Christian Legnitto Date: Tue, 15 Apr 2025 20:26:29 -0400 Subject: [PATCH 06/10] Add correct excludes --- .github/workflows/ci_linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index 8d93cea..2e13363 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -160,4 +160,4 @@ jobs: MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }} run: | export PATH="$PATH:$GITHUB_WORKSPACE/.ci" - cargo --config .ci/config.toml test --workspace --exclude "optix" --exclude "path_tracer" --exclude "denoiser" --exclude "add" --exclude "ex*" + cargo --config .ci/config.toml test --workspace --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "ex*" --exclude "cudnn*" From fc00ed720f9a9ee0fda062502b693871c2857c3f Mon Sep 17 00:00:00 2001 From: Christian Legnitto Date: Tue, 15 Apr 2025 20:56:22 -0400 Subject: [PATCH 07/10] Make glue script executable --- .ci/cargo_glue.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 .ci/cargo_glue.sh diff --git a/.ci/cargo_glue.sh b/.ci/cargo_glue.sh old mode 100644 new mode 100755 From 53c8400a8567e35435929bb25a354dda21459c86 Mon Sep 17 00:00:00 2001 From: Christian Legnitto Date: Tue, 15 Apr 2025 21:12:03 -0400 Subject: [PATCH 08/10] Fix glue code quotes --- .ci/cargo_glue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/cargo_glue.sh b/.ci/cargo_glue.sh index e1da206..cc424b5 100755 --- a/.ci/cargo_glue.sh +++ b/.ci/cargo_glue.sh @@ -7,6 +7,6 @@ set -e # We need this script because the cwd that cargo runs the runner in changes # depending on crate. -cd "$GITHUB_WORKSPACE/.ci/; +cd "$GITHUB_WORKSPACE/.ci/" echo "In glue script with cwd: $(pwd)" echo "Got args: $@" From 1c558b2e381e7562e354b0cebc226b057644ce49 Mon Sep 17 00:00:00 2001 From: Christian Legnitto Date: Wed, 16 Apr 2025 09:06:35 -0400 Subject: [PATCH 09/10] Use CARGO_MANIFEST_DIR for add example build script --- examples/cuda/cpu/add/build.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/cuda/cpu/add/build.rs b/examples/cuda/cpu/add/build.rs index bb96d32..a0c6ee1 100644 --- a/examples/cuda/cpu/add/build.rs +++ b/examples/cuda/cpu/add/build.rs @@ -1,8 +1,10 @@ use cuda_builder::CudaBuilder; fn main() { - CudaBuilder::new("../../gpu/add_gpu") - .copy_to("../../resources/add.ptx") + let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR exists"); + let manifest_dir = std::path::Path::new(&manifest_dir); + CudaBuilder::new(manifest_dir.join("../../gpu/add_gpu")) + .copy_to(manifest_dir.join("../../resources/add.ptx")) .build() .unwrap(); } From d98089dd32b359af98afefd3170bf2f8f848d451 Mon Sep 17 00:00:00 2001 From: Christian Legnitto Date: Wed, 16 Apr 2025 09:31:10 -0400 Subject: [PATCH 10/10] Exclude blastoff for now --- .github/workflows/ci_linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index 2e13363..8cf8a7b 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -160,4 +160,4 @@ jobs: MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }} run: | export PATH="$PATH:$GITHUB_WORKSPACE/.ci" - cargo --config .ci/config.toml test --workspace --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "ex*" --exclude "cudnn*" + cargo --config .ci/config.toml test --workspace --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "ex*" --exclude "cudnn*" --exclude "blastoff"