Skip to content

Commit

Permalink
rename plugin; add tests for sycl_multiclass
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Razdoburdin committed Nov 8, 2023
1 parent 21694af commit 22aeed5
Show file tree
Hide file tree
Showing 37 changed files with 1,370 additions and 1,473 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ option(PLUGIN_DENSE_PARSER "Build dense parser plugin" OFF)
option(PLUGIN_RMM "Build with RAPIDS Memory Manager (RMM)" OFF)
option(PLUGIN_FEDERATED "Build with Federated Learning" OFF)
## TODO: 1. Add check if DPC++ compiler is used for building
option(PLUGIN_UPDATER_ONEAPI "DPC++ updater" OFF)
option(PLUGIN_SYCL "SYCL plugin" OFF)
option(ADD_PKGCONFIG "Add xgboost.pc into system." ON)

#-- Checks for building XGBoost
Expand Down Expand Up @@ -264,14 +264,14 @@ if (PLUGIN_RMM)
get_target_property(rmm_link_libs rmm::rmm INTERFACE_LINK_LIBRARIES)
endif (PLUGIN_RMM)

if (PLUGIN_UPDATER_ONEAPI)
if (PLUGIN_SYCL)
set(CMAKE_CXX_LINK_EXECUTABLE
"icpx <FLAGS> <CMAKE_CXX_LINK_FLAGS> -qopenmp <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
set(CMAKE_CXX_CREATE_SHARED_LIBRARY
"icpx <CMAKE_SHARED_LIBRARY_CXX_FLAGS> -qopenmp <LANGUAGE_COMPILE_FLAGS> \
<CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <SONAME_FLAG>,<TARGET_SONAME> \
-o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
endif (PLUGIN_UPDATER_ONEAPI)
endif (PLUGIN_SYCL)

#-- library
if (BUILD_STATIC_LIB)
Expand Down
36 changes: 18 additions & 18 deletions plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,37 @@ if (PLUGIN_DENSE_PARSER)
target_sources(objxgboost PRIVATE ${xgboost_SOURCE_DIR}/plugin/dense_parser/dense_libsvm.cc)
endif (PLUGIN_DENSE_PARSER)

if (PLUGIN_UPDATER_ONEAPI)
if (PLUGIN_SYCL)
set(CMAKE_CXX_COMPILER "icpx")
add_library(oneapi_plugin OBJECT
${xgboost_SOURCE_DIR}/plugin/updater_oneapi/hist_util_oneapi.cc
${xgboost_SOURCE_DIR}/plugin/updater_oneapi/regression_obj_oneapi.cc
${xgboost_SOURCE_DIR}/plugin/updater_oneapi/multiclass_obj_oneapi.cc
${xgboost_SOURCE_DIR}/plugin/updater_oneapi/updater_quantile_hist_oneapi.cc
${xgboost_SOURCE_DIR}/plugin/updater_oneapi/device_manager_oneapi.cc
${xgboost_SOURCE_DIR}/plugin/updater_oneapi/predictor_oneapi.cc)
target_include_directories(oneapi_plugin
add_library(plugin_sycl OBJECT
${xgboost_SOURCE_DIR}/plugin/sycl/common/hist_util.cc
${xgboost_SOURCE_DIR}/plugin/sycl/objective/regression_obj.cc
${xgboost_SOURCE_DIR}/plugin/sycl/objective/multiclass_obj.cc
${xgboost_SOURCE_DIR}/plugin/sycl/tree/updater_quantile_hist.cc
${xgboost_SOURCE_DIR}/plugin/sycl/device_manager.cc
${xgboost_SOURCE_DIR}/plugin/sycl/predictor/predictor.cc)
target_include_directories(plugin_sycl
PRIVATE
${xgboost_SOURCE_DIR}/include
${xgboost_SOURCE_DIR}/dmlc-core/include
${xgboost_SOURCE_DIR}/rabit/include)
target_compile_definitions(oneapi_plugin PUBLIC -DXGBOOST_USE_ONEAPI=1)
target_link_libraries(oneapi_plugin PUBLIC -fsycl)
set_target_properties(oneapi_plugin PROPERTIES
target_compile_definitions(plugin_sycl PUBLIC -DXGBOOST_USE_SYCL=1)
target_link_libraries(plugin_sycl PUBLIC -fsycl)
set_target_properties(plugin_sycl PROPERTIES
COMPILE_FLAGS -fsycl
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
POSITION_INDEPENDENT_CODE ON)
if (USE_OPENMP)
find_package(OpenMP REQUIRED)
set_target_properties(oneapi_plugin PROPERTIES
set_target_properties(plugin_sycl PROPERTIES
COMPILE_FLAGS "-fsycl -qopenmp")
endif (USE_OPENMP)
# Get compilation and link flags of oneapi_plugin and propagate to objxgboost
target_link_libraries(objxgboost PUBLIC oneapi_plugin)
# Add all objects of oneapi_plugin to objxgboost
target_sources(objxgboost INTERFACE $<TARGET_OBJECTS:oneapi_plugin>)
endif (PLUGIN_UPDATER_ONEAPI)
# Get compilation and link flags of plugin_sycl and propagate to objxgboost
target_link_libraries(objxgboost PUBLIC plugin_sycl)
# Add all objects of plugin_sycl to objxgboost
target_sources(objxgboost INTERFACE $<TARGET_OBJECTS:plugin_sycl>)
endif (PLUGIN_SYCL)

# Add the Federate Learning plugin if enabled.
if (PLUGIN_FEDERATED)
Expand Down
8 changes: 4 additions & 4 deletions plugin/updater_oneapi/README.md → plugin/sycl/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# DPC++-based Algorithm for Tree Construction
This plugin adds support of OneAPI programming model for tree construction and prediction algorithms to XGBoost.
# SYCL-based Algorithm for Tree Construction
This plugin adds support of SYCL programming model for tree construction and prediction algorithms to XGBoost.

## Usage
Specify the 'device' parameter as one of the following options to offload model training and inference on OneAPI device.
Specify the 'device' parameter as one of the following options to offload model training and inference on SYCL device.

### Algorithms
| device | Description |
Expand All @@ -27,6 +27,6 @@ From the command line on Linux starting from the xgboost directory:
```bash
$ mkdir build
$ cd build
$ EXPORT CXX=dpcpp && cmake .. -DPLUGIN_UPDATER_ONEAPI=ON
$ EXPORT CXX=dpcpp && cmake .. -DPLUGIN_SYCL=ON
$ make -j
```
Loading

0 comments on commit 22aeed5

Please sign in to comment.