Skip to content

Commit

Permalink
[CI] Improve CI for Mac M1 (#9748)
Browse files Browse the repository at this point in the history
* [CI] Improve CI for Mac M1

* Add -v flag

* Disable OpenMP in libxgboost4j.dylib

* Target MacOS 10.15+ to use C++17
  • Loading branch information
hcho3 authored Nov 1, 2023
1 parent d3f0646 commit 1b9ed4a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
message(FATAL_ERROR "Need Clang 9.0 or newer to build XGBoost")
endif()
endif()
if(APPLE)
set(CMAKE_MACOSX_DEPLOYMENT_TARGET 10.15)
endif()

include(${xgboost_SOURCE_DIR}/cmake/PrefetchIntrinsics.cmake)
find_prefetch_intrinsics()
Expand Down
19 changes: 11 additions & 8 deletions tests/buildkite/test-macos-m1-clang11.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ sysctl -n machdep.cpu.brand_string
uname -m
set +x

# Create new Conda env
echo "--- Set up Conda env"
. $HOME/mambaforge/etc/profile.d/conda.sh
. $HOME/mambaforge/etc/profile.d/mamba.sh
conda_env=xgboost_dev_$(uuidgen | tr '[:upper:]' '[:lower:]' | tr -d '-')
mamba create -y -n ${conda_env} python=3.8
conda activate ${conda_env}
mamba env update -n ${conda_env} --file tests/ci_build/conda_env/macos_cpu_test.yml
# Build XGBoost4J binary
echo "--- Build libxgboost4j.dylib"
set -x
mkdir build
pushd build
export JAVA_HOME=$(/usr/libexec/java_home)
cmake .. -GNinja -DJVM_BINDINGS=ON -DUSE_OPENMP=OFF
ninja -v
popd
rm -rf build
set +x

# Ensure that XGBoost can be built with Clang 11
echo "--- Build and Test XGBoost with MacOS M1, Clang 11"
Expand Down

0 comments on commit 1b9ed4a

Please sign in to comment.