Skip to content

Commit

Permalink
Use host_mr_options in JNI
Browse files Browse the repository at this point in the history
  • Loading branch information
abellina committed May 22, 2024
1 parent 5b3e7a2 commit fd0d2b4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion cpp/include/cudf/io/memory_resource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ struct host_mr_options {
* @return The previous resource that was in use
*/
rmm::host_async_resource_ref set_host_memory_resource(
rmm::host_async_resource_ref mr, std::optional<host_mr_options> const& default_opts = std::nullopt);
rmm::host_async_resource_ref mr,
std::optional<host_mr_options> const& default_opts = std::nullopt);

/**
* @brief Get the rmm resource being used for host memory allocations by
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/io/utilities/config_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ rmm::host_async_resource_ref set_host_memory_resource(
rmm::host_async_resource_ref mr, std::optional<host_mr_options> const& default_opts)
{
std::scoped_lock lock{host_mr_mutex()};
auto last_mr = host_mr(default_opts);
host_mr(std::nullopt) = mr;
auto last_mr = host_mr(default_opts);
host_mr(std::nullopt) = mr;
return last_mr;
}

Expand Down
4 changes: 3 additions & 1 deletion java/src/main/native/src/RmmJni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,9 @@ JNIEXPORT void JNICALL Java_ai_rapids_cudf_Rmm_setCuioPinnedPoolMemoryResource(J
// if the regular pinned pool is exhausted
pinned_fallback_mr.reset(new pinned_fallback_host_memory_resource(pool));
// set the cuio host mr and store the prior resource in our static variable
prior_cuio_host_mr() = cudf::io::set_host_memory_resource(*pinned_fallback_mr);
// we pass host_mr_options{0} so we disable any default pinned pool creation from cuDF
prior_cuio_host_mr() =
cudf::io::set_host_memory_resource(*pinned_fallback_mr, cudf::io::host_mr_options{0});
}
CATCH_STD(env, )
}
Expand Down

0 comments on commit fd0d2b4

Please sign in to comment.