On 19.08.22 03:49, Shriramana Sharma wrote:
Hello. I want to parallelize a computation which has two for loops, one
nested within another. All inner-loop-param+outer-loop-param
combinations can be computed independent of one another.
As I suspected,
[https://forum.dlang.org/post/xysyidbkjdinclmrx...@forum.dlang.org](this
forum post) says that only one loop can be parallelized. Will it be an
error or inefficient or useless if I try to do both?
Also, what is the best way to do parallelism in such a situation?
You could also do a custom range that makes a one-dimensional range (aka
iota out of your nested loops) and then process this with parallel.
Another way (more similar to Ali's solution) would be to write the
nested loops as you have them, but collect the parameters for the work
in an array or something and then process this array in parallel.
Kind regards,
Christian