On Monday, 11 January 2016 at 00:39:04 UTC, Jay Norwood wrote:
On Sunday, 10 January 2016 at 23:31:47 UTC, Ilya Yaroshenko
wrote:
Just use normal arrays for buffer (median accepts array on
second argument for optimisation reasons).
ok, I think I see. I created a slice(numTasks, bigd) over an
allocated double[] dbuf, but slb[task] will be returning some
struct instead of the double[] that i need in this case.
If I add .array to the Slice, it does compile, and executes,
but slower than using the buffer directly.
medians[i] = median(vec, slb[task].array);
parallel time medians msec:113
original version using the computed slice of the original
allocated dbuf.
medians[i] = median(vec,dbuf[j .. k]);
parallel time medians msec:85
The .array appears to make a copy. Is there some other call in
ndslice to return the double[] slice of the original array?
I will add such function. But it is not safe to do so (Slice can
have strides not equal to 1). So it is like a hack (&ret[0, 0,
0])[0 .. ret.elementsCount]).
Have you made comparison between my and yours parallel versions?
https://github.com/9il/examples/blob/parallel/image_processing/median-filter/source/app.d
-- Ilya