SHARE
TWEET

Untitled

a guest Dec 25th, 2011 61 Never
  1. #include <thrust/device_vector.h>
  2. #include <thrust/device_vector.h>
  3. #include <thrust/sort.h>
  4.  
  5. extern "C" {
  6. //Sort for integer arrays
  7. void sort_int_wrapper( int *data, int N)
  8. {
  9. // Wrap raw pointer with a device_ptr
  10. thrust::device_ptr <int> dev_ptr(data);
  11. // Use device_ptr in Thrust sort algorithm
  12. thrust::sort(dev_ptr, dev_ptr+N);
  13. }
  14.  
  15. //Sort for float arrays
  16. void sort_float_wrapper( float *data, int N)
  17. {
  18. thrust::device_ptr <float> dev_ptr(data);
  19. thrust::sort(dev_ptr, dev_ptr+N);
  20. }
  21.  
  22. //Sort for double arrays
  23. void sort_double_wrapper( double *data, int N)
  24. {
  25.  
  26. thrust::device_ptr <double> dev_ptr(data);
  27. thrust::sort(dev_ptr, dev_ptr+N);
  28. }
  29. }
RAW Paste Data
Top