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

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -