fix Pointer Attr
This commit is contained in:
parent
9f072b50ba
commit
5e8b1842b9
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user