Skip to content

Commit

Permalink
Switch cuIO benchmarks to use pinned-pool host allocations by default. (
Browse files Browse the repository at this point in the history
#15805)

Previously, the benchmarks used a non-pooled pinned memory allocator by default, and exposed an option to use an internally-declared pooled pinned allocator.  Now that we have a pooled pinned allocator enabled in cuIO itself, this PR switches to using that as the new default for the benchmarks.

Authors:
  - https://github.com/nvdbaranec

Approvers:
  - Mike Wilson (https://github.com/hyperbolic2346)
  - Nghia Truong (https://github.com/ttnghia)
  - Yunsong Wang (https://github.com/PointKernel)
  - Mark Harris (https://github.com/harrism)

URL: #15805
  • Loading branch information
nvdbaranec authored May 22, 2024
1 parent be08b99 commit 24320a1
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions cpp/benchmarks/fixture/nvbench_fixture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ static std::string cuio_host_mem_param{
* Initializes the default memory resource to use the RMM pool device resource.
*/
struct nvbench_base_fixture {
using host_pooled_mr_t = rmm::mr::pool_memory_resource<rmm::mr::pinned_host_memory_resource>;

inline auto make_cuda() { return std::make_shared<rmm::mr::cuda_memory_resource>(); }

inline auto make_pool()
Expand Down Expand Up @@ -90,22 +88,10 @@ struct nvbench_base_fixture {
return *mr;
}

inline rmm::host_async_resource_ref make_cuio_host_pinned_pool()
{
if (!this->host_pooled_mr) {
// Don't store in static, as the CUDA context may be destroyed before static destruction
this->host_pooled_mr = std::make_shared<host_pooled_mr_t>(
std::make_shared<rmm::mr::pinned_host_memory_resource>().get(),
size_t{1} * 1024 * 1024 * 1024);
}

return *this->host_pooled_mr;
}

inline rmm::host_async_resource_ref create_cuio_host_memory_resource(std::string const& mode)
{
if (mode == "pinned") return make_cuio_host_pinned();
if (mode == "pinned_pool") return make_cuio_host_pinned_pool();
if (mode == "pinned_pool") return cudf::io::get_host_memory_resource();
CUDF_FAIL("Unknown cuio_host_mem parameter: " + mode + "\nExpecting: pinned or pinned_pool");
}

Expand Down Expand Up @@ -139,8 +125,7 @@ struct nvbench_base_fixture {
std::shared_ptr<rmm::mr::device_memory_resource> mr;
std::string rmm_mode{"pool"};

std::shared_ptr<host_pooled_mr_t> host_pooled_mr;
std::string cuio_host_mode{"pinned"};
std::string cuio_host_mode{"pinned_pool"};
};

} // namespace cudf

0 comments on commit 24320a1

Please sign in to comment.