finish c_api.cu

This commit is contained in:
amdsc21 2023-03-10 05:11:20 +01:00
parent 61c0b19331
commit a76ccff390
3 changed files with 12 additions and 3 deletions

View File

@ -48,12 +48,14 @@ XGB_DLL void XGBoostVersion(int* major, int* minor, int* patch) {
using GlobalConfigAPIThreadLocalStore = dmlc::ThreadLocalStore<XGBAPIThreadLocalEntry>; using GlobalConfigAPIThreadLocalStore = dmlc::ThreadLocalStore<XGBAPIThreadLocalEntry>;
#if !defined(XGBOOST_USE_CUDA) #if !defined(XGBOOST_USE_CUDA) && !defined(XGBOOST_USE_HIP)
namespace xgboost { namespace xgboost {
void XGBBuildInfoDevice(Json *p_info) { void XGBBuildInfoDevice(Json *p_info) {
auto &info = *p_info; auto &info = *p_info;
info["USE_CUDA"] = Boolean{false}; info["USE_CUDA"] = Boolean{false};
info["USE_NCCL"] = Boolean{false}; info["USE_NCCL"] = Boolean{false};
info["USE_HIP"] = Boolean{false};
info["USE_RCCL"] = Boolean{false};
info["USE_RMM"] = Boolean{false}; info["USE_RMM"] = Boolean{false};
} }
} // namespace xgboost } // namespace xgboost
@ -264,7 +266,7 @@ XGB_DLL int XGDMatrixCreateFromDataIter(
API_END(); API_END();
} }
#ifndef XGBOOST_USE_CUDA #if !defined(XGBOOST_USE_CUDA) && !defined(XGBOOST_USE_HIP)
XGB_DLL int XGDMatrixCreateFromCudaColumnar(char const *, char const *, DMatrixHandle *) { XGB_DLL int XGDMatrixCreateFromCudaColumnar(char const *, char const *, DMatrixHandle *) {
API_BEGIN(); API_BEGIN();
common::AssertGPUSupport(); common::AssertGPUSupport();
@ -1073,7 +1075,7 @@ XGB_DLL int XGBoosterPredictFromCSR(BoosterHandle handle, char const *indptr, ch
API_END(); 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 *, XGB_DLL int XGBoosterPredictFromCUDAArray(BoosterHandle handle, char const *, char const *,
DMatrixHandle, xgboost::bst_ulong const **, DMatrixHandle, xgboost::bst_ulong const **,
xgboost::bst_ulong *, const float **) { xgboost::bst_ulong *, const float **) {

View File

@ -18,6 +18,7 @@ void XGBBuildInfoDevice(Json *p_info) {
auto &info = *p_info; auto &info = *p_info;
info["USE_CUDA"] = true; info["USE_CUDA"] = true;
info["USE_HIP"] = true;
std::vector<Json> v{Json{Integer{THRUST_MAJOR_VERSION}}, Json{Integer{THRUST_MINOR_VERSION}}, std::vector<Json> v{Json{Integer{THRUST_MAJOR_VERSION}}, Json{Integer{THRUST_MINOR_VERSION}},
Json{Integer{THRUST_SUBMINOR_VERSION}}}; Json{Integer{THRUST_SUBMINOR_VERSION}}};
@ -28,10 +29,12 @@ void XGBBuildInfoDevice(Json *p_info) {
#if defined(XGBOOST_USE_NCCL) #if defined(XGBOOST_USE_NCCL)
info["USE_NCCL"] = Boolean{true}; info["USE_NCCL"] = Boolean{true};
info["USE_RCCL"] = Boolean{true};
v = {Json{Integer{NCCL_MAJOR}}, Json{Integer{NCCL_MINOR}}, Json{Integer{NCCL_PATCH}}}; v = {Json{Integer{NCCL_MAJOR}}, Json{Integer{NCCL_MINOR}}, Json{Integer{NCCL_PATCH}}};
info["NCCL_VERSION"] = v; info["NCCL_VERSION"] = v;
#else #else
info["USE_NCCL"] = Boolean{false}; info["USE_NCCL"] = Boolean{false};
info["USE_RCCL"] = Boolean{false};
#endif #endif
#if defined(XGBOOST_USE_RMM) #if defined(XGBOOST_USE_RMM)

View File

@ -0,0 +1,4 @@
#if defined(XGBOOST_USE_HIP)
#include "c_api.cu"
#endif