import java.io.IOException;
@RegisterStorage(PcjReductionGet.Shared.class)
public class PcjReductionGet implements StartPoint {
@Storage(PcjReductionGet.class)
public static void main(String[] args) throws IOException {
String nodesFile = "nodes.txt";
PCJ.executionBuilder (PcjExample.class)
.addNodes(new File("nodes.txt"))
public void main() throws Throwable {
PcjFuture aL[] = new PcjFuture[PCJ.threadCount()];
if (PCJ.myId() == 0) { // Asynchronous communication
for (int p = 0; p < PCJ.threadCount(); p++) {
aL[p] = PCJ.asyncGet(p, Shared.a);
PCJ.barrier(); // Synchronization
if (PCJ.myId() == 0) { // Sumation of local values
for (int p = 0; p < PCJ.threadCount(); p++) {
sum = sum + (long) aL[p].get();
System.out.println(PCJ.myId() + " " + sum);