cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Raistmer
Adept II

No error if kernel argument omitted ???

nice source of errors

For exampe if first call place contains all arguments but second one omitted last one (commented in example) no eror on kernel call generated, but kernel produces invalid results of course.
Is it intended no to check number of arguments and possibly reuse old ones ?

err = clSetKernelArg(GPU_compare_with_threshold_kernel_cl,0,sizeof(cl_uint),(void *)&max_per_int4); err |= clSetKernelArg(GPU_compare_with_threshold_kernel_cl,1,sizeof(cl_mem),(void *)&gpu_temp_coadd); err |= clSetKernelArg(GPU_compare_with_threshold_kernel_cl,2,sizeof(cl_mem),(void *)&gpu_thresh_tbl); err |= clSetKernelArg(GPU_compare_with_threshold_kernel_cl,3,sizeof(cl_int),(void *)&ttidx); err |= clSetKernelArg(GPU_compare_with_threshold_kernel_cl,4,sizeof(cl_mem),(void *)&gpu_need_CPU_compare_int); // err |= clSetKernelArg(GPU_compare_with_threshold_kernel_cl,5,sizeof(cl_uint),(void *)&stride); if(err != CL_SUCCESS)fprintf(stderr,"ERROR: Setting kernel argument: GPU_compare_with_threshold_kernel_cl: %d\n",err);

0 Likes
1 Reply
Curiouscat
Journeyman III

It's my understanding that once set, kernel arguments are reused until explicitly changed. From http://www.khronos.org/registry/cl/sdk/1.0/docs/man/xhtml/clSetKernelArg.html :

The argument value specified is the value used by all API calls that enqueue kernel (clEnqueueNDRangeKernel and clEnqueueTask) until the argument value is changed by a call to clSetKernelArg for kernel.

0 Likes