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

Reply via email to