Passing GPUArray to feval

2 visualizaciones (últimos 30 días)
P L V  VIHARI
P L V VIHARI el 8 de Abr. de 2012
I have the following kernel
_global_ void func( float * arr, int N ) {
int rtid = blockDim.x * blockIdx.x + threadIdx.x;
if( rtid < N )
{
float* row = (float*)((char*)arr + rtid*N*sizeof(float) );
for (int c = 1; c < N; ++c)
{
//Manipulation
}
}
}
When I call the kernel from MATLAB using
gtm= parallel.gpu.GPUArray(ones(a,b,'double')); OR gtm= parallel.gpu.GPUArray(ones(1,b,'double'));
gtm=k.feval(gtm,b);
it is giving the following error:
Error using ==> feval
parallel.gpu.GPUArray must match the exact input type as specified on the kernel
prototype.
Error in ==> sameInit at 65 gtm=k.feval(gtm,b);
Can someone please tell me where am I going wrong.
Thanking You, Viharri P L V.

Respuesta aceptada

Jill Reese
Jill Reese el 9 de Abr. de 2012
You are creating gtm as a double, and trying to pass it as the first input to a kernel that expects a float. Try using this instead:
gtm = parallel.gpu.GPUArray.ones(a, b, 'single');
  1 comentario
P L V  VIHARI
P L V VIHARI el 11 de Abr. de 2012
Thanks for the answer... I fixed the problem...

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre GPU Computing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by