Skip to content

Commit 296eb22

Browse files
eliothedemanfacebook-github-bot
authored andcommitted
disable cuda on macos (#952)
Summary: Pull Request resolved: #952 This diff disables CUDA on MacOS by modifying the build.rs files of the Monarch library. The changes include adding a main function that does nothing for MacOS and modifying the build.rs files for nccl-sys, rdmaxcel-sys, and torch-sys-cuda to exclude MacOS. The changes are necessary because CUDA is not supported on MacOS. Reviewed By: shayne-fletcher Differential Revision: D80573844 fbshipit-source-id: b4a78d51881a9a7ac924f283749033bfb40e7100
1 parent 51a5bef commit 296eb22

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

cuda-sys/build.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ fn validate_cuda_installation() -> String {
132132
cuda_home
133133
}
134134

135+
#[cfg(target_os = "macos")]
136+
fn main() {}
137+
138+
#[cfg(not(target_os = "macos"))]
135139
fn main() {
136140
// Validate CUDA installation and get CUDA home path
137141
let cuda_home = validate_cuda_installation();

nccl-sys/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ fn python_env_dirs() -> (Option<String>, Option<String>) {
7777
}
7878
(include_dir, lib_dir)
7979
}
80+
#[cfg(target_os = "macos")]
81+
fn main() {}
8082

83+
#[cfg(not(target_os = "macos"))]
8184
fn main() {
8285
let mut builder = bindgen::Builder::default()
8386
// Parse nccl.h as C++ with -std=gnu++20.

rdmaxcel-sys/build.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ fn validate_cuda_installation() -> String {
132132
cuda_home
133133
}
134134

135+
#[cfg(target_os = "macos")]
136+
fn main() {}
137+
138+
#[cfg(not(target_os = "macos"))]
135139
fn main() {
136140
// Tell cargo to look for shared libraries in the specified directory
137141
println!("cargo:rustc-link-search=/usr/lib");

torch-sys-cuda/build.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ fn get_env_var_with_rerun(name: &str) -> Result<String, std::env::VarError> {
4242
std::env::var(name)
4343
}
4444

45+
#[cfg(target_os = "macos")]
46+
fn main() {}
47+
48+
#[cfg(not(target_os = "macos"))]
4549
fn main() {
4650
let mut libtorch_include_dirs: Vec<PathBuf> = vec![];
4751
let mut libtorch_lib_dir: Option<PathBuf> = None;

0 commit comments

Comments
 (0)