1 /*! 2 * Copyright 2020 XGBoost contributors 3 */ 4 #include "proxy_dmatrix.h" 5 #include "device_adapter.cuh" 6 7 namespace xgboost { 8 namespace data { 9 FromCudaColumnar(std::string interface_str)10void DMatrixProxy::FromCudaColumnar(std::string interface_str) { 11 std::shared_ptr<data::CudfAdapter> adapter {new data::CudfAdapter(interface_str)}; 12 auto const& value = adapter->Value(); 13 this->batch_ = adapter; 14 device_ = adapter->DeviceIdx(); 15 this->Info().num_col_ = adapter->NumColumns(); 16 this->Info().num_row_ = adapter->NumRows(); 17 if (device_ < 0) { 18 CHECK_EQ(this->Info().num_row_, 0); 19 } 20 } 21 FromCudaArray(std::string interface_str)22void DMatrixProxy::FromCudaArray(std::string interface_str) { 23 std::shared_ptr<CupyAdapter> adapter(new CupyAdapter(interface_str)); 24 this->batch_ = adapter; 25 device_ = adapter->DeviceIdx(); 26 this->Info().num_col_ = adapter->NumColumns(); 27 this->Info().num_row_ = adapter->NumRows(); 28 if (device_ < 0) { 29 CHECK_EQ(this->Info().num_row_, 0); 30 } 31 } 32 33 } // namespace data 34 } // namespace xgboost 35