Set device in device dmatrix. (#5596)

This commit is contained in:
Jiaming Yuan
2020-04-25 13:42:53 +08:00
committed by GitHub
parent ef26bc45bf
commit e726dd9902
8 changed files with 41 additions and 5 deletions

View File

@@ -99,6 +99,7 @@ void CopyDataRowMajor(AdapterT* adapter, common::Span<Entry> data,
// be supported in future. Does not currently support inferring row/column size
template <typename AdapterT>
SimpleDMatrix::SimpleDMatrix(AdapterT* adapter, float missing, int nthread) {
dh::safe_cuda(cudaSetDevice(adapter->DeviceIdx()));
CHECK(adapter->NumRows() != kAdapterUnknownSize);
CHECK(adapter->NumColumns() != kAdapterUnknownSize);