diff --git a/demo/CLI/regression/runexp.sh b/demo/CLI/regression/runexp.sh index 900a80cce..80c8e3915 100755 --- a/demo/CLI/regression/runexp.sh +++ b/demo/CLI/regression/runexp.sh @@ -4,13 +4,13 @@ python mapfeat.py # split train and test python mknfold.py machine.txt 1 # training and output the models -../../xgboost machine.conf +../../../xgboost machine.conf # output predictions of test data -../../xgboost machine.conf task=pred model_in=0002.model +../../../xgboost machine.conf task=pred model_in=0002.model # print the boosters of 0002.model in dump.raw.txt -../../xgboost machine.conf task=dump model_in=0002.model name_dump=dump.raw.txt +../../../xgboost machine.conf task=dump model_in=0002.model name_dump=dump.raw.txt # print the boosters of 0002.model in dump.nice.txt with feature map -../../xgboost machine.conf task=dump model_in=0002.model fmap=featmap.txt name_dump=dump.nice.txt +../../../xgboost machine.conf task=dump model_in=0002.model fmap=featmap.txt name_dump=dump.nice.txt # cat the result cat dump.nice.txt diff --git a/src/data/array_interface.cu b/src/data/array_interface.cu index 5a72d66d7..789a3996c 100644 --- a/src/data/array_interface.cu +++ b/src/data/array_interface.cu @@ -59,7 +59,24 @@ bool ArrayInterfaceHandler::IsCudaPtr(void const* ptr) { return false; } #elif defined(XGBOOST_USE_HIP) - return false; + hipPointerAttribute_t attr; + auto err = hipPointerGetAttributes(&attr, ptr); + // reset error + CHECK_EQ(err, hipGetLastError()); + if (err == hipErrorInvalidValue) { + return false; + } else if (err == hipSuccess) { + switch (attr.memoryType) { + case hipMemoryTypeUnified: + case hipMemoryTypeHost: + return false; + default: + return true; + } + return true; + } else { + return false; + } #endif } } // namespace xgboost diff --git a/src/data/data.cu b/src/data/data.cu index 7854ccd3f..08a4f05fd 100644 --- a/src/data/data.cu +++ b/src/data/data.cu @@ -35,7 +35,11 @@ auto SetDeviceToPtr(void const* ptr) { dh::safe_cuda(cudaSetDevice(ptr_device)); return ptr_device; #elif defined(XGBOOST_USE_HIP) /* this is wrong, need to figure out */ - return 0; + hipPointerAttribute_t attr; + dh::safe_cuda(hipPointerGetAttributes(&attr, ptr)); + int32_t ptr_device = attr.device; + dh::safe_cuda(hipSetDevice(ptr_device)); + return ptr_device; #endif }