fix random

This commit is contained in:
Hui Liu 2024-01-21 12:48:41 -08:00
parent 9759e28e6a
commit 1e0ccf7b87
7 changed files with 19 additions and 5 deletions

View File

@ -256,9 +256,10 @@ if (USE_HIP)
find_package(rocthrust REQUIRED)
find_package(hipcub REQUIRED)
set(CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} -I${HIP_INCLUDE_DIRS} -I${HIP_INCLUDE_DIRS}/hip")
set(CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} -I${HIP_INCLUDE_DIRS}")
set(CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} -Wunused-result -w")
set(CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} -D__HIP_PLATFORM_AMD__")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${HIP_INCLUDE_DIRS}")
add_subdirectory(${PROJECT_SOURCE_DIR}/rocgputreeshap)
endif (USE_HIP)

View File

@ -55,8 +55,10 @@ void XGBBuildInfoDevice(Json *p_info) {
info["RCCL_VERSION"] = v;
info["NCCL_VERSION"] = v;
#if defined(XGBOOST_USE_DLOPEN_RCCL)
info["USE_DLOPEN_NCCL"] = Boolean{true};
info["USE_DLOPEN_RCCL"] = Boolean{true};
#else
info["USE_DLOPEN_NCCL"] = Boolean{false};
info["USE_DLOPEN_RCCL"] = Boolean{false};
#endif // defined(XGBOOST_USE_DLOPEN_RCCL)
#else

View File

@ -13,7 +13,6 @@
#include <thrust/system_error.h> // for system_error
#elif defined(XGBOOST_USE_RCCL)
#include "../common/cuda_to_hip.h"
#include "../common/device_helpers.hip.h"
#include <hip/hip_runtime_api.h> // for cudaPeekAtLastError
#include <dlfcn.h> // for dlclose, dlsym, dlopen
#include <rccl.h>

View File

@ -9,7 +9,15 @@
#include <nccl.h>
#elif defined(XGBOOST_USE_RCCL)
#include "../common/cuda_to_hip.h"
#include "../common/device_helpers.cuh"
#ifndef __HIP_PLATFORM_AMD__
#define __HIP_PLATFORM_AMD__
#endif
#ifndef THRUST_DEVICE_SYSTEM
#define THRUST_DEVICE_SYSTEM THRUST_DEVICE_SYSTEM_HIP
#endif
#include <hip/hip_runtime_api.h>
#include <rccl.h>
#endif

View File

@ -19,7 +19,7 @@ std::shared_ptr<HostDeviceVector<bst_feature_t>> ColumnSampler::ColSample(
auto p_new_features = std::make_shared<HostDeviceVector<bst_feature_t>>();
if (ctx_->IsCUDA()) {
#if defined(XGBOOST_USE_CUDA)
#if defined(XGBOOST_USE_CUDA) || defined(XGBOOST_USE_HIP)
cuda_impl::SampleFeature(ctx_, n, p_features, p_new_features, this->feature_weights_,
&this->weight_buffer_, &this->idx_buffer_, &rng_);
return p_new_features;

View File

@ -180,7 +180,7 @@ class ColumnSampler {
if (ctx->IsCPU()) {
std::iota(feature_set_tree_->HostVector().begin(), feature_set_tree_->HostVector().end(), 0);
} else {
#if defined(XGBOOST_USE_CUDA)
#if defined(XGBOOST_USE_CUDA) || defined(XGBOOST_USE_HIP)
cuda_impl::InitFeatureSet(ctx, feature_set_tree_);
#else
AssertGPUSupport();

4
src/common/random.hip Normal file
View File

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