Skip to content

Commit

Permalink
Deprecate rmm::mr::device_memory_resource::get_mem_info() and support…
Browse files Browse the repository at this point in the history
…s_get_mem_info(). (#1436)

Closes #1427 . Part of #1388.

#1430 made these functions non-virtual and removed them from all MRs and tests. This PR completes the next step of deprecating them.  

Merge after 
 - rapidsai/raft#2108
 - rapidsai/cudf#14832

Authors:
  - Mark Harris (https://github.com/harrism)

Approvers:
  - Lawrence Mitchell (https://github.com/wence-)
  - Michael Schellenberger Costa (https://github.com/miscco)
  - Bradley Dice (https://github.com/bdice)

URL: #1436
  • Loading branch information
harrism authored Jan 26, 2024
1 parent 19d8ef9 commit e374a27
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 37 deletions.
31 changes: 14 additions & 17 deletions include/rmm/mr/device/device_memory_resource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,21 +304,32 @@ class device_memory_resource {
/**
* @brief Query whether the resource supports the get_mem_info API.
*
* @deprecated Use rmm::available_device_memory instead.
*
* @return bool true if the resource supports get_mem_info, false otherwise.
*/
[[nodiscard]] virtual bool supports_get_mem_info() const noexcept { return false; };
[[deprecated("Use rmm::available_device_memory instead.")]] //
[[nodiscard]] virtual bool
supports_get_mem_info() const noexcept
{
return false;
};

/**
* @brief Queries the amount of free and total memory for the resource.
*
* @deprecated Use rmm::available_device_memory instead.
*
* @param stream the stream whose memory manager we want to retrieve
*
* @returns a pair containing the free memory in bytes in .first and total amount of memory in
* .second
*/
[[nodiscard]] std::pair<std::size_t, std::size_t> get_mem_info(cuda_stream_view stream) const
[[deprecated("Use rmm::available_device_memory instead.")]] //
[[nodiscard]] std::pair<std::size_t, std::size_t>
get_mem_info(cuda_stream_view stream) const
{
return do_get_mem_info(stream);
return {0, 0};
}

/**
Expand Down Expand Up @@ -374,20 +385,6 @@ class device_memory_resource {
{
return this == &other;
}

/**
* @brief Get free and available memory for memory resource
*
* @throws std::runtime_error if we could not get free / total memory
*
* @param stream the stream being executed on
* @return std::pair with available and free memory for resource
*/
[[nodiscard]] virtual std::pair<std::size_t, std::size_t> do_get_mem_info(
cuda_stream_view stream) const
{
return {0, 0};
}
};
static_assert(cuda::mr::async_resource_with<device_memory_resource, cuda::mr::device_accessible>);
/** @} */ // end of group
Expand Down
20 changes: 0 additions & 20 deletions include/rmm/mr/pinned_host_memory_resource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,26 +177,6 @@ class pinned_host_memory_resource {
*/
bool operator!=(const pinned_host_memory_resource&) const { return false; }

/**
* @brief Query whether the resource supports reporting free and available memory.
*
* @return false
*/
static bool supports_get_mem_info() { return false; }

/**
* @brief Query the total amount of memory and free memory available for allocation by this
* resource.
*
* @throws nothing
*
* @return std::pair containing 0 for both total and free memory.
*/
[[nodiscard]] static std::pair<std::size_t, std::size_t> get_mem_info(cuda::stream_ref) noexcept
{
return {0, 0};
}

/**
* @brief Enables the `cuda::mr::device_accessible` property
*
Expand Down

0 comments on commit e374a27

Please sign in to comment.