Loop over copy_if (#6201)

* Loop over copy_if

* Catch OOM.

Co-authored-by: fis <jm.yuan@outlook.com>
This commit is contained in:
Rory Mitchell
2020-10-14 10:23:16 +13:00
committed by GitHub
parent 0fc263ead5
commit 734a911a26
3 changed files with 64 additions and 18 deletions

View File

@@ -156,5 +156,13 @@ TEST(SegmentedUnique, Regression) {
TestSegmentedUniqueRegression(values, 0);
}
}
TEST(Allocator, OOM) {
auto size = dh::AvailableMemory(0) * 4;
ASSERT_THROW({dh::caching_device_vector<char> vec(size);}, dmlc::Error);
ASSERT_THROW({dh::device_vector<char> vec(size);}, dmlc::Error);
// Clear last error so we don't fail subsequent tests
cudaGetLastError();
}
} // namespace common
} // namespace xgboost
} // namespace xgboost