Merging two CPU vectors into a tuple GPU vector

I am experimenting with memcpy2d could be tricked into seeing the remaining part of the vector as padding so the tuple could be built using two memcpy2d calls. Can that work?

Is there a recommended way of copying two vectors into a gpu tuple array?

Thank you

You can do it with two calls to cudaMemcpy2D. One for each vector. In each case the source stride is equal to the source width, and the destination stride is equal to the destination width, which is twice the source width. The 2nd call offsets the destination pointer itself to point to the starting element of the second element in each tuple.

Thanks Robert,

All working now, I was a bit confused with some of the usage of memcpy2d but it’s all clear now.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.