Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Add CI pipeline to build libxgboost4j.so targeting Linux ARM64 #10487

Merged
merged 8 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions dev/prepare_jvm_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def main():
print("====Creating directories to hold native binaries====")
for os_ident, arch in [
("linux", "x86_64"),
("linux", "aarch64"),
("windows", "x86_64"),
("macos", "x86_64"),
("macos", "aarch64"),
Expand All @@ -156,6 +157,10 @@ def main():
url=f"{nightly_bucket_prefix}/{git_branch}/libxgboost4j/xgboost4j_{commit_hash}.dll",
filename="xgboost4j/src/main/resources/lib/windows/x86_64/xgboost4j.dll",
)
retrieve(
url=f"{nightly_bucket_prefix}/{git_branch}/libxgboost4j/libxgboost4j_linux_arm64_{commit_hash}.so",
filename="xgboost4j/src/main/resources/lib/linux/aarch64/libxgboost4j.so",
)
retrieve(
url=f"{nightly_bucket_prefix}/{git_branch}/libxgboost4j/libxgboost4j_{commit_hash}.dylib",
filename="xgboost4j/src/main/resources/lib/macos/x86_64/libxgboost4j.dylib",
Expand Down
28 changes: 28 additions & 0 deletions tests/buildkite/build-jvm-linux-arm64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

set -euo pipefail

source tests/buildkite/conftest.sh

command_wrapper="tests/ci_build/ci_build.sh aarch64"

# Build XGBoost4J binary
echo "--- Build libxgboost4j.so"
set -x
mkdir build
$command_wrapper bash -c \
"cd build && cmake .. -GNinja -DJVM_BINDINGS=ON -DUSE_OPENMP=ON && ninja -v"
ldd lib/libxgboost4j.so

echo "--- Upload libxgboost4j.dylib"
hcho3 marked this conversation as resolved.
Show resolved Hide resolved
pushd lib
libname=libxgboost4j_linux_arm64_${BUILDKITE_COMMIT}.so
mv -v libxgboost4j.so ${libname}
buildkite-agent artifact upload ${libname}
#if [[ ($is_pull_request == 0) && ($is_release_branch == 1) ]]
#then
aws s3 cp ${libname} \
s3://xgboost-nightly-builds/${BRANCH_NAME}/libxgboost4j/ \
--acl public-read --no-progress
#fi
popd
41 changes: 41 additions & 0 deletions tests/buildkite/build-jvm-macos-m1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

set -euo pipefail

source tests/buildkite/conftest.sh

# Display system info
echo "--- Display system information"
set -x
system_profiler SPSoftwareDataType
sysctl -n machdep.cpu.brand_string
uname -m
set +x

# 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=ON -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15
ninja -v
popd
rm -rf build
otool -L lib/libxgboost.dylib
set +x

echo "--- Upload libxgboost4j.dylib"
set -x
pushd lib
libname=libxgboost4j_m1_${BUILDKITE_COMMIT}.dylib
mv -v libxgboost4j.dylib ${libname}
buildkite-agent artifact upload ${libname}
#if [[ ($is_pull_request == 0) && ($is_release_branch == 1) ]]
#then
aws s3 cp ${libname} \
s3://xgboost-nightly-builds/${BRANCH_NAME}/libxgboost4j/ \
--acl public-read --no-progress
#fi
popd
set +x
5 changes: 5 additions & 0 deletions tests/buildkite/pipeline-mac-m1.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
steps:
- block: ":rocket: Run this test job"
if: build.pull_request.id != null || build.branch =~ /^dependabot\//
- label: ":macos: Build libxgboost4j.dylib for MacOS M1"
command: "tests/buildkite/build-jvm-macos-m1.sh"
key: mac-m1-jvm
agents:
queue: mac-mini-m1
- label: ":macos: Build and Test XGBoost for MacOS M1 with Clang 11"
command: "tests/buildkite/test-macos-m1-clang11.sh"
key: mac-m1-appleclang11
Expand Down
5 changes: 5 additions & 0 deletions tests/buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ steps:
key: build-jvm-packages
agents:
queue: linux-amd64-cpu
- label: ":console: Build libxgboost4j.so for Linux ARM64"
command: "tests/buildkite/build-jvm-linux-arm64.sh"
key: build-jvm-linux-arm64
agents:
queue: linux-arm64-cpu
- label: ":console: Build JVM package doc"
command: "tests/buildkite/build-jvm-doc.sh"
key: build-jvm-doc
Expand Down
28 changes: 1 addition & 27 deletions tests/buildkite/test-macos-m1-clang11.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,6 @@ sysctl -n machdep.cpu.brand_string
uname -m
set +x

# 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=ON -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15
ninja -v
popd
rm -rf build
otool -L lib/libxgboost.dylib
set +x

echo "--- Upload Python wheel"
set -x
pushd lib
mv -v libxgboost4j.dylib libxgboost4j_m1_${BUILDKITE_COMMIT}.dylib
buildkite-agent artifact upload libxgboost4j_m1_${BUILDKITE_COMMIT}.dylib
if [[ ($is_pull_request == 0) && ($is_release_branch == 1) ]]
then
aws s3 cp libxgboost4j_m1_${BUILDKITE_COMMIT}.dylib \
s3://xgboost-nightly-builds/${BRANCH_NAME}/libxgboost4j/ \
--acl public-read --no-progress
fi
popd
set +x

# Ensure that XGBoost can be built with Clang 11
echo "--- Build and Test XGBoost with MacOS M1, Clang 11"
set -x
Expand All @@ -49,3 +22,4 @@ cmake .. -GNinja -DCMAKE_C_COMPILER=${LLVM11_PATH}/bin/clang \
-DCMAKE_CXX_COMPILER=${LLVM11_PATH}/bin/clang++ -DGOOGLE_TEST=ON \
-DUSE_DMLC_GTEST=ON
ninja -v
./testxgboost
2 changes: 1 addition & 1 deletion tests/ci_build/Dockerfile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN \
dnf -y update && \
dnf -y install dnf-plugins-core && \
dnf config-manager --set-enabled powertools && \
dnf install -y tar unzip wget xz git which ninja-build gcc-toolset-10-gcc gcc-toolset-10-binutils gcc-toolset-10-gcc-c++ && \
dnf install -y tar unzip wget xz git which ninja-build gcc-toolset-10-gcc gcc-toolset-10-binutils gcc-toolset-10-gcc-c++ java-1.8.0-openjdk-devel && \
# Python
wget -nv -O conda.sh https://github.com/conda-forge/miniforge/releases/download/24.3.0-0/Miniforge3-24.3.0-0-Linux-aarch64.sh && \
bash conda.sh -b -p /opt/miniforge
Expand Down
Loading