Skip to content

Commit

Permalink
intel/m1 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Montana Low committed Apr 29, 2024
1 parent f81944d commit 1da1c03
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/booster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl Booster {
dmats
};

let mut bst = Booster::new_with_cached_dmats(&params.booster_params, &cached_dmats)?;
let bst = Booster::new_with_cached_dmats(&params.booster_params, &cached_dmats)?;
for i in 0..params.boost_rounds as i32 {
if let Some(eval_sets) = params.evaluation_sets {
let mut dmat_eval_results = bst.eval_set(eval_sets, i)?;
Expand Down
20 changes: 12 additions & 8 deletions xgboost-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,21 @@ fn main() {
#[cfg(not(feature = "cuda"))]
let mut dst = Config::new(&xgb_root);

let dst = dst.uses_cxx11()
let mut dst = dst.uses_cxx11()
.define("BUILD_STATIC_LIB", "ON");

#[cfg(target_os = "macos")]
let dst =
dst
.define("CMAKE_C_COMPILER", "/opt/homebrew/opt/llvm/bin/clang")
.define("CMAKE_CXX_COMPILER", "/opt/homebrew/opt/llvm/bin/clang++")
.define("OPENMP_LIBRARIES", "/opt/homebrew/opt/llvm/lib")
.define("OPENMP_INCLUDES", "/opt/homebrew/opt/llvm/include");

{
let path = PathBuf::from("/opt/homebrew/"); // check for m1 vs intel config
if let Ok(_dir) = std::fs::read_dir(&path) {
dst =
dst
.define("CMAKE_C_COMPILER", "/opt/homebrew/opt/llvm/bin/clang")
.define("CMAKE_CXX_COMPILER", "/opt/homebrew/opt/llvm/bin/clang++")
.define("OPENMP_LIBRARIES", "/opt/homebrew/opt/llvm/lib")
.define("OPENMP_INCLUDES", "/opt/homebrew/opt/llvm/include");
};
}
let dst = dst.build();

let xgb_root = xgb_root.canonicalize().unwrap();
Expand Down

0 comments on commit 1da1c03

Please sign in to comment.