Make HostDeviceVector single gpu only (#4773)

* Make HostDeviceVector single gpu only
This commit is contained in:
Rong Ou
2019-08-25 14:51:13 -07:00
committed by Rory Mitchell
parent 41227d1933
commit 38ab79f889
54 changed files with 641 additions and 1621 deletions

View File

@@ -78,9 +78,9 @@ void MetaInfo::SetInfo(const char * c_key, std::string const& interface_str) {
} else {
LOG(FATAL) << "Unknown metainfo: " << key;
}
dst->Reshard(GPUDistribution(GPUSet::Range(ptr_device, 1)));
dst->SetDevice(ptr_device);
dst->Resize(length);
auto p_dst = thrust::device_pointer_cast(dst->DevicePointer(0));
auto p_dst = thrust::device_pointer_cast(dst->DevicePointer());
thrust::copy(p_src, p_src + length, p_dst);
}
} // namespace xgboost

View File

@@ -77,16 +77,14 @@ void SimpleCSRSource::FromDeviceColumnar(std::vector<Columnar> cols) {
dh::safe_cuda(cudaSetDevice(device));
GPUSet devices = GPUSet::Range(device, 1);
page_.offset.Reshard(GPUDistribution(devices));
page_.offset.SetDevice(device);
page_.offset.Resize(info.num_row_ + 1);
page_.data.Reshard(GPUDistribution(devices));
page_.data.SetDevice(device);
page_.data.Resize(info.num_nonzero_);
auto s_data = page_.data.DeviceSpan(device);
auto s_offsets = page_.offset.DeviceSpan(device);
auto s_data = page_.data.DeviceSpan();
auto s_offsets = page_.offset.DeviceSpan();
CHECK_EQ(s_offsets.size(), n_rows + 1);
int32_t constexpr kThreads = 256;