     else
     {
       // no allocation of the right size exists
-      // create a new one with device_malloc
-      // throw if device_malloc can't satisfy the request
+      // 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 device_malloc" << std::endl;
+        std::cout << "cached_allocator::allocator(): no free block found; calling cuda::malloc" << std::endl;
 
-        result = thrust::device_malloc(num_bytes).get();
+        // allocate memory and convert cuda::pointer to raw pointer
+        result = thrust::system::cuda::malloc(num_bytes).get();
       }
       catch(std::runtime_error &e)
       {

// during algorithms such as thrust::sort. The idea will be to create a simple
// cache of allocations to search when temporary storage is requested. If a hit
// is found in the cache, we quickly return the cached allocation instead of
// resorting to the more expensive thrust::device_malloc.
//
// Note: this implementation cached_allocator is not thread-safe. If multiple
// (host) threads use the same cached_allocator then they should gain exclusive

cached_allocator g_allocator;


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


// overload get_temporary_buffer on my_tag
