I'd like to calculate Pi with Gregory-Leibniz series with this kernel:
kernel void pi_GregoryLeibniz(float size, out float output<>
float2 pos = indexof(output).xy;
float i = size * pos.x + pos.y;
output = pow(-1.0f, i) * (4.0f / (1.0f + 2.0f * i));
then sum it with reduce kernel
kernel void pi_sum(float input<>, reduce float output)
output += input;
I get just a messy output: -1.#J -1.#J -1.#J -1.#J -1.#J -1.#J -1.#J -1.#J -1.#J -1.#J when I'm printing the output on the screen ... The result of the reduce kernel's always 0.0 regardless to the content of the input stream.
What's the matter with my code?
My second question is how can i use multiple kernels in my program? I've tried to use output of the first kernel as input for second like this:
Thanks for advices.