Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed May 19, 2020
1 parent baa4741 commit 87975fe
Showing 1 changed file with 6 additions and 28 deletions.
34 changes: 6 additions & 28 deletions jvm-packages/xgboost4j/src/native/xgboost4j.cu
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ namespace xgboost {
namespace spark {

template <typename T>
T* RawPtr(std::vector<T> data) {
T const* RawPtr(std::vector<T> const& data) {
return data.data();
}

template <typename T>
T* RawPtr(thrust::device_vector<T> data) {
T const* RawPtr(thrust::device_vector<T> const& data) {
return data.data().get();
}

Expand Down Expand Up @@ -57,31 +57,6 @@ void CopyInterface(std::vector<xgboost::ArrayInterface> const& interface_arr,
}
}

// void CopyInterfaceToDevice(xgboost::ArrayInterface const &interface,
// thrust::device_vector<char>* data,
// thrust::device_vector<uint8_t> *mask,
// Json* p_out) {
// size_t element_size = interface.type[2];
// size_t size = element_size * interface.num_rows * interface.num_cols;
// data->resize(size);
// cudaMemcpyAsync(interface.data, data, size, cudaMemcpyDeviceToHost);

// mask->resize(interface.valid.Size());
// cudaMemcpyAsync(interface.valid.Data(), mask, interface.valid.Size(), cudaMemcpyHostToDevice);
// auto& out = *p_out;
// out["data"] = Integer(reinterpret_cast<Integer::Int>(data->data().get()));
// out["shape"] = Array(
// std::vector<Json>{Json(Integer(interface.num_rows)),
// Json(Integer(interface.num_cols))});

// out["mask"] = Object();
// out["mask"]["data"] = Integer(reinterpret_cast<Integer::Int>(mask->data().get()));
// out["mask"]["shape"] = Array(
// std::vector<Json>{Json(Integer(interface.num_rows)),
// Json(Integer(interface.num_cols))});
// }


namespace xgboost {
namespace spark {
template <typename DCont, typename VCont>
Expand Down Expand Up @@ -199,7 +174,10 @@ class DataIteratorProxy {
in.emplace_back(column);
}

Json out {Array()};
std::string temp;
Json::Dump(json_interface, &temp);
Json out { Json::Load({temp.c_str(), temp.size()}) };

std::vector<thrust::device_vector<char>> data;
std::vector<thrust::device_vector<uint8_t>> mask;
CopyInterface(in, cudaMemcpyHostToDevice, &data, &mask, &out);
Expand Down

0 comments on commit 87975fe

Please sign in to comment.