Say, I'd like to 'reduce' (sum some values) to a 2D array.
I don't know it's size during compile-time. Though, it's size is constant during execution.
When cilk creates multiple strands, it won't initialize arrays...
to create an array, filled with zeros one need:
boost::numeric::ublas::matrix<double> m (100, 100);
but with current cilk_oppadd I'm unable to pass array's size. Also worker's arrays seem to be not initialized....
1)It looks like a "quick -and-dirty" solution is to write a wrapper for boost::numeric::ublas::matrix<double>, which would initialize it during construction with the use of some global variables.
2)Better solution is to write a custom cilk_opadd analogue, that would call a non-default constructor on first ++ operation.....
3)try to modify <reducer.h> to call specific constructor (or pass some parameters to constructor). Not sure it's the best way
4)just use sum->set_value(..) if array is not initialized (i.e. on each worker's first iterration). This seem like the most simple way...
1)I'm just a newbee in cilk, so... am I right?
2)Won't it be nice, if user would be able to specify datatype constructor for a reducer?