[dask] Fix ddqdm with empty partition. (#7510)

* Fix empty partition.

* war.
This commit is contained in:
Jiaming Yuan
2021-12-16 20:37:29 +08:00
committed by GitHub
parent a512b4b394
commit 70b12d898a
8 changed files with 59 additions and 35 deletions

View File

@@ -599,7 +599,7 @@ void MetaInfo::GetInfo(char const* key, bst_ulong* out_len, DataType dtype,
}
void MetaInfo::SetFeatureInfo(const char* key, const char **info, const bst_ulong size) {
if (size != 0) {
if (size != 0 && this->num_col_ != 0) {
CHECK_EQ(size, this->num_col_)
<< "Length of " << key << " must be equal to number of columns.";
}

View File

@@ -39,7 +39,7 @@ class CudfAdapterBatch : public detail::NoMetaInfo {
private:
common::Span<ArrayInterface<1>> columns_;
size_t num_rows_;
size_t num_rows_{0};
};
/*!

View File

@@ -16,8 +16,8 @@ namespace data {
// be supported in future. Does not currently support inferring row/column size
template <typename AdapterT>
SimpleDMatrix::SimpleDMatrix(AdapterT* adapter, float missing, int nthread) {
auto device =
adapter->DeviceIdx() < 0 ? dh::CurrentDevice() : adapter->DeviceIdx();
auto device = (adapter->DeviceIdx() < 0 || adapter->NumRows() == 0) ? dh::CurrentDevice()
: adapter->DeviceIdx();
CHECK_GE(device, 0);
dh::safe_cuda(cudaSetDevice(device));