 #include <thrust/copy.h>
 #include <thrust/sort.h>
-#include <thrust/device_vector.h>
+#include <thrust/memory.h>
+#include <thrust/system/cuda/memory.h>
 
 #include <new> // for std::bad_alloc
 #include <cassert>

  {
    for (size_t n = (1 << 20); n < ((size_t) 1 << 40); n *= 2)
    {
      // TODO ideally we'd use the fallback_allocator in the device_vector too
      //thrust::device_vector<int, fallback_allocator> d_vec(n);

      std::cout << "attempting to sort " << n << " values" << std::endl;


// XXX ideally this variable is declared thread_local
fallback_allocator g_allocator;

// create a tag derived from cuda::tag for distinguishing
// our overloads of get_temporary_buffer and return_temporary_buffer
struct my_tag : thrust::cuda::tag {};


// overload get_temporary_buffer on my_tag
