Accessing complex workspace data from a CUDA kernel

In my MATLAB workspace, I have some complex data that I wish to transfer to the GPU for further processing with a CUDA kernel. Transferring the data to the GPU is easy with the gpuArray command.
However, what data type should I specify in the .cu kernel prototype to access a complex gpuArray? In the Parallel Computing Toolbox documentation, cuComplex is not listed as a supported data type for the C prototype, and when I use float2 I receive an error message about the complexity of the input not matching the prototype:
"parallel.gpu.GPUArray must match the complexity specified on the kernel prototype"
Regards, Jeremy Dillon

댓글 수: 1

Have you written CUDA Kernel? and you are activating it by parallel.gpu.kernel('.ptx','.cu') command? if yes Would you please share your code?

댓글을 달려면 로그인하십시오.

 채택된 답변

Edric Ellis
Edric Ellis 2011년 11월 7일

0 개 추천

You should use 'double2' to match complex double MATLAB data, and 'float2' for complex single MATLAB data.

댓글 수: 1

Thank you Edric, that worked. When I tried float2 I had forgotten to initialize my output array as complex, e.g.
o = complex(parallel.gpu.GPUArray.zeros([1 N],'single'));

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 GPU Computing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by