Advertisement
Guest User

C++ wrapper for thrust

a guest
Apr 27th, 2012
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include "thrust/device_ptr.h"    
  2. #include "thrust/extrema.h"    
  3. #include "thrust/system_error.h"          
  4. #include <iostream>    
  5.  
  6. exern "C" int min_float_wrapper( float *data, int N)    
  7. {    
  8.     try {    
  9.         thrust::device_ptr <float> dev_ptr(data);    
  10.         return thrust::min_element(dev_ptr, dev_ptr + N) - dev_ptr;    
  11.     }    
  12.     catch(thrust::system_error &e) {    
  13.         std::cerr << "min_float_wrapper error " << e.what() << std::endl;    
  14.         return -1;    
  15.     }    
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement