Franchute13

cannot be assigned to an entity of type

Discussion created by Franchute13 on Dec 19, 2010
Latest reply on Dec 19, 2010 by Franchute13

Hello.

I am a beginner and I come from Java.

I do not understand how to pass arrays between methods. The following code gives me the error:

error: a value of type
          "float *" cannot be assigned to an entity of type "global float *"
          x = calcu(datos, j);
            ^


How do you fix ?

I apologize for my English.

Thx

//#pragma OPENCL EXTENSION cl_khr_fp64 : enable //#pragma OPENCL EXTENSION cl_khr_fp16 : enable float f(float t, float y){ //float funcion= y; //float funcion= y*sin(t); float funcion= y*sin(t); return funcion; } float* calcu(__local float *datos, int j){ float x[1000],y[1000],t[1000],h,k1,k2,k3,k4,l1,l2,l3,l4; t[0]=0; //x[0]=1; x[0]=0; //y[0]=0; y[0]=datos[2*j]; h=datos[2*j+1]; int i=0; while (i<1000) { //int i = get_global_id(0); k1=f(t[i],y[i]); k2=f(t[i] + 0.5*h,y[i] + 0.5*k1*h); k3=f(t[i]+0.5*h,y[i]+0.5*k2*h); k4=f(t[i]+h,y[i]+k3*h); y[i+1]=y[i]+(1./6.)*(k1+2.*k2+2.*k3+k4)*h; t[i+1]=t[i]+h; //h=h*(i+1); x[i+1]=h*(i+1); i++; } return y; } __kernel void rk4(__local float *datos,__global float *x,__global float *y) { int j = get_global_id(0); while (j<get_global_size (0)){ x = calcu(datos, j); } }

Outcomes