PDA

View Full Version : havin error code -38 in opencl ?



jai
11-24-2012, 11:25 PM
hi
i am having error code -38 when i print err or status of clEnqueueReadBuffer (.....)
pls help what does it mean?
thanks

jai
11-25-2012, 12:02 AM
i have solved the problem by writing NULL in destination array in which i am storing the value of addition of two source arrays value,i am posting the code but pls help me to tell the reason why it has happened when change it to NULL


float a[100],b[100];,c[100];
//For addition c[i]=a[i]+b[i];
cl_mem d_A,d_B,d_C; //mem object
d_A =clCreateBuffer(context,CL_MEM_READ_ONLY|CL_MEM_CO PY_HOST_PTR,
N*sizeof(float),a,&err);
d_B= clCreateBuffer(context,CL_MEM_READ_ONLY|CL_MEM_COP Y_HOST_PTR,
N*sizeof(float),b,&err);

the above 2 statements are same,but when i do change from "c to NULL" in below statment it works fine
pls tell the reason why it is happening if i write c then error and if NULL it works fine

d_C=clCreateBuffer(context,CL_MEM_READ_ONLY|CL_MEM _COPY_HOST_PTR,
N*sizeof(float),c,&err);//here is the problem why i cant write c ,as did in above two statement,why i have to put NULL instead of c (which is same is array as a & b)when destination mem object i have to create on gpu...

pls help
thanks

jai
11-25-2012, 01:44 AM
sorry this statement mis written it contains CL_MEM_WRITE_ONLY

d_C=clCreateBuffer(context,CL_MEM_WRITE_ONLY,N*siz eof(float),c,NULL);
rest is same in above question
thanks

Dithermaster
11-25-2012, 09:11 AM
Could it be the extra semicolon here:

float a[100],b[100];,c[100];

(after b before c)