From a76ccff3905f7870dfd8d4dd67d81167b29c9f71 Mon Sep 17 00:00:00 2001 From: amdsc21 <96135754+amdsc21@users.noreply.github.com> Date: Fri, 10 Mar 2023 05:11:20 +0100 Subject: [PATCH] finish c_api.cu --- src/c_api/c_api.cc | 8 +++++--- src/c_api/c_api.cu | 3 +++ src/c_api/c_api.hip | 4 ++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/c_api/c_api.cc b/src/c_api/c_api.cc index 59cb429da..74a0107e1 100644 --- a/src/c_api/c_api.cc +++ b/src/c_api/c_api.cc @@ -48,12 +48,14 @@ XGB_DLL void XGBoostVersion(int* major, int* minor, int* patch) { using GlobalConfigAPIThreadLocalStore = dmlc::ThreadLocalStore; -#if !defined(XGBOOST_USE_CUDA) +#if !defined(XGBOOST_USE_CUDA) && !defined(XGBOOST_USE_HIP) namespace xgboost { void XGBBuildInfoDevice(Json *p_info) { auto &info = *p_info; info["USE_CUDA"] = Boolean{false}; info["USE_NCCL"] = Boolean{false}; + info["USE_HIP"] = Boolean{false}; + info["USE_RCCL"] = Boolean{false}; info["USE_RMM"] = Boolean{false}; } } // namespace xgboost @@ -264,7 +266,7 @@ XGB_DLL int XGDMatrixCreateFromDataIter( API_END(); } -#ifndef XGBOOST_USE_CUDA +#if !defined(XGBOOST_USE_CUDA) && !defined(XGBOOST_USE_HIP) XGB_DLL int XGDMatrixCreateFromCudaColumnar(char const *, char const *, DMatrixHandle *) { API_BEGIN(); common::AssertGPUSupport(); @@ -1073,7 +1075,7 @@ XGB_DLL int XGBoosterPredictFromCSR(BoosterHandle handle, char const *indptr, ch API_END(); } -#if !defined(XGBOOST_USE_CUDA) +#if !defined(XGBOOST_USE_CUDA) && !defined(XGBOOST_USE_HIP) XGB_DLL int XGBoosterPredictFromCUDAArray(BoosterHandle handle, char const *, char const *, DMatrixHandle, xgboost::bst_ulong const **, xgboost::bst_ulong *, const float **) { diff --git a/src/c_api/c_api.cu b/src/c_api/c_api.cu index e6201b0fd..61e6ca44e 100644 --- a/src/c_api/c_api.cu +++ b/src/c_api/c_api.cu @@ -18,6 +18,7 @@ void XGBBuildInfoDevice(Json *p_info) { auto &info = *p_info; info["USE_CUDA"] = true; + info["USE_HIP"] = true; std::vector v{Json{Integer{THRUST_MAJOR_VERSION}}, Json{Integer{THRUST_MINOR_VERSION}}, Json{Integer{THRUST_SUBMINOR_VERSION}}}; @@ -28,10 +29,12 @@ void XGBBuildInfoDevice(Json *p_info) { #if defined(XGBOOST_USE_NCCL) info["USE_NCCL"] = Boolean{true}; + info["USE_RCCL"] = Boolean{true}; v = {Json{Integer{NCCL_MAJOR}}, Json{Integer{NCCL_MINOR}}, Json{Integer{NCCL_PATCH}}}; info["NCCL_VERSION"] = v; #else info["USE_NCCL"] = Boolean{false}; + info["USE_RCCL"] = Boolean{false}; #endif #if defined(XGBOOST_USE_RMM) diff --git a/src/c_api/c_api.hip b/src/c_api/c_api.hip index e69de29bb..715845ea3 100644 --- a/src/c_api/c_api.hip +++ b/src/c_api/c_api.hip @@ -0,0 +1,4 @@ + +#if defined(XGBOOST_USE_HIP) +#include "c_api.cu" +#endif