Skip to content

Commit ad53d55

Browse files
authored
Merge branch 'dmlc:release_2.1.0' into release_2.1.0
2 parents 1ab6c0a + ec2f56a commit ad53d55

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+292
-340
lines changed

.github/workflows/jvm_tests.yml

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ jobs:
2323
with:
2424
submodules: 'true'
2525

26+
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
27+
with:
28+
distribution: 'temurin'
29+
java-version: '8'
30+
2631
- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
2732
with:
2833
miniforge-variant: Mambaforge
@@ -38,19 +43,18 @@ jobs:
3843
key: ${{ runner.os }}-m2-${{ hashFiles('./jvm-packages/pom.xml') }}
3944
restore-keys: ${{ runner.os }}-m2-${{ hashFiles('./jvm-packages/pom.xml') }}
4045

41-
- name: Build xgboost4j.dll
42-
run: |
43-
mkdir build
44-
cd build
45-
cmake .. -G"Visual Studio 17 2022" -A x64 -DJVM_BINDINGS=ON
46-
cmake --build . --config Release
47-
if: matrix.os == 'windows-latest'
48-
4946
- name: Test XGBoost4J (Core)
5047
run: |
5148
cd jvm-packages
5249
mvn test -B -pl :xgboost4j_2.12
5350
51+
- name: Test XGBoost4J (Core, Spark, Examples)
52+
run: |
53+
rm -rfv build/
54+
cd jvm-packages
55+
mvn -B test
56+
if: matrix.os == 'ubuntu-latest' # Distributed training doesn't work on Windows
57+
5458
- name: Extract branch name
5559
shell: bash
5660
run: |
@@ -87,22 +91,9 @@ jobs:
8791
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_IAM_S3_UPLOADER }}
8892
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_IAM_S3_UPLOADER }}
8993

90-
91-
- name: Test XGBoost4J (Core, Spark, Examples)
92-
run: |
93-
rm -rfv build/
94-
cd jvm-packages
95-
mvn -B test
96-
if: matrix.os == 'ubuntu-latest' # Distributed training doesn't work on Windows
97-
env:
98-
RABIT_MOCK: ON
99-
100-
10194
- name: Build and Test XGBoost4J with scala 2.13
10295
run: |
10396
rm -rfv build/
10497
cd jvm-packages
10598
mvn -B clean install test -Pdefault,scala-2.13
10699
if: matrix.os == 'ubuntu-latest' # Distributed training doesn't work on Windows
107-
env:
108-
RABIT_MOCK: ON

CMakeLists.txt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,18 @@ if(USE_NCCL)
265265
find_package(Nccl REQUIRED)
266266
endif()
267267

268-
# dmlc-core
269-
msvc_use_static_runtime()
270-
if(FORCE_SHARED_CRT)
271-
set(DMLC_FORCE_SHARED_CRT ON)
268+
if(MSVC)
269+
if(FORCE_SHARED_CRT)
270+
message(STATUS "XGBoost: Using dynamically linked MSVC runtime...")
271+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
272+
else()
273+
message(STATUS "XGBoost: Using statically linked MSVC runtime...")
274+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
275+
endif()
272276
endif()
277+
278+
# dmlc-core
279+
set(DMLC_FORCE_SHARED_CRT ${FORCE_SHARED_CRT})
273280
add_subdirectory(${xgboost_SOURCE_DIR}/dmlc-core)
274281

275282
if(MSVC)
@@ -490,11 +497,6 @@ if(GOOGLE_TEST)
490497
endif()
491498
endif()
492499

493-
# For MSVC: Call msvc_use_static_runtime() once again to completely
494-
# replace /MD with /MT. See https://github.com/dmlc/xgboost/issues/4462
495-
# for issues caused by mixing of /MD and /MT flags
496-
msvc_use_static_runtime()
497-
498500
# Add xgboost.pc
499501
if(ADD_PKGCONFIG)
500502
configure_file(${xgboost_SOURCE_DIR}/cmake/xgboost.pc.in ${xgboost_BINARY_DIR}/xgboost.pc @ONLY)

cmake/Utils.cmake

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,45 +13,6 @@ function(auto_source_group SOURCES)
1313
endforeach()
1414
endfunction()
1515

16-
# Force static runtime for MSVC
17-
function(msvc_use_static_runtime)
18-
if(MSVC AND (NOT BUILD_SHARED_LIBS) AND (NOT FORCE_SHARED_CRT))
19-
set(variables
20-
CMAKE_C_FLAGS_DEBUG
21-
CMAKE_C_FLAGS_MINSIZEREL
22-
CMAKE_C_FLAGS_RELEASE
23-
CMAKE_C_FLAGS_RELWITHDEBINFO
24-
CMAKE_CXX_FLAGS_DEBUG
25-
CMAKE_CXX_FLAGS_MINSIZEREL
26-
CMAKE_CXX_FLAGS_RELEASE
27-
CMAKE_CXX_FLAGS_RELWITHDEBINFO
28-
)
29-
foreach(variable ${variables})
30-
if(${variable} MATCHES "/MD")
31-
string(REGEX REPLACE "/MD" "/MT" ${variable} "${${variable}}")
32-
set(${variable} "${${variable}}" PARENT_SCOPE)
33-
endif()
34-
endforeach()
35-
set(variables
36-
CMAKE_CUDA_FLAGS
37-
CMAKE_CUDA_FLAGS_DEBUG
38-
CMAKE_CUDA_FLAGS_MINSIZEREL
39-
CMAKE_CUDA_FLAGS_RELEASE
40-
CMAKE_CUDA_FLAGS_RELWITHDEBINFO
41-
)
42-
foreach(variable ${variables})
43-
if(${variable} MATCHES "-MD")
44-
string(REGEX REPLACE "-MD" "-MT" ${variable} "${${variable}}")
45-
set(${variable} "${${variable}}" PARENT_SCOPE)
46-
endif()
47-
if(${variable} MATCHES "/MD")
48-
string(REGEX REPLACE "/MD" "/MT" ${variable} "${${variable}}")
49-
set(${variable} "${${variable}}" PARENT_SCOPE)
50-
endif()
51-
endforeach()
52-
endif()
53-
endfunction()
54-
5516
# Set output directory of target, ignoring debug or release
5617
function(set_output_directory target dir)
5718
set_target_properties(${target} PROPERTIES

demo/guide-python/external_memory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def make_batches(
4343
class Iterator(xgboost.DataIter):
4444
"""A custom iterator for loading files in batches."""
4545

46-
def __init__(self, file_paths: List[Tuple[str, str]]):
46+
def __init__(self, file_paths: List[Tuple[str, str]]) -> None:
4747
self._file_paths = file_paths
4848
self._it = 0
4949
# XGBoost will generate some cache files under current directory with the prefix

dev/prepare_jvm_release.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,7 @@ def main():
216216
)
217217
print(
218218
" # 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"
219+
" GPG_TTY=$(tty) mvn deploy -Prelease -DskipTests -Dskip.native.build=true"
221220
)
222221
print(
223222
"4. Log into https://oss.sonatype.org/. On the left menu panel, click Staging "
@@ -228,9 +227,8 @@ def main():
228227
)
229228
print(
230229
"5. Remove the Scala 2.12 artifacts and build Scala 2.13 artifacts:\n"
231-
" export MAVEN_SKIP_NATIVE_BUILD=1\n"
232230
" python dev/change_scala_version.py --scala-version 2.13 --purge-artifacts\n"
233-
" GPG_TTY=$(tty) mvn deploy -Prelease -DskipTests"
231+
" GPG_TTY=$(tty) mvn deploy -Prelease -DskipTests -Dskip.native.build=true"
234232
)
235233
print(
236234
"6. Go to https://oss.sonatype.org/ to release the Scala 2.13 artifacts. "

dev/release-artifacts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ def download_py_packages(
123123
) -> None:
124124
platforms = [
125125
"win_amd64",
126-
"manylinux2014_x86_64",
127-
"manylinux2014_aarch64",
126+
"manylinux_2_28_x86_64",
127+
"manylinux_2_28_aarch64",
128128
"macosx_10_15_x86_64.macosx_11_0_x86_64.macosx_12_0_x86_64",
129129
"macosx_12_0_arm64",
130130
]

jvm-packages/create_jni.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def maybe_makedirs(path):
5151

5252
def run(command, **kwargs):
5353
print(command)
54-
subprocess.check_call(command, shell=True, **kwargs)
54+
subprocess.run(command, shell=True, check=True, env=os.environ, **kwargs)
5555

5656

5757
def cp(source, target):
@@ -85,6 +85,8 @@ def native_build(args):
8585

8686
if sys.platform == "linux":
8787
maybe_parallel_build = " -- -j $(nproc)"
88+
elif sys.platform == "win32":
89+
maybe_parallel_build = ' -- /m /nodeReuse:false "/consoleloggerparameters:ShowCommandLine;Verbosity=minimal"'
8890
else:
8991
maybe_parallel_build = ""
9092

@@ -176,15 +178,10 @@ def native_build(args):
176178

177179

178180
if __name__ == "__main__":
179-
if "MAVEN_SKIP_NATIVE_BUILD" in os.environ:
180-
print("MAVEN_SKIP_NATIVE_BUILD is set. Skipping native build...")
181-
else:
182-
parser = argparse.ArgumentParser()
183-
parser.add_argument(
184-
"--log-capi-invocation", type=str, choices=["ON", "OFF"], default="OFF"
185-
)
186-
parser.add_argument(
187-
"--use-cuda", type=str, choices=["ON", "OFF"], default="OFF"
188-
)
189-
cli_args = parser.parse_args()
190-
native_build(cli_args)
181+
parser = argparse.ArgumentParser()
182+
parser.add_argument(
183+
"--log-capi-invocation", type=str, choices=["ON", "OFF"], default="OFF"
184+
)
185+
parser.add_argument("--use-cuda", type=str, choices=["ON", "OFF"], default="OFF")
186+
cli_args = parser.parse_args()
187+
native_build(cli_args)

jvm-packages/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
<cudf.classifier>cuda12</cudf.classifier>
5050
<scalatest.version>3.2.18</scalatest.version>
5151
<scala-collection-compat.version>2.12.0</scala-collection-compat.version>
52+
<skip.native.build>false</skip.native.build>
5253

5354
<!-- SPARK-36796 for JDK-17 test-->
5455
<extraJavaTestArgs>

jvm-packages/xgboost4j/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
<argument>${log.capi.invocation}</argument>
9999
</arguments>
100100
<workingDirectory>${user.dir}</workingDirectory>
101+
<skip>${skip.native.build}</skip>
101102
</configuration>
102103
</execution>
103104
</executions>

0 commit comments

Comments
 (0)