Package aleph

Examples of aleph.Join


    Queens solution = new Queens(this, r, c);

    int nextRow = r+1;

    Join join = new Join();
    Iterator e = PE.roundRobin();
    for (int i = 0; i < N; i++) {
      if (solution.col[i] && solution.getLeftDiag(nextRow, i)
    && solution.getRightDiag(nextRow, i)) {
  solution.row[nextRow] = i;
  if (nextRow == N-1) {
    System.out.println(solution);
    return;    // no other solutions possible
  } else {    // fork and return
    Worker worker = new Worker(solution, nextRow, i, depth-1);
    worker.start((PE) e.next(), join);
  }
      }
    }
    join.waitFor();
  }
View Full Code Here


      Aleph.error("usage: Counter <#increments>");
      Aleph.exit(1);
    }
    GlobalObject global = new GlobalObject( new Counter() );
    UserThread   fork   = new UserThread(count, global);
    Join         join   = new Join();
    long start = System.currentTimeMillis();
    for (Iterator e = PE.allPEs(); e.hasNext(); ) {
      fork.start((PE) e.next(), join);
    }
    join.waitFor();
    Counter counter = (Counter) global.open("r");
    System.out.println(PE.numPEs() + " PEs, Final value is " + counter.value);
    System.out.println("Elapsed time: " +
           ((double) (System.currentTimeMillis() - start)) / 1000.0
           + " seconds");
View Full Code Here

  public static void main(String[] args) {
   
    HelloThread thread = new HelloThread();

    Join join = new Join();

    long start = System.currentTimeMillis();
    for (Iterator e = PE.allPEs(); e.hasNext(); ) {
      thread.start((PE) e.next(), join);
    }
    join.waitFor();
    System.out.println("Elapsed time: " +
           ((double) (System.currentTimeMillis() - start)) / 1000.0);
  }
View Full Code Here

    }
  }

  public static void main(String[] args) {
    HelloThread thread = new HelloThread();
    Join join = new Join();
    long start = System.currentTimeMillis();
    for (Iterator e = PE.allPEs(); e.hasNext(); )
      thread.start((PE) e.next(), join);
    while(join.hasNext())
      System.out.println((String) join.next());
    System.out.println("Elapsed time: " +
           ((double) (System.currentTimeMillis() - start)) / 1000.0);
  }
View Full Code Here

      Aleph.error("usage: BigCounter <#increments>");
      Aleph.exit();
    }
    GlobalObject global = new GlobalObject( new BigCounter() );
    UserThread   fork   = new UserThread(count, global);
    Join         join   = new Join();
    long start = System.currentTimeMillis();
    for (Iterator e = PE.allPEs(); e.hasNext(); )
  fork.start((PE) e.next(), join);
    join.waitFor();
    BigCounter counter = (BigCounter) global.open("r");
    System.out.println("Final value is " + counter.value[0]);
    System.out.println("Elapsed time: " +
           ((double) (System.currentTimeMillis() - start)) / 1000.0
           + " seconds");
View Full Code Here

       System.out.println("Iteration " + r);
     }

     GlobalObject global = new GlobalObject( new Matrix(n) );
     UserThread   fork;
     Join         join   = new Join();

     long start = System.currentTimeMillis();

     // Start n*n threads to compute each entry of the result matrix

     Iterator e = PE.roundRobin();
     for (int i = 0; i < n; i++)
       for (int j = 0; j < n; j++) {
   fork = new UserThread(global, i, j, n);
   fork.start((PE)e.next(), join);
       }
     join.waitFor();
     // Print out the result
     Matrix matrix = (Matrix) global.open("r");
     System.out.println("The result matrix is: ");
     System.out.println(matrix);
     try { global.release(); } catch (AlephException x) {}
View Full Code Here

     // uniformly on numproc PEs, each part denoted by -myVertexList-
     // respectively

     System.out.println("phase 1");
     InitThread fork = new InitThread(numvert, perproc);
     Join       join = new Join();
     Iterator e = PE.roundRobin();
     for (int i = 0; i < numproc; i++)
       fork.start((PE) e.next(), join);
     join.waitFor();

     System.out.println("phase 2");
     AddEdgeThread fork1 = new AddEdgeThread(numvert, perproc);
     e = PE.allPEs();
     for (int i = 0; i < numproc; i++)
       fork1.start((PE) e.next(), join);
     join.waitFor();

   }
View Full Code Here

      }

      public Object run() {

        BlueRuleThread fork, fork1;
        Join join, join1;
        BlueReturn retleft = new BlueReturn();
        BlueReturn retright = new BlueReturn();

        if (nproc > 1) {
          fork = new BlueRuleThread(inserted, nproc/2, pn+nproc/2);
    join = new Join();
          fork.start(PE.getPE(pn+nproc/2), join);
    try {
      retleft = (BlueReturn) join.next();
          } catch (NoSuchElementException e) {
      System.out.println("left NoSuchElementException: "+e);
          }

          fork1 = new BlueRuleThread(inserted, nproc/2, pn);
    join1 = new Join();
          fork1.start(PE.thisPE(), join1);
          try {
            retright = (BlueReturn) join1.next();
          } catch (NoSuchElementException e) {
            System.out.println("right NoSuchElementException: "+e);
View Full Code Here

    System.out.println("Test is : " + round + " round(s) of " + count + " incrementation(s)");
    System.out.flush();
   
    GlobalObject global = new GlobalObject( new GlobalObjectLatency() );
    UserThread   fork   = new UserThread(count, round, PE.numPEs(), global);
    Join         join   = new Join();
    long start = System.currentTimeMillis();
    for (Iterator e = PE.allPEs(); e.hasNext(); ) {
      fork.start((PE) e.next(), join);
    }
    join.waitFor();
    GlobalObjectLatency counter = (GlobalObjectLatency) global.open("r");
    System.out.println(PE.numPEs() + " PEs, Final value is " + counter.value);
    System.out.println("Elapsed time: " +
           ((double) (System.currentTimeMillis() - start)) / 1000.0
           + " seconds");
View Full Code Here

  public static void main(String[] args) {

    MyThread thread = new MyThread();

    Join join = new Join();

    int howMany = PE.numPEs();
    int iterations = 100;
    try {
      if ( args.length > 0)
  iterations = Integer.parseInt(args[0]);
    } catch (NumberFormatException e) {
      System.err.println("usage: Null <#iterations>");
      Aleph.exit(1);
    }

    System.out.println("iterations: " + iterations);
    System.out.println("#PEs\ttime");
    for (int i = 0; i < PE.numPEs(); i++) {
      long duration = 0;
      for (int j = 0; j < iterations; j++) {
        Iterator e = PE.roundRobin();
        long start = System.currentTimeMillis();
        for (int k = 0; k < i; k++)
          thread.start((PE) e.next(), join);
        join.waitFor();
        long stop = System.currentTimeMillis();
        duration += (stop - start);
      }
      System.out.println(Integer.toString(i+1) + "\t" +
                         (double) duration / (double) iterations);
View Full Code Here

TOP

Related Classes of aleph.Join

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.