Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Remove RAFT memory management #400

Merged
34 changes: 0 additions & 34 deletions cpp/include/raft/cudart_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,40 +299,6 @@ void print_device_vector(const char* variable_name,
}
/** @} */

static std::mutex mutex_;
static std::unordered_map<void*, size_t> allocations;

template <typename Type>
void allocate(Type*& ptr, size_t len, rmm::cuda_stream_view stream, bool setZero = false)
{
size_t size = len * sizeof(Type);
ptr = (Type*)rmm::mr::get_current_device_resource()->allocate(size, stream);
if (setZero) CUDA_CHECK(cudaMemsetAsync((void*)ptr, 0, size, stream));

std::lock_guard<std::mutex> _(mutex_);
allocations[ptr] = size;
}

template <typename Type>
void deallocate(Type*& ptr, rmm::cuda_stream_view stream)
{
std::lock_guard<std::mutex> _(mutex_);
size_t size = allocations[ptr];
allocations.erase(ptr);
rmm::mr::get_current_device_resource()->deallocate((void*)ptr, size, stream);
}

inline void deallocate_all(rmm::cuda_stream_view stream)
{
std::lock_guard<std::mutex> _(mutex_);
for (auto& alloc : allocations) {
void* ptr = alloc.first;
size_t size = alloc.second;
rmm::mr::get_current_device_resource()->deallocate(ptr, size, stream);
}
allocations.clear();
}

/** helper method to get max usable shared mem per block parameter */
inline int getSharedMemPerBlock()
{
Expand Down
70 changes: 0 additions & 70 deletions cpp/include/raft/mr/allocator.hpp

This file was deleted.

211 changes: 0 additions & 211 deletions cpp/include/raft/mr/buffer_base.hpp

This file was deleted.

57 changes: 0 additions & 57 deletions cpp/include/raft/mr/device/allocator.hpp

This file was deleted.

Loading