Skip to content

Commit 1da1c03

Browse files
author
Montana Low
committed
intel/m1 compatibility
1 parent f81944d commit 1da1c03

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/booster.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl Booster {
148148
dmats
149149
};
150150

151-
let mut bst = Booster::new_with_cached_dmats(&params.booster_params, &cached_dmats)?;
151+
let bst = Booster::new_with_cached_dmats(&params.booster_params, &cached_dmats)?;
152152
for i in 0..params.boost_rounds as i32 {
153153
if let Some(eval_sets) = params.evaluation_sets {
154154
let mut dmat_eval_results = bst.eval_set(eval_sets, i)?;

xgboost-sys/build.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,21 @@ fn main() {
3333
#[cfg(not(feature = "cuda"))]
3434
let mut dst = Config::new(&xgb_root);
3535

36-
let dst = dst.uses_cxx11()
36+
let mut dst = dst.uses_cxx11()
3737
.define("BUILD_STATIC_LIB", "ON");
3838

3939
#[cfg(target_os = "macos")]
40-
let dst =
41-
dst
42-
.define("CMAKE_C_COMPILER", "/opt/homebrew/opt/llvm/bin/clang")
43-
.define("CMAKE_CXX_COMPILER", "/opt/homebrew/opt/llvm/bin/clang++")
44-
.define("OPENMP_LIBRARIES", "/opt/homebrew/opt/llvm/lib")
45-
.define("OPENMP_INCLUDES", "/opt/homebrew/opt/llvm/include");
46-
40+
{
41+
let path = PathBuf::from("/opt/homebrew/"); // check for m1 vs intel config
42+
if let Ok(_dir) = std::fs::read_dir(&path) {
43+
dst =
44+
dst
45+
.define("CMAKE_C_COMPILER", "/opt/homebrew/opt/llvm/bin/clang")
46+
.define("CMAKE_CXX_COMPILER", "/opt/homebrew/opt/llvm/bin/clang++")
47+
.define("OPENMP_LIBRARIES", "/opt/homebrew/opt/llvm/lib")
48+
.define("OPENMP_INCLUDES", "/opt/homebrew/opt/llvm/include");
49+
};
50+
}
4751
let dst = dst.build();
4852

4953
let xgb_root = xgb_root.canonicalize().unwrap();

0 commit comments

Comments
 (0)