File: pinned_allocator.cu

package info (click to toggle)
libthrust 1.11.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 10,208 kB
  • sloc: ansic: 28,429; cpp: 26,501; python: 1,228; perl: 460; sh: 348; makefile: 103
file content (19 lines) | stat: -rw-r--r-- 548 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <unittest/unittest.h>
#include <thrust/system/cuda/experimental/pinned_allocator.h>
#include <thrust/host_vector.h>
#include <thrust/copy.h>

template <typename T>
void TestPinnedAllocatorSimple(const size_t n)
{
  typedef thrust::host_vector<T, thrust::cuda::experimental::pinned_allocator<T> > Vector;

  Vector h_input = unittest::random_integers<T>(n);
  Vector h_output(n);

  thrust::copy(h_input.begin(), h_input.end(), h_output.begin());

  ASSERT_EQUAL(h_input, h_output);
}
DECLARE_VARIABLE_UNITTEST(TestPinnedAllocatorSimple);