Skip to content

Commit

Permalink
Update to latest thrust pinned memory allocator
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-ic committed Apr 10, 2024
1 parent 811968a commit fa32f52
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/cuda_utils.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@

#include <thrust/device_vector.h>
#include <thrust/host_vector.h>
#include <thrust/system/cuda/experimental/pinned_allocator.h>
#include <thrust/system/cuda/memory_resource.h>

#include <iomanip>
#include <iostream>

typedef unsigned long long int uint64_cu;

using mr = thrust::system::cuda::universal_host_pinned_memory_resource;

template <typename T>
using pinned_allocator = thrust::mr::stateless_resource_allocator<T, mr >;

template <typename T>
using PinnedHostVector = thrust::host_vector<T, thrust::system::cuda::experimental::pinned_allocator<T>>;
using PinnedHostVector = thrust::host_vector<T, pinned_allocator<T>>;

template <typename T>
void printHostVector(T* begin, size_t n) {
Expand Down
2 changes: 1 addition & 1 deletion src/sort_benchmark.cu
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void BenchmarkSort(const std::string& algorithm, const Arguments& arguments, Sor
} else if (algorithm == "paradis-sort") {
auto start = GetTimeNow();

paradis::sort<T>(keys.data(), keys.data() + arguments.num_keys, arguments.num_cpu_threads);
paradis::sort<T>(&keys.data()[0], &keys.data()[arguments.num_keys], arguments.num_cpu_threads);

auto end = GetTimeNow();
total_sort_duration = GetMilliseconds(start, end);
Expand Down

0 comments on commit fa32f52

Please sign in to comment.