ryankert01 commented on code in PR #1321:
URL: https://github.com/apache/mahout/pull/1321#discussion_r3265910589
##########
qdp/qdp-core/build.rs:
##########
@@ -34,3 +42,54 @@ fn main() {
println!("cargo:rerun-if-changed=proto/tensor.proto");
}
+
+/// Detect the CUDA Runtime toolkit and emit the appropriate link directives.
+///
+/// `qdp-core` declares CUDA Runtime API extern symbols in
`src/gpu/cuda_ffi.rs`
+/// (cudaHostAlloc, cudaMemGetInfo, cudaEventCreateWithFlags, ...). Those
symbols
+/// must be resolved at link time, which requires `libcudart` from the CUDA
+/// Toolkit. Previously the only `-lcudart` directive lived in `qdp-kernels`'
+/// build script, and the `qdp_no_cuda` cfg it sets does not propagate
+/// cross-crate. The result was confusing linker errors on systems that have
+/// the NVIDIA driver but not the toolkit (e.g. PyTorch-only setups, where
+/// PyTorch ships its own bundled cudart inside the wheel).
+///
+/// This function:
+/// * emits `cargo:rustc-link-lib=cudart` and the appropriate
+/// `cargo:rustc-link-search` path when nvcc is found, and
+/// * emits `cargo:rustc-cfg=qdp_no_cuda` when it is not, gating the
Review Comment:
`output().is_ok()` is true even if nvcc exits non-zero — a half-installed
nvcc would set `has_cuda = true` and fall through to a link error. Suggest
`.map(|o| o.status.success()).unwrap_or(false)`. Same idiom in
`qdp-kernels/build.rs:177`; fix both so they can't disagree.
##########
qdp/qdp-core/build.rs:
##########
@@ -34,3 +42,54 @@ fn main() {
println!("cargo:rerun-if-changed=proto/tensor.proto");
}
+
+/// Detect the CUDA Runtime toolkit and emit the appropriate link directives.
+///
+/// `qdp-core` declares CUDA Runtime API extern symbols in
`src/gpu/cuda_ffi.rs`
+/// (cudaHostAlloc, cudaMemGetInfo, cudaEventCreateWithFlags, ...). Those
symbols
+/// must be resolved at link time, which requires `libcudart` from the CUDA
Review Comment:
Missing `cargo:rerun-if-env-changed=PATH`. The whole decision hinges on
nvcc-on-PATH, so installing CUDA after a stub build won't re-trigger the script
until `cargo clean`. Same gap in qdp-kernels.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]