can I set a device vector in a loop #1047
Replies: 0 comments 2 replies
-
I would advice against that and instead either use the suitable constructor or |
Beta Was this translation helpful? Give feedback.
-
@miscco is correct, it's better to do a bulk write into a Assigning in a loop will work, but it will be very slow and inefficient, as each individual element will be copied from host -> device memory in separate transactions. These copies are very expensive, and minimizing them using bulk update methods will improve performance significantly. If each element has the same value (as in the example) the If the data is more complex, it's more efficient to create a
|
Beta Was this translation helpful? Give feedback.
-
I want to set the device vector like the c++ vector
for(int i=0;i<100;i++) device_vector[i]=3.14.
Does it works in thrust?
Beta Was this translation helpful? Give feedback.
All reactions