From 8418154ee0cade8b9aebc22750c7717eb273b65d Mon Sep 17 00:00:00 2001 From: emka Date: Sun, 3 Dec 2023 17:01:16 +0100 Subject: Add nvcc ccbin support to examples (#1401) --- candle-examples/build.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'candle-examples') diff --git a/candle-examples/build.rs b/candle-examples/build.rs index b3c17cc3..0af3a6a4 100644 --- a/candle-examples/build.rs +++ b/candle-examples/build.rs @@ -32,6 +32,8 @@ impl KernelDirectories { if should_compile { #[cfg(feature = "cuda")] { + let ccbin_env = std::env::var("CANDLE_NVCC_CCBIN"); + println!("cargo:rerun-if-env-changed=CANDLE_NVCC_CCBIN"); let mut command = std::process::Command::new("nvcc"); let out_dir = ptx_file.parent().context("no parent for ptx file")?; let include_dirs: Vec = @@ -44,6 +46,11 @@ impl KernelDirectories { .arg(format!("-I/{}", self.kernel_dir)) .args(include_dirs) .arg(cu_file); + if let Ok(ccbin_path) = &ccbin_env { + command + .arg("-allow-unsupported-compiler") + .args(["-ccbin", ccbin_path]); + } let output = command .spawn() .context("failed spawning nvcc")? -- cgit v1.2.3