I want to sort an array using raw device pointers with thrust::sort() and thrust::sort_by_key() because it uses radix sort. The data is in a raw uint64_t device pointer, and I initialize with random elements for testing. I looked at the thrust library and saw some examples that simply passed in an array variable and the array variable plus the size to pass in the start and end of the array. When I call the sort method, it throws a runtime error saying that Exception thrown: read access violation. thrust::identity<unsigned __int64>::operator()(...) returned 0x701A00000. I am not sure what is causing this because I am new to using thrust to sort.
Here is some sample code to show how I am calling it:
uint64_t size = 1024ull;
uint64_t* data;
cudaMalloc((void**)&data, size * sizeof(uint64_t));
curandGenerator_t gen;
curandCreateGenerator(&gen, CURAND_RNG_QUASI_SOBOL64);
curandSetPseudoRandomGeneratorSeed(gen, 132748238ull);
curandGenerateLongLong(gen, data, size);
curandDestroyGenerator(gen);
thrust::sort(data, data + size);