Replaced std::vector with HostDeviceVector in MetaInfo and SparsePage. (#3446)
* Replaced std::vector with HostDeviceVector in MetaInfo and SparsePage. - added distributions to HostDeviceVector - using HostDeviceVector for labels, weights and base margings in MetaInfo - using HostDeviceVector for offset and data in SparsePage - other necessary refactoring * Added const version of HostDeviceVector API calls. - const versions added to calls that can trigger data transfers, e.g. DevicePointer() - updated the code that uses HostDeviceVector - objective functions now accept const HostDeviceVector<bst_float>& for predictions * Updated src/linear/updater_gpu_coordinate.cu. * Added read-only state for HostDeviceVector sync. - this means no copies are performed if both host and devices access the HostDeviceVector read-only * Fixed linter and test errors. - updated the lz4 plugin - added ConstDeviceSpan to HostDeviceVector - using device % dh::NVisibleDevices() for the physical device number, e.g. in calls to cudaSetDevice() * Fixed explicit template instantiation errors for HostDeviceVector. - replaced HostDeviceVector<unsigned int> with HostDeviceVector<int> * Fixed HostDeviceVector tests that require multiple GPUs. - added a mock set device handler; when set, it is called instead of cudaSetDevice()
This commit is contained in:
committed by
Rory Mitchell
parent
58d783df16
commit
72cd1517d6
@@ -259,7 +259,7 @@ class GPUCoordinateUpdater : public LinearUpdater {
|
||||
monitor.Start("UpdateGpair");
|
||||
// Update gpair
|
||||
dh::ExecuteShards(&shards, [&](std::unique_ptr<DeviceShard> &shard) {
|
||||
shard->UpdateGpair(in_gpair->HostVector(), model->param);
|
||||
shard->UpdateGpair(in_gpair->ConstHostVector(), model->param);
|
||||
});
|
||||
monitor.Stop("UpdateGpair");
|
||||
|
||||
@@ -267,7 +267,7 @@ class GPUCoordinateUpdater : public LinearUpdater {
|
||||
this->UpdateBias(p_fmat, model);
|
||||
monitor.Stop("UpdateBias");
|
||||
// prepare for updating the weights
|
||||
selector->Setup(*model, in_gpair->HostVector(), p_fmat,
|
||||
selector->Setup(*model, in_gpair->ConstHostVector(), p_fmat,
|
||||
param.reg_alpha_denorm, param.reg_lambda_denorm,
|
||||
param.top_k);
|
||||
monitor.Start("UpdateFeature");
|
||||
@@ -275,7 +275,7 @@ class GPUCoordinateUpdater : public LinearUpdater {
|
||||
++group_idx) {
|
||||
for (auto i = 0U; i < model->param.num_feature; i++) {
|
||||
auto fidx = selector->NextFeature(
|
||||
i, *model, group_idx, in_gpair->HostVector(), p_fmat,
|
||||
i, *model, group_idx, in_gpair->ConstHostVector(), p_fmat,
|
||||
param.reg_alpha_denorm, param.reg_lambda_denorm);
|
||||
if (fidx < 0) break;
|
||||
this->UpdateFeature(fidx, group_idx, &in_gpair->HostVector(), model);
|
||||
|
||||
Reference in New Issue
Block a user