[EM] Avoid resizing host cache. (#10734)

* [EM] Avoid resizing host cache.

- Add SAM allocator and resource.
- Use page-based cache instead of stream-based cache.
This commit is contained in:
Jiaming Yuan
2024-08-23 06:34:01 +08:00
committed by GitHub
parent dbfafd8557
commit 55aef8f546
16 changed files with 264 additions and 146 deletions

View File

@@ -12,7 +12,7 @@
namespace xgboost {
TEST(CudaHostMalloc, Pinned) {
std::vector<float, common::cuda_impl::pinned_allocator<float>> vec;
std::vector<float, common::cuda_impl::PinnedAllocator<float>> vec;
vec.resize(10);
ASSERT_EQ(vec.size(), 10);
Context ctx;
@@ -25,7 +25,7 @@ TEST(CudaHostMalloc, Pinned) {
}
TEST(CudaHostMalloc, Managed) {
std::vector<float, common::cuda_impl::managed_allocator<float>> vec;
std::vector<float, common::cuda_impl::ManagedAllocator<float>> vec;
vec.resize(10);
#if defined(__linux__)
dh::safe_cuda(