Thanks a lot. I did that and am getting an error, which is as follows. I
have a DistArray over 2 places which holds some values and I have to allow
activities from these 2 places to access DistArray. That means, an activity
at one place should be able to access (which means read and modify)
DistArray value which is at another place.

So problem is to ensure that access is atomic. When I write:

*myAnswer = at(place2) myDistArray(actualIndex);*
it is not atomic, since two activities may together read the myDistArray.

And when I do:
*atomic {
**myAnswer = at(place2) myDistArray(actualIndex);
}
*
It is not allowed since atomic operation has to be all on one place.

And when I do:
*val myAnswer:int ;
at(place2)
{
   atomic  {
**                 myAnswer = at(place2) myDistArray(actualIndex); **

                  }

}*
it says: *Local variable is accessed at a different place, and therefore it
must be an initialized val
Variable name: myAnswer
Final variable might already have been initialized

*So, I am not sure how to implement reading from another place, while
making sure that no two activities read at the same time since an activity
reads an array item that item is considered to be used-up (not shown here).
Please let me know. Thanks for your time.
*
*
Thanks and Regards
Sparsh Mittal



On Thu, Feb 21, 2013 at 3:24 PM, Josh Milthorpe
<josh.miltho...@anu.edu.au>wrote:

>  Hi Sparsh,
>
> the DistArray class is perfect for sharing data (and work) between
> places.  See section 16 of the language spec.  Also, ateach (section 14.5)
> is a simple way to execute over all elements in a DistArray.
>
> Cheers,
>
> Josh
>
>
> On 22/02/13 01:02, Sparsh Mittal wrote:
>
> I wanted to seek answer to the above question and would be grateful if you
> could answer or point me to a suitable reference. The essence of question
> is how to have shared data b/w different places. Thanks.
>
>  Thanks and Regards
> Sparsh Mittal
>
>
>
> On Tue, Feb 19, 2013 at 4:44 PM, Sparsh Mittal <sparsh0mit...@gmail.com>wrote:
>
>> Hello
>>
>> I wrote two programs:
>>
>> 1. A program where I issue  "async doWork()" inside a for loop. I run
>> this with X10_NTHREADS=2
>> 2. A program where I issue  "async at(kk) doWork()" inside a for loop. I
>> run this program with X10_NPLACES=2.
>>
>> The doWork() function (called worker) is such that different workers have
>> to communicate.  For this, I use an array in the class.
>>
>> In case 1, it was easy, since a single copy of array is created and both
>> workers can read from it.
>>
>> In case 2, I think, the array is copied to another place also; so both
>> workers end up doing all the works.
>>
>> Can you suggest, how can I alleviate this problem? Specifically, how to
>> enable communication between different places. Thanks a lot for your help.
>>
>>
>>
>>  Thanks and Regards
>> Sparsh Mittal
>>
>>
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:http://p.sf.net/sfu/appdyn_d2d_feb
>
>
>
> _______________________________________________
> X10-users mailing 
> listX10-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/x10-users
>
>
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_feb
> _______________________________________________
> X10-users mailing list
> X10-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/x10-users
>
>
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to