Questions tagged [thrust]

Thrust is a template library of parallel algorithms with an interface resembling the C++ Standard Template Library (STL) for NVIDIA CUDA.

Thrust is a library of parallel algorithms with an interface resembling the C++ Standard Template Library (STL) which interoperates with technologies such as CUDA, OpenMP, and TBB. Thrust provides a flexible high-level interface for parallel programming designed to greatly simplify running common data parallel processing tasks on GPUs and multicore CPUs, with the intention of enhancing developer productivity.

As of CUDA release 4.0, a Thrust snapshot is included in every release of the the standard CUDA toolkit distribution. Under Debian and Ubuntu Thrust may also be installed through apt-get:

sudo apt-get install libthrust-dev

The project homepage contains documentation and sample code demonstrating usage of the library. The latest source, bug-reports and discussions are always available on GitHub.

The rocThrust project (GitHub) by AMD is a port of Thrust to their HIP/ROCm platform.

959 questions
-2
votes
1 answer

CUDA: thrust::sort_by_key does not work in the kernel, but thrust::sort does

I am trying to move some of my existing thrust::sort_by_key calls to kernel threads. These are large numbers of small sorts - so lots of threads running sequential sorts makes a lot of sense. thrust::sort appears to work fine in the kernel, eg: (xp…
winwaed
  • 7,645
  • 6
  • 36
  • 81
-2
votes
1 answer

Wrong values of thrust::transform output

I'm trying to transform a float3 array by using containers into a container of a specific structure. Code below: #include #include #include #include #include…
-2
votes
1 answer

Thrust code returns different results when compiled with OpenMP backend

I am experiencing on Windows 10 a situation in which the same code, either compiled with CUDA 9.2 backend (using nvcc with cl.exe) or compiled with OpenMP backend (using g++ provided by MinGW), returns different numerical results. The CUDA one is…
-2
votes
1 answer

Scope operator needed to find std namespace instead of boost

I am working on porting parts of the boost library to compile under cuda / nvcc as device functions. This involves using the thrust library for some things like iterators, arrays, etc. One issue I am finding is a compile error in the thrust library…
-2
votes
2 answers

thrust::device_vector is not updated properly

I am trying to save result of CUDA kernel method in device vector below is my kernel code and data is going in to int* out and int* outTwo array when I print it. template struct KernelArray { T* _array; int _size; }; template…
-2
votes
1 answer

CUDA thrust device pointer with transform copy crash

In CUDA 9.2 I have something like this: #ifdef __CUDA_ARCH__ struct Context { float n[4]; } context; #else typedef __m128 Context; #endif struct A { float k[2]; }; struct B { float q[4]; }; struct FTransform : thrust::unary_function
iam
  • 1,623
  • 1
  • 14
  • 28
-2
votes
1 answer

CUDA C++ copy object pointers to device

class bead { int ID; __host__ __device__ bead(int id){ID=id}; } void main(void){ vector beadvec; for(int i=0;i<128;i++){ bead* b1=new bead(i); beadvec.pushback(b1); } } Am not sure how to copy the vector of pointers (beadvec) to the…
-2
votes
1 answer

Parallel multiplication vector-matrix

I am coding in C++ and I have a Matrix and a Vector which have to be multiplied. Both are classes that I defined and both wrap a 1-D std::vector; the data-type is long long int. I have already parallelized the code with std::threads but now I would…
minomic
  • 645
  • 1
  • 9
  • 22
-2
votes
1 answer

thrust::reduce_by_key() returns duplicated keys

Here is my code: //initialize the device_vector int size = N; thrust::device_vector value(size); thrust::device_vector key(size); //get the device pointer of the device_vector //so than I can write data to the device_vector in CUDA…
Pan.da
  • 41
  • 7
-2
votes
1 answer

from thrust to arrayfire - gfor usage?

I am trying to replace some thrust calls to arrayfire to check the performance. I am not sure if I am using properly arrayfire because the results I am taking do not match at all. So , the thrust code for example I am using is: cudaMalloc( (void**)…
George
  • 5,808
  • 15
  • 83
  • 160
-2
votes
1 answer

thrust::minmax_element argumen list doesn't match

I have following small piece of code that uses thrust::minmax_element to find out the min and max of a struct of 3 floats. But the compiler always says argument list doesn't match. I am using CUDA 6.5 under Mac OS 10.9 struct Float3 {float x, y,…
user2621037
  • 326
  • 1
  • 3
  • 13
-2
votes
1 answer

Using Thrust's reduce operator with Pixel uchar4 data error

I have been having trouble converting this example from sort to reduce. I keep getting no suitable conversion function from "uchar4" to "OutputType" exists When I try to compile and run this modified example: thrust::reduce(tptr, tptr+(DIM*DIM),…
toejam
  • 1
  • 2
-2
votes
1 answer

CUDA thrust reduce is so slow?

I am learning CUDA. Today, I try some code in the book: CUDA Application Design And Development, which make me surprised. Why CUDA Thrust is so slow? Here is the code and the output. #include using namespace…
hakunami
  • 2,351
  • 4
  • 31
  • 50
-2
votes
1 answer

sorting an array, than do the same changes to next array

I´m searching for the simplest and fastest method to sort one array of 10^5 entries and then do the same thing to the next arrays. The arrays are all the same size. For Example: 1 a 6 c 3 b I have to sort the first collumn but 6…
suehprom
  • 37
  • 1
  • 3
-2
votes
1 answer

Can you pass thrust::device_ptr to thrust::tuple?

Is the below code valid: typedef thrust::device_ptr IntIterator; typedef thrust::device_ptr FloatIterator; typedef thrust::tuple IteratorTuple; typedef thrust::zip_iterator myZipIterator; I know…
Programmer
  • 6,565
  • 25
  • 78
  • 125
1 2 3
63
64