Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions thrust/thrust/system/hpx/memory_resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
#include <thrust/mr/new.h>
#include <thrust/system/hpx/pointer.h>

#include <hpx/parallel/algorithms/for_loop.hpp>

THRUST_NAMESPACE_BEGIN
namespace system
{
Expand All @@ -50,15 +48,7 @@ class topology_resource final : public mr::memory_resource<>
public:
void* do_allocate(std::size_t bytes, std::size_t /*alignment*/ = THRUST_MR_DEFAULT_ALIGNMENT) override
{
std::byte* ptr = static_cast<std::byte*>(::hpx::threads::create_topology().allocate(bytes));

// touch first byte of every page
const auto page_size = ::hpx::threads::get_memory_page_size();
::hpx::experimental::for_loop_strided(::hpx::execution::par, ptr, ptr + bytes, page_size, [](std::byte* it) {
*it = {};
});

return ptr;
return ::hpx::threads::create_topology().allocate(bytes);
}

void do_deallocate(void* p, std::size_t bytes, std::size_t /*alignment*/ = THRUST_MR_DEFAULT_ALIGNMENT) override
Expand Down
Loading