jeudi 2 mars 2017

Efficient moving of values from vector of reducers to another vector [Cilk+]

How to perform efficient copying of values from a vector of reducers to another vector as follows?

std::vector<cilk::reducer_opadd<int>> v(10000000); 

//....

Code that populates the vector v
...//

std::vector<int> res(v.size(), 0);

int i = 0;
for (auto& x : v) res[i++] = x.get_value;
//cilk_for(int i = 0; i < v.size(); ++i) res[i] = v[i].get_value();

Is it possible to have a SIMD instruction to perform the above copying more efficiently?

Aucun commentaire:

Enregistrer un commentaire