PS -- The "typically" is because the author of a domain map can implement the parallelism in the forall loop any way they want to. The standard distributions that we supply are intended to target both inter- and intra-locale parallelism.

On Mon, 29 Aug 2016, Brad Chamberlain wrote:


Hi Hui --

Forall loops overdistributed domains/arrays typically enable parallelism both across locales and within a compute node. So the better sketch of how it would be rewritten

coforall loc in Locales {
  on loc {
     forall msg in local_MessageSpace {
            writeln();
     }
  }
}

Where that inner 'forall' would use multicore parallelism within the locale, much as a forall loop over a default domain/array would.

Hope this helps,
-Brad


On Fri, 26 Aug 2016, Hui Zhang wrote:

Hello,

I have a question about forall, considering the simple example of
hello4-datapar-dist.chpl:

config const numMessages = 100;
const MessageSpace = {1..numMessages} dmapped Cyclic(startIdx=1);
forall msg in MessageSpace do
 writeln("Hello, world! (from iteration ", msg, " of ", numMessages,
"owned by locale ", here.id, " of ", numLocales, ")");

​Here, after the domain is dmapped, the MessageSpace will be distributed.​
For example, we have 10 nodes, and 2 cores per node. Will the forall loop
ends up getting a parallelism of 20 ?

I ran it and the output is in arbitary order, so does the forall implicitly
enable both the parallelism among locales and the parallelism within a
single locale ? In other words, does it actually have similar effect as the
following style:
coforall loc in Locales {
   on loc {
       for msg in local_MessageSpace {
           writeln();
       }
    }
}
*the local_MessageSpace will be determined by here.id, MessageSpace and the
domain mapping it uses(e.g Cyclic), sometimes hard to determne

Thanks !

--
Best regards


Hui Zhang
------------------------------------------------------------------------------
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

Reply via email to