Tue Apr 05, 2011 9:15 am by TobyH
We have the normal device pointers (key_ptr, value_ptr). These are just like you always use for GPU global memory.
Thrust uses its own type of pointers, which can have some more hidden information. For our purposes, we can make a thrust pointer from our device pointer.
thrust::device_ptr<int> key_ptr_thrust(key_ptr);
-This means create a Thrust pointer to device memory which holds ints (note that int matches the type used when creating key_ptr).
-The thrust pointer is called key_ptr_thrust
-It is created from the device pointer key_ptr
The call to the sort function is made with the thrust pointers, but 'under the hood' it actually uses the device pointer we used to create the thrust pointer. Therefore, the device pointer still points to the same memory location (and the array is now sorted).