Communication - async
PCJ.asyncBroadcast() - Sends data from one PCJ thraed to all other threads.
@Storage(PcjExample.class)
enum Shared { a }
public double a;
...
if (PCJ.myId() == 0 ) {
a = 5.0;
PCJ.asyncBroadcast(a, Shared.a);
}
...
PCJ.waitFor(Shared.a);
System.out.println("a = "+a);PCJ.asyncPut() - Sends data from one PCJ thraed to another PCJ threads (PCJ thread 0 sends data to PCJ thread 1)
@Storage(PcjExample.class)
enum Shared { a }
public double a;
...
if (PCJ.myId() == 0 ) PCJ.asyncPut(a, 1, Shared.a);
...
if (PCJ.myId() == 1 ) {
PCJ.waitFor(Shared.a);
System.out.println("a = "+a);
}PCJ.asyncGet() - Gets data from anether PCJ thraed (form PCJ thread 1)
PCJ.asyncReduce() - Gathers values from all PCJ threads and performs reduction (eg. sum).
PCJ.asyncCollect() - Collects (gathers) values from all PCJ threads
Last updated
Was this helpful?