fix uuid and Clear/SetValid
This commit is contained in:
@@ -37,21 +37,21 @@ class NcclDeviceCommunicator : public DeviceCommunicator {
|
||||
private:
|
||||
static constexpr std::size_t kUuidLength =
|
||||
#if defined(XGBOOST_USE_HIP)
|
||||
sizeof(std::declval<hipDeviceProp>().uuid) / sizeof(uint64_t);
|
||||
#else
|
||||
sizeof(hipUUID) / sizeof(uint64_t);
|
||||
#elif defined(XGBOOST_USE_CUDA)
|
||||
sizeof(std::declval<cudaDeviceProp>().uuid) / sizeof(uint64_t);
|
||||
#endif
|
||||
|
||||
void GetCudaUUID(xgboost::common::Span<uint64_t, kUuidLength> const &uuid) const {
|
||||
#if defined(XGBOOST_USE_HIP)
|
||||
hipDeviceProp prob{};
|
||||
dh::safe_cuda(hipGetDeviceProperties(&prob, device_ordinal_));
|
||||
#else
|
||||
hipUUID id;
|
||||
hipDeviceGetUuid(&id, device_ordinal_);
|
||||
std::memcpy(uuid.data(), static_cast<void *>(&id), sizeof(id));
|
||||
#elif defined(XGBOOST_USE_CUDA)
|
||||
cudaDeviceProp prob{};
|
||||
dh::safe_cuda(cudaGetDeviceProperties(&prob, device_ordinal_));
|
||||
#endif
|
||||
|
||||
std::memcpy(uuid.data(), static_cast<void *>(&(prob.uuid)), sizeof(prob.uuid));
|
||||
#endif
|
||||
}
|
||||
|
||||
static std::string PrintUUID(xgboost::common::Span<uint64_t, kUuidLength> const &uuid) {
|
||||
|
||||
Reference in New Issue
Block a user