Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
RAMitchell committed Jan 9, 2020
1 parent 3370ba1 commit 191d103
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/data/adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
*/
#ifndef XGBOOST_DATA_ADAPTER_H_
#define XGBOOST_DATA_ADAPTER_H_
#include <dmlc/data.h>
#include <limits>
#include <memory>
#include <string>

namespace xgboost {
namespace data {

Expand Down
7 changes: 5 additions & 2 deletions src/data/simple_dmatrix.cu
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ void CountRowOffsets(const AdapterBatchT& batch, common::Span<bst_row_t> offset,
dh::LaunchN(device_idx, batch.Size(), [=] __device__(size_t idx) {
auto element = batch.GetElement(idx);
if (IsValid(element.value, missing)) {
atomicAdd(&offset[element.row_idx], 1);
atomicAdd(reinterpret_cast<unsigned long long*>(&offset[element.row_idx]),
static_cast<unsigned long long>(1));
}
});

Expand All @@ -49,7 +50,9 @@ void CopyDataColumnMajor(AdapterT* adapter, common::Span<Entry> data,
// Populate column sizes
dh::LaunchN(device_idx, batch.Size(), [=] __device__(size_t idx) {
const auto& e = batch.GetElement(idx);
atomicAdd(&d_column_sizes[e.column_idx], 1);
atomicAdd(
reinterpret_cast<unsigned long long*>(&d_column_sizes[e.column_idx]),
static_cast<unsigned long long>(1));
});

thrust::host_vector<size_t> host_column_sizes = column_sizes;
Expand Down
4 changes: 2 additions & 2 deletions tests/cpp/data/test_simple_dmatrix.cu
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ TEST(SimpleCSRSource, FromColumnarSparse) {
for (auto& batch : dmat.GetBatches<SparsePage>()) {
for (auto i = 0ull; i < batch.Size(); i++) {
auto inst = batch[i];
for (auto j = 0ull; j < inst.size(); j++) {
ASSERT_NE(inst[j].fvalue, 2.0);
for (auto e : inst) {
ASSERT_NE(e.fvalue, 2.0);
}
}
}
Expand Down

0 comments on commit 191d103

Please sign in to comment.