¿Cómo paso array a una función en OpenCL? Tengo error" ..argument de tipo "_global float *" es incompatible con el parámetro de tipo de "flotación *" en línea c [n] = FindIndexFromArray (a, 3);Pasando array al parámetro de función en OpenCL
float FindIndexFromArray(float myArray[], float Key)
{
// simple looping to find the index
for (int i=0;i<sizeof(myArray);i++)
if (myArray[i]==Key)
return i;
}
kernel void ProcessArray(
global read_only float* myArray,
global read_only float* Key,
global write_only float* c)
{
int index = get_global_id(0);
c[index] = FindIndexFromArray(myArray, Key); // How do I pass myArray parameter?
}
Mi fuente editado código:..
float FindIndexFromArray(__global read_only float* myArray[], __global read_only float* Key)
{
// simple looping to find the index
for (int i=0;i<sizeof(myArray);i++)
if (myArray[i]==Key)
return i;
}
kernel void ProcessArray(
__global read_only float* myArray,
__global read_only float* Key,
__global write_only float* c)
{
int index = get_global_id(0);
c[index] = FindIndexFromArray(myArray, Key); // How do I pass myArray parameter?
}
Todavía recibo varias advertencias pero este es el mensaje de error: 'Los tipos de operandos son incompatibles (" float "y" __global float * "' en esta línea 'if (myArray [i] == Key)'. Creí haber declarado myArray y Key como __global type. ¿Cómo puedo solucionar esto? –
¿Puedes mostrar tu código fuente editado? – ardiyu07
He editado mi pregunta para mostrar mi código fuente editado. –