Skip to content

Commit e2a664c

Browse files
razdoburdintrivialfishcho3
authored
Adopt xgboost 2.0.3 patch (#28)
* [backport][sklearn] Fix loading model attributes. (dmlc#9808) (dmlc#9880) * [backport][py] Use the first found native library. (dmlc#9860) (dmlc#9879) * [backport] [CI] Upload libxgboost4j.dylib (M1) to S3 bucket (dmlc#9887) * [CI] Set up CI for Mac M1 (dmlc#9699) * [CI] Improve CI for Mac M1 (dmlc#9748) * [CI] Build libxgboost4j.dylib with CMAKE_OSX_DEPLOYMENT_TARGET (dmlc#9749) * [CI] Upload libxgboost4j.dylib (M1) to S3 bucket (dmlc#9886) * [jvm-packages] Fix POM for xgboost-jvm metapackage (dmlc#9893) * [jvm-packages] Fix POM for xgboost-jvm metapackage * Add script for updating the Scala version * Bump version to 2.0.3 (dmlc#9895) * Update change_scala_version.py to also change scala.version property (dmlc#9897) --------- Co-authored-by: Jiaming Yuan <[email protected]> Co-authored-by: Philip Hyunsu Cho <[email protected]>
1 parent 7c14732 commit e2a664c

File tree

29 files changed

+315
-127
lines changed

29 files changed

+315
-127
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
2-
project(xgboost LANGUAGES CXX C VERSION 2.0.2)
2+
project(xgboost LANGUAGES CXX C VERSION 2.0.3)
33
include(cmake/Utils.cmake)
44
list(APPEND CMAKE_MODULE_PATH "${xgboost_SOURCE_DIR}/cmake/modules")
55
cmake_policy(SET CMP0022 NEW)

R-package/DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: xgboost
22
Type: Package
33
Title: Extreme Gradient Boosting
4-
Version: 2.0.2.1
5-
Date: 2023-10-12
4+
Version: 2.0.3.1
5+
Date: 2023-12-14
66
Authors@R: c(
77
person("Tianqi", "Chen", role = c("aut"),
88
email = "[email protected]"),

R-package/configure

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.71 for xgboost 2.0.2.
3+
# Generated by GNU Autoconf 2.71 for xgboost 2.0.3.
44
#
55
#
66
# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation,
@@ -607,8 +607,8 @@ MAKEFLAGS=
607607
# Identity of this package.
608608
PACKAGE_NAME='xgboost'
609609
PACKAGE_TARNAME='xgboost'
610-
PACKAGE_VERSION='2.0.2'
611-
PACKAGE_STRING='xgboost 2.0.2'
610+
PACKAGE_VERSION='2.0.3'
611+
PACKAGE_STRING='xgboost 2.0.3'
612612
PACKAGE_BUGREPORT=''
613613
PACKAGE_URL=''
614614

@@ -1225,7 +1225,7 @@ if test "$ac_init_help" = "long"; then
12251225
# Omit some internal or obsolete options to make the list less imposing.
12261226
# This message is too long to be a string in the A/UX 3.1 sh.
12271227
cat <<_ACEOF
1228-
\`configure' configures xgboost 2.0.2 to adapt to many kinds of systems.
1228+
\`configure' configures xgboost 2.0.3 to adapt to many kinds of systems.
12291229
12301230
Usage: $0 [OPTION]... [VAR=VALUE]...
12311231
@@ -1287,7 +1287,7 @@ fi
12871287

12881288
if test -n "$ac_init_help"; then
12891289
case $ac_init_help in
1290-
short | recursive ) echo "Configuration of xgboost 2.0.2:";;
1290+
short | recursive ) echo "Configuration of xgboost 2.0.3:";;
12911291
esac
12921292
cat <<\_ACEOF
12931293
@@ -1367,7 +1367,7 @@ fi
13671367
test -n "$ac_init_help" && exit $ac_status
13681368
if $ac_init_version; then
13691369
cat <<\_ACEOF
1370-
xgboost configure 2.0.2
1370+
xgboost configure 2.0.3
13711371
generated by GNU Autoconf 2.71
13721372
13731373
Copyright (C) 2021 Free Software Foundation, Inc.
@@ -1533,7 +1533,7 @@ cat >config.log <<_ACEOF
15331533
This file contains any messages produced by compilers while
15341534
running configure, to aid debugging if configure makes a mistake.
15351535
1536-
It was created by xgboost $as_me 2.0.2, which was
1536+
It was created by xgboost $as_me 2.0.3, which was
15371537
generated by GNU Autoconf 2.71. Invocation command line was
15381538
15391539
$ $0$ac_configure_args_raw
@@ -3412,7 +3412,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
34123412
# report actual input values of CONFIG_FILES etc. instead of their
34133413
# values after options handling.
34143414
ac_log="
3415-
This file was extended by xgboost $as_me 2.0.2, which was
3415+
This file was extended by xgboost $as_me 2.0.3, which was
34163416
generated by GNU Autoconf 2.71. Invocation command line was
34173417
34183418
CONFIG_FILES = $CONFIG_FILES
@@ -3467,7 +3467,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
34673467
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
34683468
ac_cs_config='$ac_cs_config_escaped'
34693469
ac_cs_version="\\
3470-
xgboost config.status 2.0.2
3470+
xgboost config.status 2.0.3
34713471
configured by $0, generated by GNU Autoconf 2.71,
34723472
with options \\"\$ac_cs_config\\"
34733473

R-package/configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
AC_PREREQ(2.69)
44

5-
AC_INIT([xgboost],[2.0.2],[],[xgboost],[])
5+
AC_INIT([xgboost],[2.0.3],[],[xgboost],[])
66

77
: ${R_HOME=`R RHOME`}
88
if test -z "${R_HOME}"; then

dev/change_scala_version.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import argparse
2+
import pathlib
3+
import re
4+
import shutil
5+
6+
7+
def main(args):
8+
if args.scala_version == "2.12":
9+
scala_ver = "2.12"
10+
scala_patchver = "2.12.18"
11+
elif args.scala_version == "2.13":
12+
scala_ver = "2.13"
13+
scala_patchver = "2.13.11"
14+
else:
15+
raise ValueError(f"Unsupported Scala version: {args.scala_version}")
16+
17+
# Clean artifacts
18+
if args.purge_artifacts:
19+
for target in pathlib.Path("jvm-packages/").glob("**/target"):
20+
if target.is_dir():
21+
print(f"Removing {target}...")
22+
shutil.rmtree(target)
23+
24+
# Update pom.xml
25+
for pom in pathlib.Path("jvm-packages/").glob("**/pom.xml"):
26+
print(f"Updating {pom}...")
27+
with open(pom, "r", encoding="utf-8") as f:
28+
lines = f.readlines()
29+
with open(pom, "w", encoding="utf-8") as f:
30+
replaced_scalaver = False
31+
replaced_scala_binver = False
32+
for line in lines:
33+
for artifact in [
34+
"xgboost-jvm",
35+
"xgboost4j",
36+
"xgboost4j-gpu",
37+
"xgboost4j-spark",
38+
"xgboost4j-spark-gpu",
39+
"xgboost4j-flink",
40+
"xgboost4j-example",
41+
]:
42+
line = re.sub(
43+
f"<artifactId>{artifact}_[0-9\\.]*",
44+
f"<artifactId>{artifact}_{scala_ver}",
45+
line,
46+
)
47+
# Only replace the first occurrence of scala.version
48+
if not replaced_scalaver:
49+
line, nsubs = re.subn(
50+
r"<scala.version>[0-9\.]*",
51+
f"<scala.version>{scala_patchver}",
52+
line,
53+
)
54+
if nsubs > 0:
55+
replaced_scalaver = True
56+
# Only replace the first occurrence of scala.binary.version
57+
if not replaced_scala_binver:
58+
line, nsubs = re.subn(
59+
r"<scala.binary.version>[0-9\.]*",
60+
f"<scala.binary.version>{scala_ver}",
61+
line,
62+
)
63+
if nsubs > 0:
64+
replaced_scala_binver = True
65+
f.write(line)
66+
67+
68+
if __name__ == "__main__":
69+
parser = argparse.ArgumentParser()
70+
parser.add_argument("--purge-artifacts", action="store_true")
71+
parser.add_argument(
72+
"--scala-version",
73+
type=str,
74+
required=True,
75+
help="Version of Scala to use in the JVM packages",
76+
choices=["2.12", "2.13"],
77+
)
78+
parsed_args = parser.parse_args()
79+
main(parsed_args)

dev/prepare_jvm_release.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import errno
33
import glob
44
import os
5-
import platform
65
import re
76
import shutil
87
import subprocess
@@ -88,10 +87,6 @@ def main():
8887
help="Version of the release being prepared",
8988
)
9089
args = parser.parse_args()
91-
92-
if sys.platform != "darwin" or platform.machine() != "arm64":
93-
raise NotImplementedError("Please run this script using an M1 Mac")
94-
9590
version = args.release_version
9691
expected_git_tag = "v" + version
9792
current_git_tag = get_current_git_tag()
@@ -141,6 +136,7 @@ def main():
141136
("linux", "x86_64"),
142137
("windows", "x86_64"),
143138
("macos", "x86_64"),
139+
("macos", "aarch64"),
144140
]:
145141
output_dir = f"xgboost4j/src/main/resources/lib/{os_ident}/{arch}"
146142
maybe_makedirs(output_dir)
@@ -164,6 +160,10 @@ def main():
164160
url=f"{nightly_bucket_prefix}/{git_branch}/libxgboost4j/libxgboost4j_{commit_hash}.dylib",
165161
filename="xgboost4j/src/main/resources/lib/macos/x86_64/libxgboost4j.dylib",
166162
)
163+
retrieve(
164+
url=f"{nightly_bucket_prefix}/{git_branch}/libxgboost4j/libxgboost4j_m1_{commit_hash}.dylib",
165+
filename="xgboost4j/src/main/resources/lib/macos/aarch64/libxgboost4j.dylib",
166+
)
167167

168168
with tempfile.TemporaryDirectory() as tempdir:
169169
# libxgboost4j.so for Linux x86_64, CPU only
@@ -211,21 +211,29 @@ def main():
211211
"https://central.sonatype.org/publish/publish-maven/"
212212
)
213213
print(
214-
"3. Now on a M1 Mac machine, run the following to build Scala 2.12 artifacts:"
214+
"3. Now on a Linux machine, run the following to build Scala 2.12 artifacts. "
215+
"Make sure to use an Internet connection with fast upload speed:"
216+
)
217+
print(
218+
" # Skip native build, since we have all needed native binaries from CI\n"
219+
" export MAVEN_SKIP_NATIVE_BUILD=1\n"
220+
" GPG_TTY=$(tty) mvn deploy -Prelease -DskipTests"
215221
)
216-
print(" GPG_TTY=$(tty) mvn deploy -Prelease -DskipTests")
217222
print(
218223
"4. Log into https://oss.sonatype.org/. On the left menu panel, click Staging "
219224
"Repositories. Visit the URL https://oss.sonatype.org/content/repositories/mldmlc-xxxx "
220225
"to inspect the staged JAR files. Finally, press Release button to publish the "
221226
"artifacts to the Maven Central repository. The top-level metapackage should be "
222227
"named xgboost-jvm_2.12."
223228
)
224-
print("5. Remove the Scala 2.12 artifacts and build Scala 2.13 artifacts:")
225-
print(" rm -rf targets/")
226-
print(" GPG_TTY=$(tty) mvn deploy -Prelease-cpu-only,scala-2.13 -DskipTests")
227229
print(
228-
"6. Go to https://oss.sonatype.org/ to release the Scala 2.13 artifacts."
230+
"5. Remove the Scala 2.12 artifacts and build Scala 2.13 artifacts:\n"
231+
" export MAVEN_SKIP_NATIVE_BUILD=1\n"
232+
" python dev/change_scala_version.py --scala-version 2.13 --purge-artifacts\n"
233+
" GPG_TTY=$(tty) mvn deploy -Prelease-cpu-only,scala-2.13 -DskipTests"
234+
)
235+
print(
236+
"6. Go to https://oss.sonatype.org/ to release the Scala 2.13 artifacts. "
229237
"The top-level metapackage should be named xgboost-jvm_2.13."
230238
)
231239

include/xgboost/version_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
#define XGBOOST_VER_MAJOR 2 /* NOLINT */
88
#define XGBOOST_VER_MINOR 0 /* NOLINT */
9-
#define XGBOOST_VER_PATCH 2 /* NOLINT */
9+
#define XGBOOST_VER_PATCH 3 /* NOLINT */
1010

1111
#endif // XGBOOST_VERSION_CONFIG_H_

jvm-packages/create_jni.py

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python
2-
import errno
32
import argparse
3+
import errno
44
import glob
55
import os
66
import platform
@@ -19,11 +19,10 @@
1919
"USE_HDFS": "OFF",
2020
"USE_AZURE": "OFF",
2121
"USE_S3": "OFF",
22-
2322
"USE_CUDA": "OFF",
2423
"USE_NCCL": "OFF",
2524
"JVM_BINDINGS": "ON",
26-
"LOG_CAPI_INVOCATION": "OFF"
25+
"LOG_CAPI_INVOCATION": "OFF",
2726
}
2827

2928

@@ -70,39 +69,35 @@ def normpath(path):
7069
return normalized
7170

7271

73-
if __name__ == "__main__":
74-
parser = argparse.ArgumentParser()
75-
parser.add_argument('--log-capi-invocation', type=str, choices=['ON', 'OFF'], default='OFF')
76-
parser.add_argument('--use-cuda', type=str, choices=['ON', 'OFF'], default='OFF')
77-
cli_args = parser.parse_args()
78-
72+
def native_build(args):
7973
if sys.platform == "darwin":
8074
# Enable of your compiler supports OpenMP.
8175
CONFIG["USE_OPENMP"] = "OFF"
82-
os.environ["JAVA_HOME"] = subprocess.check_output(
83-
"/usr/libexec/java_home").strip().decode()
76+
os.environ["JAVA_HOME"] = (
77+
subprocess.check_output("/usr/libexec/java_home").strip().decode()
78+
)
8479

8580
print("building Java wrapper")
8681
with cd(".."):
87-
build_dir = 'build-gpu' if cli_args.use_cuda == 'ON' else 'build'
82+
build_dir = "build-gpu" if cli_args.use_cuda == "ON" else "build"
8883
maybe_makedirs(build_dir)
8984
with cd(build_dir):
9085
if sys.platform == "win32":
9186
# Force x64 build on Windows.
92-
maybe_generator = ' -A x64'
87+
maybe_generator = " -A x64"
9388
else:
9489
maybe_generator = ""
9590
if sys.platform == "linux":
9691
maybe_parallel_build = " -- -j $(nproc)"
9792
else:
9893
maybe_parallel_build = ""
9994

100-
if cli_args.log_capi_invocation == 'ON':
101-
CONFIG['LOG_CAPI_INVOCATION'] = 'ON'
95+
if cli_args.log_capi_invocation == "ON":
96+
CONFIG["LOG_CAPI_INVOCATION"] = "ON"
10297

103-
if cli_args.use_cuda == 'ON':
104-
CONFIG['USE_CUDA'] = 'ON'
105-
CONFIG['USE_NCCL'] = 'ON'
98+
if cli_args.use_cuda == "ON":
99+
CONFIG["USE_CUDA"] = "ON"
100+
CONFIG["USE_NCCL"] = "ON"
106101

107102
args = ["-D{0}:BOOL={1}".format(k, v) for k, v in CONFIG.items()]
108103

@@ -115,7 +110,7 @@ def normpath(path):
115110
if gpu_arch_flag is not None:
116111
args.append("%s" % gpu_arch_flag)
117112

118-
lib_dir = os.path.join(os.pardir, 'lib')
113+
lib_dir = os.path.join(os.pardir, "lib")
119114
if os.path.exists(lib_dir):
120115
shutil.rmtree(lib_dir)
121116
run("cmake .. " + " ".join(args) + maybe_generator)
@@ -125,8 +120,10 @@ def normpath(path):
125120
run(f'"{sys.executable}" mapfeat.py')
126121
run(f'"{sys.executable}" mknfold.py machine.txt 1')
127122

128-
xgboost4j = 'xgboost4j-gpu' if cli_args.use_cuda == 'ON' else 'xgboost4j'
129-
xgboost4j_spark = 'xgboost4j-spark-gpu' if cli_args.use_cuda == 'ON' else 'xgboost4j-spark'
123+
xgboost4j = "xgboost4j-gpu" if cli_args.use_cuda == "ON" else "xgboost4j"
124+
xgboost4j_spark = (
125+
"xgboost4j-spark-gpu" if cli_args.use_cuda == "ON" else "xgboost4j-spark"
126+
)
130127

131128
print("copying native library")
132129
library_name, os_folder = {
@@ -141,14 +138,19 @@ def normpath(path):
141138
"i86pc": "x86_64", # on Solaris x86_64
142139
"sun4v": "sparc", # on Solaris sparc
143140
"arm64": "aarch64", # on macOS & Windows ARM 64-bit
144-
"aarch64": "aarch64"
141+
"aarch64": "aarch64",
145142
}[platform.machine().lower()]
146-
output_folder = "{}/src/main/resources/lib/{}/{}".format(xgboost4j, os_folder, arch_folder)
143+
output_folder = "{}/src/main/resources/lib/{}/{}".format(
144+
xgboost4j, os_folder, arch_folder
145+
)
147146
maybe_makedirs(output_folder)
148147
cp("../lib/" + library_name, output_folder)
149148

150149
print("copying pure-Python tracker")
151-
cp("../python-package/xgboost/tracker.py", "{}/src/main/resources".format(xgboost4j))
150+
cp(
151+
"../python-package/xgboost/tracker.py",
152+
"{}/src/main/resources".format(xgboost4j),
153+
)
152154

153155
print("copying train/test files")
154156
maybe_makedirs("{}/src/test/resources".format(xgboost4j_spark))
@@ -164,3 +166,18 @@ def normpath(path):
164166
maybe_makedirs("{}/src/test/resources".format(xgboost4j))
165167
for file in glob.glob("../demo/data/agaricus.*"):
166168
cp(file, "{}/src/test/resources".format(xgboost4j))
169+
170+
171+
if __name__ == "__main__":
172+
if "MAVEN_SKIP_NATIVE_BUILD" in os.environ:
173+
print("MAVEN_SKIP_NATIVE_BUILD is set. Skipping native build...")
174+
else:
175+
parser = argparse.ArgumentParser()
176+
parser.add_argument(
177+
"--log-capi-invocation", type=str, choices=["ON", "OFF"], default="OFF"
178+
)
179+
parser.add_argument(
180+
"--use-cuda", type=str, choices=["ON", "OFF"], default="OFF"
181+
)
182+
cli_args = parser.parse_args()
183+
native_build(cli_args)

0 commit comments

Comments
 (0)