Skip to content

Commit

Permalink
fix some path issues
Browse files Browse the repository at this point in the history
  • Loading branch information
maxtremblay committed Jan 15, 2025
1 parent 661f431 commit 839f993
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
14 changes: 10 additions & 4 deletions crates/cubecl-cuda/src/compute/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,10 +470,16 @@ fn cuda_path() -> Option<PathBuf> {
#[cfg(target_os = "linux")]
{
// If it is installed as part of the distribution
if std::fs::metadata("/usr/bin/nvcc").is_ok() {
return Some(PathBuf::from("/usr"));
}
return Some(PathBuf::from("/usr/local/cuda"));
return if std::fs::exists("/usr/local/cuda").is_ok_and(|exists| exists) {
Some(PathBuf::from("/usr/local/cuda"))
} else if std::fs::exists("/opt/cuda").is_ok_and(|exists| exists) {
Some(PathBuf::from("/opt/cuda"))
} else if std::fs::exists("/usr/bin/nvcc").is_ok_and(|exists| exists) {
// Maybe the compiler was installed within the user path.
Some(PathBuf::from("/usr"))
} else {
None
};
}

#[cfg(target_os = "windows")]
Expand Down
9 changes: 7 additions & 2 deletions xtask/src/commands/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,17 @@ impl Profile {
let bins = get_benches(&options.bench);
let bin = bins.first().unwrap().as_path().to_str().unwrap();
let file = format!("target/{}", options.bench);

let ncu_bin_path = std::process::Command::new("which")
.arg(&options.ncu_path)
.output()
.map_err(|_| ())
.and_then(|output| String::from_utf8(output.stdout).map_err(|_| ()))
.expect("Can't find ncu. Verified that it is installed.");
run_process(
"sudo",
&[
"BENCH_NUM_SAMPLES=1",
&options.ncu_path,
ncu_bin_path.trim(),
"--nvtx",
"--set=full",
"--call-stack",
Expand Down

0 comments on commit 839f993

Please sign in to comment.