use __HIPCC__ for device code
This commit is contained in:
@@ -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()};
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -28,19 +28,19 @@
|
||||
#include "filesystem.h" // dmlc::TemporaryDirectory
|
||||
#include "xgboost/linalg.h"
|
||||
|
||||
#if defined(__CUDACC__) || defined(__HIP_PLATFORM_AMD__)
|
||||
#if defined(__CUDACC__) || defined(__HIPCC__)
|
||||
#define DeclareUnifiedTest(name) GPU ## name
|
||||
#else
|
||||
#define DeclareUnifiedTest(name) name
|
||||
#endif
|
||||
|
||||
#if defined(__CUDACC__) || defined(__HIP_PLATFORM_AMD__)
|
||||
#if defined(__CUDACC__) || defined(__HIPCC__)
|
||||
#define GPUIDX (common::AllVisibleGPUs() == 1 ? 0 : collective::GetRank())
|
||||
#else
|
||||
#define GPUIDX (-1)
|
||||
#endif
|
||||
|
||||
#if defined(__CUDACC__) || defined(__HIP_PLATFORM_AMD__)
|
||||
#if defined(__CUDACC__) || defined(__HIPCC__)
|
||||
#define DeclareUnifiedDistributedTest(name) MGPU ## name
|
||||
#else
|
||||
#define DeclareUnifiedDistributedTest(name) name
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#if defined(__CUDACC__) || defined(__HIP_PLATFORM_AMD__)
|
||||
#if defined(__CUDACC__) || defined(__HIPCC__)
|
||||
#include "../../src/data/ellpack_page.cuh"
|
||||
#endif
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "./helpers.h" // for RandomDataGenerator
|
||||
|
||||
namespace xgboost {
|
||||
#if defined(__CUDACC__) || defined(__HIP_PLATFORM_AMD__)
|
||||
#if defined(__CUDACC__) || defined(__HIPCC__)
|
||||
namespace {
|
||||
class HistogramCutsWrapper : public common::HistogramCuts {
|
||||
public:
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
namespace xgboost {
|
||||
namespace metric {
|
||||
|
||||
#if !defined(__CUDACC__) && !defined(__HIP_PLATFORM_AMD__)
|
||||
#if !defined(__CUDACC__) && !defined(__HIPCC__)
|
||||
TEST(Metric, AMS) {
|
||||
auto ctx = MakeCUDACtx(GPUIDX);
|
||||
EXPECT_ANY_THROW(Metric::Create("ams", &ctx));
|
||||
|
||||
@@ -278,7 +278,7 @@ TEST(Objective, DeclareUnifiedTest(TweedieRegressionGPair)) {
|
||||
ASSERT_EQ(obj->DefaultEvalMetric(), std::string{"tweedie-nloglik@1.1"});
|
||||
}
|
||||
|
||||
#if defined(__CUDACC__) || defined(__HIP_PLATFORM_AMD__)
|
||||
#if defined(__CUDACC__) || defined(__HIPCC__)
|
||||
TEST(Objective, CPU_vs_CUDA) {
|
||||
Context ctx = MakeCUDACtx(GPUIDX);
|
||||
|
||||
@@ -356,7 +356,7 @@ TEST(Objective, DeclareUnifiedTest(TweedieRegressionBasic)) {
|
||||
}
|
||||
|
||||
// CoxRegression not implemented in GPU code, no need for testing.
|
||||
#if !defined(__CUDACC__) && !defined(__HIP_PLATFORM_AMD__)
|
||||
#if !defined(__CUDACC__) && !defined(__HIPCC__)
|
||||
TEST(Objective, CoxRegressionGPair) {
|
||||
Context ctx = MakeCUDACtx(GPUIDX);
|
||||
std::vector<std::pair<std::string, std::string>> args;
|
||||
|
||||
Reference in New Issue
Block a user