Hello Vijay,

Thank you for your fast reply.

I have implemented the code that you send me, but I have yet another
problem. Because, regardless of the number of threads that I have in each
place (X10_NTHERADS), the first async task (with the parallel function)
ends first than the async task with the kill variable update. Then, the
algorithm always waits for the end in all places.

I guess that is how the x10 activities scheduler works, unfortunately with
this behavior I don't have any speedup with the parallelism.

Is there a way for this part of the code creates a priority async task?

for (p in Place.places() if (home.id != p.id) at(p) async
root().killed=true;

Regards,

Danny Múnera


On Tue, Apr 2, 2013 at 1:04 PM, Vijay Saraswat <vi...@saraswat.org> wrote:

>  On 4/2/13 5:06 AM, Danny Munera wrote:
>
>  Hello all,
>
>  I’m trying to implement an algorithm in parallel. The idea is using each
> place as an algorithm independent instance, then, finishing the program
> when the first place reaches the solution. So far, I have something like
> this:
>
>  finish for (p in Place.places()) at(p)async{
>  sol = parallel_function();
>  //kill other places
> }
>
>  Currently, I don’t have any idea about how to kill the other place, I
> have searched in x10 tutorials, language specification and the API, and I
> have not found anything.
>
>  Do you have any idea to how to do that?
>
>
>  You don't "kill" a place, you kill the activities running at a place.
> Have them periodically check for a variable being set. e.g.
>
> class C {
>   var killed:Boolean=false;
>
>   static def compute() {
>     val roots= PlaceLocalHandle.make[C](Dist.makeUnique(), ()=> new C());
>
>      finish for (p in Place.places()) at(p)async{
>  sol = roots().parallel_function();
>         val home =here;
>  for (p in Place.places() if (home.id != p.id) at(p) async
> root().killed=true;
>        }
>   }
>    def parallel_function() {
>      while (! killed) continueComputing();
>      // store the result of computing in state on C, now retrieve it
>      return result();
>   }
> }
>
>
>
>
> ------------------------------------------------------------------------------
> Own the Future-Intel(R) Level Up Game Demo Contest 2013
> Rise to greatness in Intel's independent game demo contest. Compete
> for recognition, cash, and the chance to get your game on Steam.
> $5K grand prize plus 10 genre and skill prizes. Submit your demo
> by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
> _______________________________________________
> X10-users mailing list
> X10-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/x10-users
>
>
------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to