Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <thrust/device_vector.h>
- #include <thrust/sort.h>
- #include <thrust/extrema.h>
- #include <iostream>
- extern "C" {
- //Min for float arrays
- int min_float_wrapper( float *data, int N)
- {
- thrust::device_ptr <float> dev_ptr(data);
- return (thrust::raw_pointer_cast(thrust::min_element(dev_ptr, dev_ptr+N)) - data);
- }
- int min_double_wrapper( double *data, int N)
- {
- printf("\nmin_float_wrapper enter");
- thrust::device_ptr <double> dev_ptr(data);
- printf("\npointer created");
- thrust::min_element(dev_ptr, dev_ptr+N);
- printf("\ntmp calculated");
- return (int)(thrust::min_element(dev_ptr, dev_ptr+N) - dev_ptr);
- }
- //Sort for float arrays
- void sort_float_wrapper( float *data, int N)
- {
- printf("\nsort enter");
- thrust::device_ptr <float> dev_ptr(data);
- printf("\nptr created");
- thrust::sort(dev_ptr, dev_ptr+N);
- printf("\nsorted!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement