Skip to content

Commit 2e4b777

Browse files
committed
Merge branch 'main' into fix-cudnn-windows-cudnn-paths
2 parents 8512903 + c83adae commit 2e4b777

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

.github/workflows/ci_windows.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,8 @@ jobs:
106106
run: cargo build --all-features -p cust_raw
107107

108108
# Exclude crates that require cuDNN, not available on Windows CI: cudnn, cudnn-sys.
109-
# Exclude vecadd because of a link error involving nanorand and `SystemFunction036` (a.k.a.
110-
# `RtlGenRandom`).
111109
- name: Build workspace
112-
run: cargo build --workspace --exclude cudnn --exclude cudnn-sys --exclude "vecadd*"
110+
run: cargo build --workspace --exclude cudnn --exclude cudnn-sys
113111

114112
# Exclude crates that require cuDNN, not available on Windows CI: cudnn, cudnn-sys.
115113
- name: Clippy

crates/cust/src/module.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,12 @@ impl Module {
418418
}
419419
}
420420

421+
// Get the inner `CUmodule` from the `Module`. If you use this handle elsewhere,
422+
// make sure not to use it after the module has been dropped. Or ManuallyDrop the struct to be safe.
423+
pub fn as_inner(&self) -> driver_sys::CUmodule {
424+
self.inner
425+
}
426+
421427
/// Destroy a `Module`, returning an error.
422428
///
423429
/// Destroying a module can return errors from previous asynchronous work. This function

examples/vecadd/build.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ use std::path;
44
use cuda_builder::CudaBuilder;
55

66
fn main() {
7+
// On Windows, nanorand's entropy uses SystemFunction036 (RtlGenRandom) from advapi32.
8+
// Explicitly link it so the MSVC linker resolves the symbol (avoids LNK2019 when
9+
// mixing CRTs or with certain link orders).
10+
#[cfg(target_os = "windows")]
11+
println!("cargo:rustc-link-lib=advapi32");
12+
713
println!("cargo::rerun-if-changed=build.rs");
814
println!("cargo::rerun-if-changed=kernels");
915

0 commit comments

Comments
 (0)