Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Array of vectors using Thrust

Is it possible to create an array of device_vectors using Thrust? I know I can't create a device_vector of a device_vector, but how I would create an array of device_vectors?

like image 332
Manolete Avatar asked Sep 13 '12 13:09

Manolete


1 Answers

The following code worked for me. If you place this code to a file with .cu extension it compiles well, but if you place it in a file with .cpp extension it gives compile time assertion failure.

thrust::device_vector<float> vectors[3];
//thrust::device_vector<float> *vectors = new thrust::device_vector<float>[3];

vectors[0] = thrust::device_vector<float>(10);
vectors[1] = thrust::device_vector<float>(10);
vectors[2] = thrust::device_vector<float>(10);

printf("Works\n");

The assertion failure is like the following

1>../for_each.inl(96) : error C2027: use of undefined type 'thrust::detail::STATIC_ASSERTION_FAILURE<x>'
like image 147
phoad Avatar answered Sep 23 '22 06:09

phoad