add hip support
This commit is contained in:
parent
eb30cb6293
commit
75fa15b36d
@ -42,7 +42,7 @@ option(ENABLE_ALL_WARNINGS "Enable all compiler warnings. Only effective for GCC
|
|||||||
option(LOG_CAPI_INVOCATION "Log all C API invocations for debugging" OFF)
|
option(LOG_CAPI_INVOCATION "Log all C API invocations for debugging" OFF)
|
||||||
option(GOOGLE_TEST "Build google tests" OFF)
|
option(GOOGLE_TEST "Build google tests" OFF)
|
||||||
option(USE_DMLC_GTEST "Use google tests bundled with dmlc-core submodule" OFF)
|
option(USE_DMLC_GTEST "Use google tests bundled with dmlc-core submodule" OFF)
|
||||||
option(USE_DEVICE_DEBUG "Generate CUDA device debug info." OFF)
|
option(USE_DEVICE_DEBUG "Generate CUDA/HIP device debug info." OFF)
|
||||||
option(USE_NVTX "Build with cuda profiling annotations. Developers only." OFF)
|
option(USE_NVTX "Build with cuda profiling annotations. Developers only." OFF)
|
||||||
set(NVTX_HEADER_DIR "" CACHE PATH "Path to the stand-alone nvtx header")
|
set(NVTX_HEADER_DIR "" CACHE PATH "Path to the stand-alone nvtx header")
|
||||||
option(RABIT_MOCK "Build rabit with mock" OFF)
|
option(RABIT_MOCK "Build rabit with mock" OFF)
|
||||||
@ -54,6 +54,13 @@ option(BUILD_WITH_SHARED_NCCL "Build with shared NCCL library." OFF)
|
|||||||
option(BUILD_WITH_CUDA_CUB "Build with cub in CUDA installation" OFF)
|
option(BUILD_WITH_CUDA_CUB "Build with cub in CUDA installation" OFF)
|
||||||
set(GPU_COMPUTE_VER "" CACHE STRING
|
set(GPU_COMPUTE_VER "" CACHE STRING
|
||||||
"Semicolon separated list of compute versions to be built against, e.g. '35;61'")
|
"Semicolon separated list of compute versions to be built against, e.g. '35;61'")
|
||||||
|
## HIP
|
||||||
|
option(USE_HIP "Build with GPU acceleration" OFF)
|
||||||
|
option(USE_RCCL "Build with RCCL to enable distributed GPU support." OFF)
|
||||||
|
option(BUILD_WITH_SHARED_RCCL "Build with shared RCCL library." OFF)
|
||||||
|
option(BUILD_WITH_HIP_CUB "Build with cub in HIP installation" OFF)
|
||||||
|
set(GPU_COMPUTE_TARGET "" CACHE STRING
|
||||||
|
"Semicolon separated list of compute versions to be built against, e.g. '908;90a'")
|
||||||
## Copied From dmlc
|
## Copied From dmlc
|
||||||
option(USE_HDFS "Build with HDFS support" OFF)
|
option(USE_HDFS "Build with HDFS support" OFF)
|
||||||
option(USE_AZURE "Build with AZURE support" OFF)
|
option(USE_AZURE "Build with AZURE support" OFF)
|
||||||
@ -76,6 +83,7 @@ option(ADD_PKGCONFIG "Add xgboost.pc into system." ON)
|
|||||||
if (USE_DEBUG_OUTPUT AND (NOT (CMAKE_BUILD_TYPE MATCHES Debug)))
|
if (USE_DEBUG_OUTPUT AND (NOT (CMAKE_BUILD_TYPE MATCHES Debug)))
|
||||||
message(SEND_ERROR "Do not enable `USE_DEBUG_OUTPUT' with release build.")
|
message(SEND_ERROR "Do not enable `USE_DEBUG_OUTPUT' with release build.")
|
||||||
endif (USE_DEBUG_OUTPUT AND (NOT (CMAKE_BUILD_TYPE MATCHES Debug)))
|
endif (USE_DEBUG_OUTPUT AND (NOT (CMAKE_BUILD_TYPE MATCHES Debug)))
|
||||||
|
|
||||||
if (USE_NCCL AND NOT (USE_CUDA))
|
if (USE_NCCL AND NOT (USE_CUDA))
|
||||||
message(SEND_ERROR "`USE_NCCL` must be enabled with `USE_CUDA` flag.")
|
message(SEND_ERROR "`USE_NCCL` must be enabled with `USE_CUDA` flag.")
|
||||||
endif (USE_NCCL AND NOT (USE_CUDA))
|
endif (USE_NCCL AND NOT (USE_CUDA))
|
||||||
@ -85,6 +93,17 @@ endif (USE_DEVICE_DEBUG AND NOT (USE_CUDA))
|
|||||||
if (BUILD_WITH_SHARED_NCCL AND (NOT USE_NCCL))
|
if (BUILD_WITH_SHARED_NCCL AND (NOT USE_NCCL))
|
||||||
message(SEND_ERROR "Build XGBoost with -DUSE_NCCL=ON to enable BUILD_WITH_SHARED_NCCL.")
|
message(SEND_ERROR "Build XGBoost with -DUSE_NCCL=ON to enable BUILD_WITH_SHARED_NCCL.")
|
||||||
endif (BUILD_WITH_SHARED_NCCL AND (NOT USE_NCCL))
|
endif (BUILD_WITH_SHARED_NCCL AND (NOT USE_NCCL))
|
||||||
|
|
||||||
|
if (USE_RCCL AND NOT (USE_HIP))
|
||||||
|
message(SEND_ERROR "`USE_RCCL` must be enabled with `USE_HIP` flag.")
|
||||||
|
endif (USE_RCCL AND NOT (USE_HIP))
|
||||||
|
if (USE_DEVICE_DEBUG AND NOT (USE_HIP))
|
||||||
|
message(SEND_ERROR "`USE_DEVICE_DEBUG` must be enabled with `USE_HIP` flag.")
|
||||||
|
endif (USE_DEVICE_DEBUG AND NOT (USE_HIP))
|
||||||
|
if (BUILD_WITH_SHARED_RCCL AND (NOT USE_RCCL))
|
||||||
|
message(SEND_ERROR "Build XGBoost with -DUSE_RCCL=ON to enable BUILD_WITH_SHARED_RCCL.")
|
||||||
|
endif (BUILD_WITH_SHARED_RCCL AND (NOT USE_RCCL))
|
||||||
|
|
||||||
if (JVM_BINDINGS AND R_LIB)
|
if (JVM_BINDINGS AND R_LIB)
|
||||||
message(SEND_ERROR "`R_LIB' is not compatible with `JVM_BINDINGS' as they both have customized configurations.")
|
message(SEND_ERROR "`R_LIB' is not compatible with `JVM_BINDINGS' as they both have customized configurations.")
|
||||||
endif (JVM_BINDINGS AND R_LIB)
|
endif (JVM_BINDINGS AND R_LIB)
|
||||||
@ -98,9 +117,15 @@ endif (USE_AVX)
|
|||||||
if (PLUGIN_LZ4)
|
if (PLUGIN_LZ4)
|
||||||
message(SEND_ERROR "The option 'PLUGIN_LZ4' is removed from XGBoost.")
|
message(SEND_ERROR "The option 'PLUGIN_LZ4' is removed from XGBoost.")
|
||||||
endif (PLUGIN_LZ4)
|
endif (PLUGIN_LZ4)
|
||||||
|
|
||||||
if (PLUGIN_RMM AND NOT (USE_CUDA))
|
if (PLUGIN_RMM AND NOT (USE_CUDA))
|
||||||
message(SEND_ERROR "`PLUGIN_RMM` must be enabled with `USE_CUDA` flag.")
|
message(SEND_ERROR "`PLUGIN_RMM` must be enabled with `USE_CUDA` flag.")
|
||||||
endif (PLUGIN_RMM AND NOT (USE_CUDA))
|
endif (PLUGIN_RMM AND NOT (USE_CUDA))
|
||||||
|
|
||||||
|
if (PLUGIN_RMM AND NOT (USE_HIP))
|
||||||
|
message(SEND_ERROR "`PLUGIN_RMM` must be enabled with `USE_HIP` flag.")
|
||||||
|
endif (PLUGIN_RMM AND NOT (USE_HIP))
|
||||||
|
|
||||||
if (PLUGIN_RMM AND NOT ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")))
|
if (PLUGIN_RMM AND NOT ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")))
|
||||||
message(SEND_ERROR "`PLUGIN_RMM` must be used with GCC or Clang compiler.")
|
message(SEND_ERROR "`PLUGIN_RMM` must be used with GCC or Clang compiler.")
|
||||||
endif (PLUGIN_RMM AND NOT ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")))
|
endif (PLUGIN_RMM AND NOT ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")))
|
||||||
@ -115,9 +140,13 @@ endif (ENABLE_ALL_WARNINGS)
|
|||||||
if (BUILD_STATIC_LIB AND (R_LIB OR JVM_BINDINGS))
|
if (BUILD_STATIC_LIB AND (R_LIB OR JVM_BINDINGS))
|
||||||
message(SEND_ERROR "Cannot build a static library libxgboost.a when R or JVM packages are enabled.")
|
message(SEND_ERROR "Cannot build a static library libxgboost.a when R or JVM packages are enabled.")
|
||||||
endif (BUILD_STATIC_LIB AND (R_LIB OR JVM_BINDINGS))
|
endif (BUILD_STATIC_LIB AND (R_LIB OR JVM_BINDINGS))
|
||||||
|
|
||||||
if (PLUGIN_RMM AND (NOT BUILD_WITH_CUDA_CUB))
|
if (PLUGIN_RMM AND (NOT BUILD_WITH_CUDA_CUB))
|
||||||
message(SEND_ERROR "Cannot build with RMM using cub submodule.")
|
message(SEND_ERROR "Cannot build with RMM using cub submodule.")
|
||||||
endif (PLUGIN_RMM AND (NOT BUILD_WITH_CUDA_CUB))
|
endif (PLUGIN_RMM AND (NOT BUILD_WITH_CUDA_CUB))
|
||||||
|
if (PLUGIN_RMM AND (NOT BUILD_WITH_HIP_CUB))
|
||||||
|
message(SEND_ERROR "Cannot build with RMM using cub submodule.")
|
||||||
|
endif (PLUGIN_RMM AND (NOT BUILD_WITH_HIP_CUB))
|
||||||
if (PLUGIN_FEDERATED)
|
if (PLUGIN_FEDERATED)
|
||||||
if (CMAKE_CROSSCOMPILING)
|
if (CMAKE_CROSSCOMPILING)
|
||||||
message(SEND_ERROR "Cannot cross compile with federated learning support")
|
message(SEND_ERROR "Cannot cross compile with federated learning support")
|
||||||
@ -158,6 +187,25 @@ if (USE_CUDA)
|
|||||||
endif ()
|
endif ()
|
||||||
endif (USE_CUDA)
|
endif (USE_CUDA)
|
||||||
|
|
||||||
|
if (USE_HIP)
|
||||||
|
set(USE_OPENMP ON CACHE BOOL "HIP requires OpenMP" FORCE)
|
||||||
|
# `export CXX=' is ignored by CMake HIP.
|
||||||
|
set(CMAKE_HIP_HOST_COMPILER ${CMAKE_CXX_COMPILER})
|
||||||
|
message(STATUS "Configured HIP host compiler: ${CMAKE_HIP_HOST_COMPILER}")
|
||||||
|
|
||||||
|
enable_language(HIP)
|
||||||
|
if (${CMAKE_HIP_COMPILER_VERSION} VERSION_LESS 11.0)
|
||||||
|
message(FATAL_ERROR "HIP version must be at least 11.0!")
|
||||||
|
endif()
|
||||||
|
set(GEN_CODE "")
|
||||||
|
format_gencode_flags("${GPU_COMPUTE_VER}" GEN_CODE)
|
||||||
|
add_subdirectory(${PROJECT_SOURCE_DIR}/gputreeshap)
|
||||||
|
|
||||||
|
if ((${CMAKE_HIP_COMPILER_VERSION} VERSION_GREATER_EQUAL 11.4) AND (NOT BUILD_WITH_HIP_CUB))
|
||||||
|
set(BUILD_WITH_HIP_CUB ON)
|
||||||
|
endif ()
|
||||||
|
endif (USE_HIP)
|
||||||
|
|
||||||
if (FORCE_COLORED_OUTPUT AND (CMAKE_GENERATOR STREQUAL "Ninja") AND
|
if (FORCE_COLORED_OUTPUT AND (CMAKE_GENERATOR STREQUAL "Ninja") AND
|
||||||
((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR
|
((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR
|
||||||
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")))
|
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user