Looking for writing parallel foreach kind of statement for nested for-loops

Sparsh Mittal sparsh0mittal at gmail.com
Sat Feb 9 14:32:27 PST 2013


I saw foreach and parallel commands on
http://dlang.org/phobos/std_parallelism.html

I have nested for-loops as follows:

for(int i=1; i< N; i++)
  {
   for(int j=1; j < M; j++)
    {
      func(i,j);
    }
  }

Here func(i,j) is such that there is no dependency or 
communication b/w different (i,j) tuple values. Thus, problem is 
very simple.

My question is how can I write a parallel foreach loop (if at 
all) for such problems in D. I would be grateful for your help.


More information about the Digitalmars-d-learn mailing list