Poul K. Sørensen
Poul K. Sørensen

Reputation: 17540

How to copy none sequential data to a GPU memory buffer in OpenCL?

I know how i would copy a array from Host to GPU. But what happens if i have a column major matrix stored on host that i want to copy to a buffer on the GPU.

Are there other ways then copying one element at the time in a forloop ?

A_host [0 3 6 1 4 7 2 5 8].

GPUBuffer = [0 1 2 3 4 5 6 7 8].

Upvotes: 1

Views: 165

Answers (1)

Eric Bainville
Eric Bainville

Reputation: 9906

In that case, and if the matrix is sufficiently large, you may want to send it "as-is" to the GPU, and insert an additional transpose kernel (or merge it to your first kernel).

Upvotes: 3

Related Questions