parallel.gpu.CUDAKernel() not working
5 次查看(过去 30 天)
显示 更早的评论
I have written the following .cu code:
__global__ void addToVector(float * pi, float c, int vecLen) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if ( idx < vecLen ) {
pi[idx] += c;
}
}
after then I compiled it with :
nvcc -ptx code.cu //which generates a code.ptx file
The problem is that when I use above files to make kernel object, by
k = parallel.gpu.CUDAKernel('code.ptx','code.cu')
then following message occurs:
??? Error using ==> iParseToken at 266
Unsupported type in argument specification "fahad.cu".
Error in ==>
/usr/local*/Matlab/2011a/toolbox/distcomp/gpu/+parallel/+internal/+gpu/handleKernelArgs.p>iParseCPrototype at 192
Error in ==>
/usr/local/Matlab/2011a/toolbox/distcomp/gpu/+parallel/+internal/+gpu/handleKernelArgs.p>handleKernelArgs at 79
Note that there is no problem with hardware or drivers. gpuarray command works fine.
Would anybody help me in this regard !
0 个评论
回答(1 个)
Edric Ellis
2011-11-28
CUDAKernel is very restrictive about precisely which types of argument it accepts; in particular, it only accepts basic "C" types (and const/pointer variants). Do you have any other _global_ entry points in the .cu file that you compiled to .ptx?
2 个评论
Edric Ellis
2011-11-29
I'm not sure, but it looks like you're using a CUDA-4 compiler and R2011a. R2011a shipped with the CUDA 3.2 toolkit, so you might have better luck using that version of NVCC.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 GPU Computing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!