Skip to content

Commit

Permalink
Small cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Jul 11, 2024
1 parent b225a7c commit a016a8e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/xgboost/host_device_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class HostDeviceVector {

void Resize(std::size_t new_size);
/** @brief Resize and initialize the data if the new size is larger than the old size. */
void Resize(size_t new_size, T v);
void Resize(std::size_t new_size, T v);

using value_type = T; // NOLINT

Expand Down
9 changes: 3 additions & 6 deletions src/common/host_device_vector.cu
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class HostDeviceVectorImpl {

void Extend(HostDeviceVectorImpl* other) {
auto ori_size = this->Size();
this->Resize(ori_size + other->Size(), T());
this->Resize(ori_size + other->Size(), T{});
if (HostCanWrite() && other->HostCanRead()) {
auto& h_vec = this->HostVector();
auto& other_vec = other->HostVector();
Expand Down Expand Up @@ -172,7 +172,7 @@ class HostDeviceVectorImpl {
}

template <typename... U>
auto ResizeImpl(std::size_t new_size, U&&... args) {
auto Resize(std::size_t new_size, U&&... args) {
if (new_size == Size()) {
return;
}
Expand All @@ -190,9 +190,6 @@ class HostDeviceVectorImpl {
}
}

void Resize(std::size_t new_size, T v) { this->ResizeImpl(new_size, v); }
void Resize(std::size_t new_size) { this->ResizeImpl(new_size); }

void LazySyncHost(GPUAccess access) {
if (HostCanAccess(access)) { return; }
if (HostCanRead()) {
Expand Down Expand Up @@ -410,7 +407,7 @@ void HostDeviceVector<T>::Resize(std::size_t new_size) {
}

template <typename T>
void HostDeviceVector<T>::Resize(size_t new_size, T v) {
void HostDeviceVector<T>::Resize(std::size_t new_size, T v) {
impl_->Resize(new_size, v);
}

Expand Down

0 comments on commit a016a8e

Please sign in to comment.