use __HIPCC__ for device code

This commit is contained in:
Hui Liu
2024-01-24 11:30:01 -08:00
parent 1e0ccf7b87
commit 069cf1d019
23 changed files with 68 additions and 72 deletions

View File

@@ -15,10 +15,10 @@
#include "../filesystem.h" // dmlc::TemporaryDirectory
#include "../helpers.h"
#if defined(__CUDACC__) || defined(__HIP_PLATFORM_AMD__)
#if defined(__CUDACC__) || defined(__HIPCC__)
#include <xgboost/json.h>
#include "../../../src/data/device_adapter.cuh"
#endif // __CUDACC__, __HIP_PLATFORM_AMD__
#endif // __CUDACC__, __HIPCC__
// Some helper functions used to test both GPU and CPU algorithms
//
@@ -47,7 +47,7 @@ inline std::vector<float> GenerateRandomWeights(int num_rows) {
return w;
}
#if defined(__CUDACC__) || defined(__HIP_PLATFORM_AMD__)
#if defined(__CUDACC__) || defined(__HIPCC__)
inline data::CupyAdapter AdapterFromData(const thrust::device_vector<float> &x,
int num_rows, int num_columns) {
Json array_interface{Object()};

View File

@@ -99,7 +99,7 @@ struct TestRBeginREnd {
Span<float> s (arr);
#if defined(__CUDA_ARCH__) || defined(__HIP_PLATFORM_AMD__)
#if defined(__CUDA_ARCH__) || defined(__HIPCC__)
auto rbeg = dh::trbegin(s);
auto rend = dh::trend(s);
#else

View File

@@ -14,7 +14,7 @@
namespace xgboost::common {
namespace {
constexpr DeviceOrd TransformDevice() {
#if defined(__CUDACC__) || defined(__HIP_PLATFORM_AMD__)
#if defined(__CUDACC__) || defined(__HIPCC__)
return DeviceOrd::CUDA(0);
#else
return DeviceOrd::CPU();
@@ -51,7 +51,7 @@ TEST(Transform, DeclareUnifiedTest(Basic)) {
ASSERT_TRUE(std::equal(h_sol.begin(), h_sol.end(), res.begin()));
}
#if !defined(__CUDACC__) && !defined(__HIP_PLATFORM_AMD__)
#if !defined(__CUDACC__) && !defined(__HIPCC__)
TEST(TransformDeathTest, Exception) {
size_t const kSize{16};
std::vector<float> h_in(kSize);