This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

C++ wrapper for thrust

By: a guest on Apr 27th, 2012  |  syntax: C++  |  size: 0.52 KB  |  views: 32  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data