Skip to content

Commit 032361a

Browse files
chore(example): add nvvm library path to LD_LIBRARY_PATH and add back the add example in CI (#190)
When linking `libnvvm.so.4` into `librustc_codegen_nvvm.so` shared library via the `cust_raw` package, we specified the following parameters in the `build.rs`: - cargo::rustc-link-search=native=xxx - cargo::rustc-link-lib=dylib=nvvm According to the [Cargo documentation](https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-search), the path we added to the `rustc-link-search` parameter is not further populated to the `LD_LIBRARY_PATH` for search by the transitive dependencies. > These paths are also added to the dynamic library search path > environment variable if they are within the OUT_DIR. The behavior is intended to be limited to the OUT_DIR so the `libnvvm.so.4`, which lives as a part of the CUDA SDK, is excluded. Therefore, we must add it to the LD_LIBRARY_PATH manually in our container build stage.
1 parent 295459d commit 032361a

File tree

5 files changed

+15
-3
lines changed

5 files changed

+15
-3
lines changed

.github/workflows/ci_linux.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ jobs:
4444
- name: Clippy
4545
env:
4646
RUSTFLAGS: -Dwarnings
47-
run: cargo clippy --workspace --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "add" --exclude "ex*" --exclude "cudnn*"
47+
run: cargo clippy --workspace --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "ex*" --exclude "cudnn*"
4848
- name: Build
49-
run: cargo build --workspace --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "add" --exclude "ex*" --exclude "cudnn*"
49+
run: cargo build --workspace --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "ex*" --exclude "cudnn*"
5050
- name: Check documentation
5151
env:
5252
RUSTDOCFLAGS: -Dwarnings
53-
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"
53+
run: cargo doc --workspace --all-features --document-private-items --no-deps --exclude "optix*" --exclude "path_tracer" --exclude "denoiser" --exclude "ex*" --exclude "cudnn*" --exclude "cust_raw"

container/rockylinux9-cuda12/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,8 @@ WORKDIR /data/Rust-CUDA
3838
RUN rustup show
3939
RUN rm -f "rust-toolchain.toml"
4040

41+
# Add nvvm to LD_LIBRARY_PATH.
42+
ENV LD_LIBRARY_PATH="/usr/local/cuda/nvvm/lib64:${LD_LIBRARY_PATH}"
43+
4144
ENV LLVM_LINK_STATIC=1
4245
ENV RUST_LOG=info

container/ubuntu22-cuda11/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,8 @@ WORKDIR /data/Rust-CUDA
4040
RUN rustup show
4141
RUN rm -f "rust-toolchain.toml"
4242

43+
# Add nvvm to LD_LIBRARY_PATH.
44+
ENV LD_LIBRARY_PATH="/usr/local/cuda/nvvm/lib64:${LD_LIBRARY_PATH}"
45+
4346
ENV LLVM_LINK_STATIC=1
4447
ENV RUST_LOG=info

container/ubuntu22-cuda12/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,8 @@ WORKDIR /data/Rust-CUDA
4040
RUN rustup show
4141
RUN rm -f "rust-toolchain.toml"
4242

43+
# Add nvvm to LD_LIBRARY_PATH.
44+
ENV LD_LIBRARY_PATH="/usr/local/cuda/nvvm/lib64:${LD_LIBRARY_PATH}"
45+
4346
ENV LLVM_LINK_STATIC=1
4447
ENV RUST_LOG=info

container/ubuntu24-cuda12/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,8 @@ WORKDIR /data/Rust-CUDA
4141
RUN rustup show
4242
RUN rm -f "rust-toolchain.toml"
4343

44+
# Add nvvm to LD_LIBRARY_PATH.
45+
ENV LD_LIBRARY_PATH="/usr/local/cuda/nvvm/lib64:${LD_LIBRARY_PATH}"
46+
4447
ENV LLVM_LINK_STATIC=1
4548
ENV RUST_LOG=info

0 commit comments

Comments
 (0)