         i != free_blocks.end();
         ++i)
     {
-      // transform the pointer to device_ptr before calling device_free
-      thrust::device_free(thrust::device_pointer_cast(i->second));
+      // transform the pointer to cuda::pointer before calling cuda::free
+      thrust::system::cuda::free(thrust::system::cuda::pointer<void>(i->second));
     }
 
     for(allocated_blocks_type::iterator i = allocated_blocks.begin();
         i != allocated_blocks.end();
         ++i)
     {
-      // transform the pointer to device_ptr before calling device_free
-      thrust::device_free(thrust::device_pointer_cast(i->first));
+      // transform the pointer to cuda::pointer before calling cuda::free
+      thrust::system::cuda::free(thrust::system::cuda::pointer<void>(i->first));
     }
   }
 

  // generate random input
  thrust::generate(h_input.begin(), h_input.end(), rand);

  thrust::device_vector<int> d_input = h_input;
  thrust::device_vector<int> d_result(n);

  size_t num_trials = 5;


    else
    {
      // no allocation of the right size exists
      // create a new one with cuda::malloc
      // throw if cuda::malloc can't satisfy the request
      try
      {
        std::cout << "cached_allocator::allocator(): no free block found; calling cuda::malloc" << std::endl;

        // allocate memory and convert cuda::pointer to raw pointer
        result = thrust::system::cuda::malloc(num_bytes).get();
      }
      catch(std::runtime_error &e)
      {
