Skip to content

Commit 4dc0e35

Browse files
authored
Group build args (microsoft#24337)
1. Split build.py to two files, because currently the file is over 3000 lines. This PR moves 900 of them to a new file. 2. Put the build args into groups. It makes more explicit that "--x86", "--arm", "--arm64" and "--arm64ec" args are for Windows only. 3. Remove the "--use_avx512" and "--gen-api-doc" build args, as they are not referenced anywhere. "--gen-api-doc" was for generating documents for pytorch frontend. 4. Remove MPI related build flags. 5. Delete tools/ci_build/github/pai/orttraining-ci.yml 6. Remove --use_preinstalled_eigen and --eigen_path. Now we have a more unified approach for all ORT's dependencies (not just eigen). See https://onnxruntime.ai/docs/build/dependencies.html for more information. 7. Windows specific build options won't show up on non-Windows platforms. The same for macOS.
1 parent 5a5e668 commit 4dc0e35

13 files changed

+1011
-1074
lines changed

cmake/CMakeLists.txt

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ option(onnxruntime_ENABLE_TRAINING_OPS "Include training operators but no traini
180180
option(onnxruntime_ENABLE_TRAINING_E2E_TESTS "Enable training end-to-end tests." OFF)
181181
option(onnxruntime_ENABLE_CPU_FP16_OPS "Build with advanced instruction sets" ON)
182182
option(onnxruntime_USE_NCCL "Build with NCCL support" OFF)
183-
option(onnxruntime_USE_MPI "Build with MPI support" OFF)
184183

185184
# WebAssembly options
186185
option(onnxruntime_BUILD_WEBASSEMBLY_STATIC_LIB "Enable this option to create WebAssembly static library" OFF)
@@ -1651,29 +1650,6 @@ if (onnxruntime_ENABLE_DLPACK)
16511650
endif()
16521651

16531652
if (UNIX OR onnxruntime_USE_NCCL)
1654-
# MPI is INDEPENDENT of NCCL for now. You can build NCLL without MPI and launch multi-GPU with your own launcher.
1655-
if (onnxruntime_USE_MPI)
1656-
if (EXISTS "${onnxruntime_MPI_HOME}")
1657-
set(MPI_HOME "${onnxruntime_MPI_HOME}")
1658-
elseif (EXISTS "/bert_ort/openmpi")
1659-
set(MPI_HOME "/bert_ort/openmpi")
1660-
endif()
1661-
find_package(MPI)
1662-
1663-
if (MPI_CXX_FOUND)
1664-
message( STATUS "MPI Version: ${MPI_CXX_VERSION}")
1665-
message( STATUS "MPI (include: ${MPI_CXX_INCLUDE_DIRS}, library: ${MPI_CXX_LIBRARIES})" )
1666-
mark_as_advanced(MPI_CXX_INCLUDE_DIRS MPI_CXX_LIBRARIES)
1667-
list(APPEND onnxruntime_EXTERNAL_LIBRARIES ${MPI_CXX_LIBRARIES} ${MPI_CXX_LINK_FLAGS})
1668-
else ()
1669-
message(
1670-
FATAL_ERROR
1671-
"MPI is not found. Please define onnxruntime_MPI_HOME to specify the path of MPI. Otherwise, NCCL will be disabled."
1672-
"or you can remove --use_mpi from build args to disable MPI."
1673-
)
1674-
endif()
1675-
endif()
1676-
16771653
# Find NCCL
16781654
if (onnxruntime_USE_NCCL)
16791655
if (onnxruntime_USE_CUDA)
@@ -1743,13 +1719,9 @@ if (UNIX OR onnxruntime_USE_NCCL)
17431719
endif()
17441720
else()
17451721
set(onnxruntime_USE_NCCL OFF)
1746-
set(onnxruntime_USE_MPI OFF)
1747-
message( WARNING "MPI and NCCL are disabled because build is on Windows or USE_NCCL is set to OFF." )
1722+
message( WARNING "NCCL is disabled because build is on Windows or USE_NCCL is set to OFF." )
17481723
endif()
17491724

1750-
if (onnxruntime_USE_MPI)
1751-
add_definitions(-DUSE_MPI=1)
1752-
endif()
17531725

17541726
# Default version parts for Microsoft.AI.MachineLearning.dll, onnxruntime.dll, onnxruntime_providers_openvino.dll and onnxruntime_providers_shared.dll in non-ADO pipeline local builds
17551727
set(VERSION_MAJOR_PART 0 CACHE STRING "First part of numeric file/product version.")

cmake/onnxruntime_framework.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ if (onnxruntime_ENABLE_TRAINING_OPS)
7777
onnxruntime_add_include_to_target(onnxruntime_framework Python::Module dlpack::dlpack)
7878
endif()
7979
endif()
80-
if (onnxruntime_USE_MPI)
81-
target_include_directories(onnxruntime_framework PUBLIC ${MPI_CXX_INCLUDE_DIRS})
82-
endif()
8380

8481
if (onnxruntime_ENABLE_ATEN)
8582
onnxruntime_add_include_to_target(onnxruntime_framework dlpack::dlpack)

cmake/onnxruntime_providers_cpu.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ if (onnxruntime_ENABLE_TRAINING)
206206
onnxruntime_add_include_to_target(onnxruntime_providers Python::Module)
207207
endif()
208208

209-
if (onnxruntime_USE_NCCL OR onnxruntime_USE_MPI)
209+
if (onnxruntime_USE_NCCL)
210210
target_include_directories(onnxruntime_providers PUBLIC ${MPI_CXX_INCLUDE_DIRS})
211211
endif()
212212
endif()

cmake/onnxruntime_providers_cuda.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,6 @@
252252
target_include_directories(${target} PRIVATE ${ORTTRAINING_ROOT} ${MPI_CXX_INCLUDE_DIRS})
253253
endif()
254254

255-
if(onnxruntime_USE_MPI)
256-
target_link_libraries(${target} PRIVATE ${MPI_LIBRARIES} ${MPI_CXX_LINK_FLAGS})
257-
endif()
258-
259255
if (onnxruntime_USE_NCCL)
260256
target_include_directories(${target} PRIVATE ${NCCL_INCLUDE_DIRS})
261257
target_link_libraries(${target} PRIVATE ${NCCL_LIBRARIES})

cmake/onnxruntime_providers_rocm.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,6 @@
158158

159159
if (onnxruntime_ENABLE_TRAINING)
160160
target_include_directories(onnxruntime_providers_rocm PRIVATE ${ORTTRAINING_ROOT} ${CMAKE_CURRENT_BINARY_DIR}/amdgpu/orttraining ${MPI_CXX_INCLUDE_DIRS})
161-
if(onnxruntime_USE_MPI)
162-
target_link_libraries(onnxruntime_providers_rocm PRIVATE ${MPI_LIBRARIES} ${MPI_CXX_LINK_FLAGS})
163-
endif()
164161

165162
# RCCL is enabled by default for ROCM builds
166163
#if (onnxruntime_USE_NCCL)

0 commit comments

Comments
 (0)