Brad, Vassily --
Thanks for the responses....
Brad is correct in that what I was trying to do was to see if a forall
could do something like :
coforall iwork in WorkerList {
// Do some initialization that is local to each iwork
var MyD = splitDomain(BigD, iwork, WorkerList);
for ii in MyD {
//
}
// Finish up, again local to each iwork
}
I guess this is my mental model for what the forall loop actually
translates to (with some internal WorkerList), but thinking about it some
more, I can see that this is probably too limiting.
Looking at the code that I have above, it actually is quite straightforward
(and not really worth abstracting further). The only step that requires
some thought is how to split the domain. This is easy for a simple domain
in 1D, but it might be useful to have a simple version that handles an
arbitrary domain (with the obvious comment that a user might want to
rewrite this for a specific application).
I assume something like this already exists inside Chapel -- is there some
way for the user to access this?
Thanks!
-- Nikhil
---------------------------------
Nikhil Padmanabhan
[email protected]
On Tue, Mar 22, 2016 at 12:45 AM, Brad Chamberlain <[email protected]> wrote:
>
> I don't think that provides what Nikhil's asking for, though.
> Specifically, I think what he wants is:
>
> forall i in D do
> ... some way of referring directly/implicitly the ID from
> 0..#numTasks for this particular task (similar to
> 'here' in locale space, but in the task space created
> by the loop) where numTasks is the number of tasks
> created by the forall loop...
>
> Of course, you'd also want/need a way to query what that number is. And to
> make it extra challenging from a design perspective, that number could
> potentially vary as the forall loop runs...
>
> FWIW, this is something I find myself wanting from time to time too, but
> haven't had that "aha!" moment as to how we should provide it. Well,
> except for the long-term plan to support task teams and to have a way of
> getting at the task team(s) that implement parallel constructs like forall
> loops (or coforall loops) or in which case it might be something as simple
> as:
>
> forall i in D do
> (myTID, numTasks) = thisTeam.getMembership()
>
> -Brad
>
>
>
> On Mon, 21 Mar 2016, Vassily Litvinov wrote:
>
> Nikhil,
>>
>> Try using "in" as a forall intent. That should give you task-private
>> variables in a forall loop.
>>
>> Vassily
>>
>> On 03/21/16 17:04, Nikhil Padmanabhan wrote:
>>
>>> Dear all,
>>>
>>> For the code executing inside a forall loop, is there any way in which it
>>> can determine what its "thread" id is?
>>>
>>> I'm imagining a case here where I need to call a function that takes in
>>> some state variable (eg. like a random number generator) that it might
>>> modify. The simplest way I can think of doing this in parallel would be
>>> to
>>> have Nthread copies of the state variable, and then every thread just
>>> modifies its own copy.
>>>
>>> I can certainly do this using a coforall loop; I was just curious if
>>> there
>>> was a way to do this even in forall loops....
>>>
>>> Thanks!
>>> -- Nikhil
>>> ---------------------------------
>>> Nikhil Padmanabhan
>>> [email protected]
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Transform Data into Opportunity.
>>> Accelerate data analysis in your applications with
>>> Intel Data Analytics Acceleration Library.
>>> Click to learn more.
>>> http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
>>>
>>>
>>>
>>> _______________________________________________
>>> Chapel-users mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/chapel-users
>>>
>>>
>>
>> ------------------------------------------------------------------------------
>> Transform Data into Opportunity.
>> Accelerate data analysis in your applications with
>> Intel Data Analytics Acceleration Library.
>> Click to learn more.
>> http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
>> _______________________________________________
>> Chapel-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/chapel-users
>>
>>
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users