add hip tests

This commit is contained in:
amdsc21
2023-03-11 00:38:16 +01:00
parent e961016e71
commit 204d0c9a53
18 changed files with 76 additions and 20 deletions

View File

@@ -146,7 +146,11 @@ TEST(GpuPredictor, LesserFeatures) {
// Very basic test of empty model
TEST(GPUPredictor, ShapStump) {
#if defined(XGBOOST_USE_CUDA)
cudaSetDevice(0);
#elif defined(XGBOOST_USE_HIP)
hipSetDevice(0);
#endif
Context ctx;
ctx.gpu_id = 0;

View File

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

View File

@@ -170,7 +170,7 @@ void TestPredictionWithLesserFeatures(std::string predictor_name) {
auto m_invalid = RandomDataGenerator(kRows, kTrainCols + 1, 0.5).GenerateDMatrix(false);
ASSERT_THROW({learner->Predict(m_invalid, false, &prediction, 0, 0);}, dmlc::Error);
#if defined(XGBOOST_USE_CUDA)
#if defined(XGBOOST_USE_CUDA) || defined(XGBOOST_USE_HIP)
HostDeviceVector<float> from_cpu;
learner->SetParam("predictor", "cpu_predictor");
learner->Predict(m_test, false, &from_cpu, 0, 0);
@@ -184,7 +184,7 @@ void TestPredictionWithLesserFeatures(std::string predictor_name) {
for (size_t i = 0; i < h_cpu.size(); ++i) {
ASSERT_NEAR(h_cpu[i], h_gpu[i], kRtEps);
}
#endif // defined(XGBOOST_USE_CUDA)
#endif // defined(XGBOOST_USE_CUDA) || defined(XGBOOST_USE_HIP)
}
void GBTreeModelForTest(gbm::GBTreeModel *model, uint32_t split_ind,