Skip to content

Commit

Permalink
Drop memory resources in libcu++
Browse files Browse the repository at this point in the history
  • Loading branch information
miscco committed Nov 19, 2024
1 parent f31495e commit 01200f6
Show file tree
Hide file tree
Showing 18 changed files with 19 additions and 1,434 deletions.
2 changes: 1 addition & 1 deletion cudax/examples/simple_p2p.cu
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void test_cross_device_access_from_kernel(

// This will be a pinned memory vector once available
cudax::uninitialized_buffer<float, cuda::mr::host_accessible> host_buffer(
cuda::mr::pinned_memory_resource(), dev0_buffer.size());
cudax::mr::pinned_memory_resource(), dev0_buffer.size());
std::generate(host_buffer.begin(), host_buffer.end(), []() {
static int i = 0;
return static_cast<float>((i++) % 4096);
Expand Down
4 changes: 2 additions & 2 deletions cudax/test/algorithm/common.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ namespace cuda::experimental
// Need a type that goes through all launch_transform steps, but is not a contiguous_range
struct weird_buffer
{
const cuda::mr::pinned_memory_resource& resource;
const mr::pinned_memory_resource& resource;
int* data;
std::size_t size;

weird_buffer(const cuda::mr::pinned_memory_resource& res, std::size_t s)
weird_buffer(const mr::pinned_memory_resource& res, std::size_t s)
: resource(res)
, data((int*) res.allocate(s * sizeof(int)))
, size(s)
Expand Down
8 changes: 4 additions & 4 deletions cudax/test/algorithm/copy.cu
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ TEST_CASE("Copy", "[data_manipulation]")

SECTION("Host and managed resource")
{
cuda::mr::managed_memory_resource managed_resource;
cuda::mr::pinned_memory_resource host_resource;
cudax::mr::managed_memory_resource managed_resource;
cudax::mr::pinned_memory_resource host_resource;

{
cudax::uninitialized_buffer<int, cuda::mr::host_accessible> host_buffer(host_resource, buffer_size);
Expand Down Expand Up @@ -78,7 +78,7 @@ TEST_CASE("Copy", "[data_manipulation]")
}
SECTION("Launch transform")
{
cuda::mr::pinned_memory_resource host_resource;
cudax::mr::pinned_memory_resource host_resource;
cudax::weird_buffer input(host_resource, buffer_size);
cudax::weird_buffer output(host_resource, buffer_size);

Expand All @@ -90,7 +90,7 @@ TEST_CASE("Copy", "[data_manipulation]")

SECTION("Asymetric size")
{
cuda::mr::pinned_memory_resource host_resource;
cudax::mr::pinned_memory_resource host_resource;
cudax::uninitialized_buffer<int, cuda::mr::host_accessible> host_buffer(host_resource, 1);
cudax::fill_bytes(_stream, host_buffer, fill_byte);

Expand Down
6 changes: 3 additions & 3 deletions cudax/test/algorithm/fill.cu
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ TEST_CASE("Fill", "[data_manipulation]")
cudax::stream _stream;
SECTION("Host resource")
{
cuda::mr::pinned_memory_resource host_resource;
cudax::mr::pinned_memory_resource host_resource;
cudax::uninitialized_buffer<int, cuda::mr::device_accessible> buffer(host_resource, buffer_size);

cudax::fill_bytes(_stream, buffer, fill_byte);
Expand All @@ -25,7 +25,7 @@ TEST_CASE("Fill", "[data_manipulation]")

SECTION("Device resource")
{
cuda::mr::device_memory_resource device_resource;
cudax::mr::device_memory_resource device_resource;
cudax::uninitialized_buffer<int, cuda::mr::device_accessible> buffer(device_resource, buffer_size);
cudax::fill_bytes(_stream, buffer, fill_byte);

Expand All @@ -37,7 +37,7 @@ TEST_CASE("Fill", "[data_manipulation]")
}
SECTION("Launch transform")
{
cuda::mr::pinned_memory_resource host_resource;
cudax::mr::pinned_memory_resource host_resource;
cudax::weird_buffer buffer(host_resource, buffer_size);

cudax::fill_bytes(_stream, buffer, fill_byte);
Expand Down
18 changes: 9 additions & 9 deletions cudax/test/containers/uninitialized_buffer.cu
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
#include <thrust/fill.h>
#include <thrust/reduce.h>

#include <cuda/memory_resource>
#include <cuda/std/cstdint>
#include <cuda/std/span>
#include <cuda/std/type_traits>
#include <cuda/std/utility>

#include <cuda/experimental/buffer.cuh>
#include <cuda/experimental/launch.cuh>
#include <cuda/experimental/memory_resource.cuh>
#include <cuda/experimental/stream.cuh>

#include "testing.cuh"
Expand Down Expand Up @@ -56,7 +56,7 @@ constexpr int get_property(
{
return 42;
}
constexpr int get_property(const cuda::mr::device_memory_resource&, my_property)
constexpr int get_property(const cudax::mr::device_memory_resource&, my_property)
{
return 42;
}
Expand All @@ -69,7 +69,7 @@ TEMPLATE_TEST_CASE(
static_assert(!cuda::std::is_copy_constructible<uninitialized_buffer>::value, "");
static_assert(!cuda::std::is_copy_assignable<uninitialized_buffer>::value, "");

cuda::mr::device_memory_resource resource{};
cudax::mr::device_memory_resource resource{};

SECTION("construction")
{
Expand Down Expand Up @@ -111,7 +111,7 @@ TEMPLATE_TEST_CASE(
{
static_assert(!cuda::std::is_copy_assignable<uninitialized_buffer>::value, "");
{
cuda::mr::managed_memory_resource other_resource{};
cudax::mr::managed_memory_resource other_resource{};
uninitialized_buffer input{other_resource, 42};
uninitialized_buffer buf{resource, 1337};
const auto* old_ptr = buf.data();
Expand Down Expand Up @@ -222,7 +222,7 @@ TEST_CASE("uninitialized_buffer is usable with cudax::launch", "[container]")
SECTION("non-const")
{
const int grid_size = 4;
cudax::uninitialized_buffer<int, ::cuda::mr::device_accessible> buffer{cuda::mr::device_memory_resource{}, 1024};
cudax::uninitialized_buffer<int, ::cuda::mr::device_accessible> buffer{cudax::mr::device_memory_resource{}, 1024};
auto dimensions = cudax::make_hierarchy(cudax::grid_dims(grid_size), cudax::block_dims<256>());

cudax::stream stream;
Expand All @@ -234,7 +234,7 @@ TEST_CASE("uninitialized_buffer is usable with cudax::launch", "[container]")
{
const int grid_size = 4;
const cudax::uninitialized_buffer<int, ::cuda::mr::device_accessible> buffer{
cuda::mr::device_memory_resource{}, 1024};
cudax::mr::device_memory_resource{}, 1024};
auto dimensions = cudax::make_hierarchy(cudax::grid_dims(grid_size), cudax::block_dims<256>());

cudax::stream stream;
Expand All @@ -245,7 +245,7 @@ TEST_CASE("uninitialized_buffer is usable with cudax::launch", "[container]")

// A test resource that keeps track of the number of resources are
// currently alive.
struct test_device_memory_resource : cuda::mr::device_memory_resource
struct test_device_memory_resource : cudax::mr::device_memory_resource
{
static int count;

Expand All @@ -255,7 +255,7 @@ struct test_device_memory_resource : cuda::mr::device_memory_resource
}

test_device_memory_resource(const test_device_memory_resource& other)
: cuda::mr::device_memory_resource{other}
: cudax::mr::device_memory_resource{other}
{
++count;
}
Expand All @@ -270,7 +270,7 @@ int test_device_memory_resource::count = 0;

TEST_CASE("uninitialized_buffer's memory resource does not dangle", "[container]")
{
cudax::uninitialized_buffer<int, ::cuda::mr::device_accessible> buffer{cuda::mr::device_memory_resource{}, 0};
cudax::uninitialized_buffer<int, ::cuda::mr::device_accessible> buffer{cudax::mr::device_memory_resource{}, 0};

{
CHECK(test_device_memory_resource::count == 0);
Expand Down
219 changes: 0 additions & 219 deletions libcudacxx/include/cuda/__memory_resource/device_memory_resource.h

This file was deleted.

Loading

0 comments on commit 01200f6

Please sign in to comment.