On Wednesday, 6 May 2020 at 03:33:12 UTC, Mathias LANG wrote:
On Wednesday, 6 May 2020 at 03:25:41 UTC, data pulverizer wrote:
[...]
The problem here is that `process` is a delegate, not a
function. The compiler *should* know it's a function, but for
some reason it does not. Making the function static, or moving
it outside of the scope of main, will fix it.
I moved the `process` function out of main and it is now running
but it prints out
```
z: [nan, 2, nan, 12, 20, nan, nan, nan, nan, 90, nan, 132, nan,
nan, 210, nan, nan, nan, nan, nan, nan, nan, nan, nan, 600, nan,
nan, nan, nan, nan, 930, 992, 1056, nan, 1190, nan, nan, nan,
nan, nan, 1640, 1722, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, 3080, nan, nan, 3422, 3540, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, 8010, nan, nan, nan, nan, nan, nan, 9312, nan, nan, 9900]
```
Is there something I need to do to wait for each thread to finish
computation?
For reference, this will spawn 100 threads to do a simple
computation so probably not what you would want, I expect. But
I suppose this is just example code and the underlying
computation is much more expensive ?
Yes, that's exactly what I want the actual computation I'm
running is much more expensive and much larger. It shouldn't
matter if I have like 100_000_000 threads should it? The threads
should just be queued until the cpu works on it?
Thanks