1

I am trying to find a way, if it is possible, to copy the values that are pointed by a host array of pointers pts that points to some elements of another host array s (float2 type). The values that need to be dereferenced from pts with the -> operator are in random positions in the s array.

Is there a way to copy these values pointed by pts without having to use an intermediate host buffer to write the values in it before using cudaMemcpy? I only came up with a for loop copying one element at a time but isnt this redundant? I use cuda 5.5 Thanks.

1 Answer 1

1

If the values you want to copy are in random locations, and you want to copy only those values to the device, you will need to write a separate loop in host code that aggregates those values first into a single contiguous buffer.

You can then copy that buffer using an ordinary approach like cudaMemcpy.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.