Does OpenCL support array initializers, including default initialization with 0? -


inside kernel, need array of accumulators.

__kernel mykernel(...) {     float accum[size] = {};      for(i=0; i<iter; ++i) {        accum[...] += ...     }      ... } 

in c, = {} initialize array me filled 0, i'm not sure if that's case in opencl? need following, or waste of cycles?

float accum[size]; for(int i=0; i<size; ++i) accum[i] = 0; 

opencl c derivative of iso/iec 9899:1999 c language specification, aka c99. in both specifications, yes, = { 0 } zero-initialize array (note 0, empty initializer lists not allowed in c).

in practice, implementations may clear device private's and/or local memory zeroes before launch kernel, not behavior can rely on.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -