Skip to content

Commit

Permalink
Remove get_mem_info functions from custom memory resources (rapidsai#…
Browse files Browse the repository at this point in the history
…14832)

Part of rapidsai/rmm#1388. This removes now-optional and soon-to-be deprecated functions from cuDF's custom device_memory_resource implementations:
 * `supports_get_mem_info()`
 * `do_get_mem_info()`

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

Approvers:
  - Jason Lowe (https://github.com/jlowe)
  - Nghia Truong (https://github.com/ttnghia)
  - Vukasin Milovanovic (https://github.com/vuule)

URL: rapidsai#14832
  • Loading branch information
harrism authored and PointKernel committed Jan 25, 2024
1 parent 326edab commit 914159b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 39 deletions.
27 changes: 1 addition & 26 deletions cpp/include/cudf_test/stream_checking_resource_adaptor.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2023, NVIDIA CORPORATION.
* Copyright (c) 2022-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -71,16 +71,6 @@ class stream_checking_resource_adaptor final : public rmm::mr::device_memory_res
*/
bool supports_streams() const noexcept override { return upstream_->supports_streams(); }

/**
* @brief Query whether the resource supports the get_mem_info API.
*
* @return Whether or not the upstream resource supports get_mem_info
*/
bool supports_get_mem_info() const noexcept override
{
return upstream_->supports_get_mem_info();
}

private:
/**
* @brief Allocates memory of size at least `bytes` using the upstream
Expand Down Expand Up @@ -131,21 +121,6 @@ class stream_checking_resource_adaptor final : public rmm::mr::device_memory_res
: upstream_->is_equal(other);
}

/**
* @brief Get free and available memory from upstream resource.
*
* @throws `rmm::cuda_error` if unable to retrieve memory info.
* @throws `cudf::logic_error` if attempted on a default stream
*
* @param stream Stream on which to get the mem info.
* @return std::pair with available and free memory for resource
*/
std::pair<std::size_t, std::size_t> do_get_mem_info(rmm::cuda_stream_view stream) const override
{
verify_stream(stream);
return upstream_->get_mem_info(stream);
}

/**
* @brief Throw an error if the provided stream is invalid.
*
Expand Down
14 changes: 1 addition & 13 deletions java/src/main/native/src/RmmJni.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2023, NVIDIA CORPORATION.
* Copyright (c) 2019-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -96,8 +96,6 @@ class tracking_resource_adaptor final : public base_tracking_resource_adaptor {
return scoped_max_total_allocated;
}

bool supports_get_mem_info() const noexcept override { return resource->supports_get_mem_info(); }

bool supports_streams() const noexcept override { return resource->supports_streams(); }

private:
Expand Down Expand Up @@ -144,10 +142,6 @@ class tracking_resource_adaptor final : public base_tracking_resource_adaptor {
scoped_allocated -= size;
}
}

std::pair<size_t, size_t> do_get_mem_info(rmm::cuda_stream_view stream) const override {
return resource->get_mem_info(stream);
}
};

template <typename Upstream>
Expand Down Expand Up @@ -213,8 +207,6 @@ class java_event_handler_memory_resource : public device_memory_resource {

device_memory_resource *get_wrapped_resource() { return resource; }

bool supports_get_mem_info() const noexcept override { return resource->supports_get_mem_info(); }

bool supports_streams() const noexcept override { return resource->supports_streams(); }

private:
Expand Down Expand Up @@ -277,10 +269,6 @@ class java_event_handler_memory_resource : public device_memory_resource {
}
}

std::pair<size_t, size_t> do_get_mem_info(rmm::cuda_stream_view stream) const override {
return resource->get_mem_info(stream);
}

protected:
JavaVM *jvm;
jobject handler_obj;
Expand Down

0 comments on commit 914159b

Please sign in to comment.