Hi,

I am learning OpenCL and got a problem with computing a dimensional average with double variables.

The OpenCL kernel code is:

const char *C_lastdim_dimavg_KernelSource = "\n" \
" #pragma OPENCL EXTENSION cl_khr_fp64 : enable \n" \
"__kernel void dimavg( \n" \
" const int m, \n" \
" __global double* vin, \n" \
" __global double* vout) \n" \
"{ \n" \
" int k; \n" \
" int i = get_global_id(0); \n" \
" double sum_val = 0.0; \n" \
" for(k = 0; k < m; ++k) \n" \
" sum_val += vin[i + k]; \n" \
" vout[i] = sum_val / (double)m; \n" \
"} \n" \
"\n";


I have tried with float, it seems this code works right.

Thanks in advance,

Wei