Examples of GlobalObject


Examples of aleph.GlobalObject

  // sling tree nodes into a list -- requires root to be tail of list
  // only fills in next field, not prev
  private static GlobalObject makeList(GlobalObject root)
  {
    Tree t;
    GlobalObject gleft;
    GlobalObject gright;
    GlobalObject gttmp;
    GlobalObject retval = root;
    Tree ttmp;
    Join jv = new Join();
    if (root == null) return null;
    t = (Tree) root.open("w");
View Full Code Here

Examples of aleph.GlobalObject

  }

  public void printList(GlobalObject root)
  {
    Tree tmp, t;
    GlobalObject gtmp, oldgtmp;
  
    if (root == null) return;
    t = (Tree) root.open("r");
    System.out.println("x = " + t._x + ", y = " + t._y);
    gtmp = t._next;
    try {
      root.release();
    } catch (AlephException ale) {
      Aleph.warning("Release failed: " + ale.getMessage());
    }

    while(gtmp != root) {
      tmp = (Tree) gtmp.open("r");
      if (Aleph.verbosity(Constants.LOQUACIOUS))
  System.out.println("x = " + tmp._x + ", y = " + tmp._y);
      oldgtmp = gtmp;
      gtmp = tmp._next;
      try {
View Full Code Here

Examples of aleph.GlobalObject

  }
 
  // reverse orientation of list
  private static void reverseList(GlobalObject root)
  {
    GlobalObject gprev, gback, gnext, gtmp;
    Tree prev, back, next, tmp, t;
    
    if (root == null) return;
    t = (Tree) root.open("w");

    gprev = t._prev;
    prev = (Tree) gprev.open("w");
    prev._next = null;
    t._prev = null;
    try {
      gprev.release();
    } catch (AlephException ale) {
      Aleph.warning("Release failed: " + ale.getMessage());
    }

    gback = root;
    gtmp = root;
    root = t._next;
    back = t;

    while(root != null) {
      t = (Tree) root.open("w");
      gnext = t._next;
      t._next = gback;
      back._prev = root;
      try {
  gback.release();
      } catch (AlephException ale) {
  Aleph.warning("Release failed: " + ale.getMessage());
      }
      gback = root;
      back = t;
      root = gnext;
    }

    try {
      gback.release();
    } catch (AlephException ale) {
      Aleph.warning("Release failed: " + ale.getMessage());
    }

    tmp = (Tree) gtmp.open("w");
    tmp._next = gprev;
    try {
      gtmp.release();
    } catch (AlephException ale) {
      Aleph.warning("Release failed: " + ale.getMessage());
    }

    prev = (Tree) gprev.open("w");
    prev._prev = gtmp;
    try {
      gprev.release();
    } catch (AlephException ale) {
      Aleph.warning("Release failed: " + ale.getMessage());
    }

  }
View Full Code Here

Examples of aleph.GlobalObject

  // Use closest-point heuristic from Cormen Leiserson and Rivest
  private static GlobalObject conquer(GlobalObject gt)
  { 
    Tree cycle, tmp, min, prev, next;
    GlobalObject gdonext;
    GlobalObject gcycle, gmin, gtmp, gnext, gprev;
    Tree t;
    double mindist,test;
    double mintonext, mintoprev, ttonext, ttoprev;
    if (gt == null) return null;
    gt = makeList(gt);
   
    // Create initial cycle
    t = (Tree) gt.open("w");
    gcycle = gt;
    gt = t._next;
    t._next = gcycle;
    t._prev = gcycle;
    try {
      gcycle.release();
    } catch (AlephException ale) {
      Aleph.warning("Release failed: " + ale.getMessage());
    }

    for (; gt != null; gt=gdonext) { // loop over remaining points
      t = (Tree) gt.open("w");
      gdonext = t._next; // value won't be around later
      gmin = gcycle;
      cycle = (Tree) gcycle.open("r");
      mindist = distance(t, cycle);
      gtmp = cycle._next;
      try {
  gcycle.release();
      } catch (AlephException ale) {
  Aleph.warning("Release failed: " + ale.getMessage());
      }

      while (!gtmp.equals(gcycle)) {
  GlobalObject oldgtmp;
  tmp = (Tree) gtmp.open("r");
  test = distance(tmp, t);
  if (test < mindist) {
    mindist = test;
    gmin = gtmp;
        } /* if */
  oldgtmp = gtmp;
  gtmp = tmp._next;
  try {
    oldgtmp.release();
  } catch (AlephException ale) {
    Aleph.warning("Release failed: " + ale.getMessage());
  }
      } /* while gtmp... */

 
View Full Code Here

Examples of aleph.GlobalObject

  // Merge two cycles as per Karp
  private static GlobalObject merge(GlobalObject ga, GlobalObject gb,
            GlobalObject gt, int nproc)
  { 
    Tree min, next, prev, tmp;
    GlobalObject gmin, gnext, gprev, gtmp;
    Tree a, b, t;
    double mindist, test, mintonext, mintoprev, ttonext, ttoprev;
    Tree n1, p1, n2, p2;
    GlobalObject gn1, gp1, gn2, gp2;
    double tton1, ttop1, tton2, ttop2;
    double n1ton2, n1top2, p1ton2, p1top2;
    int choice;
    int i;
   
    /* Compute location for first cycle */
    gmin = ga;
    a = (Tree) ga.open("r");
    t = (Tree) gt.open("w");
    mindist = distance(t, a);
    gtmp = ga;
    ga = a._next;
    try {
      gtmp.release(); /* release ga from above */
    } catch (AlephException ale) {
      Aleph.warning("Release failed: " + ale.getMessage());
    }

    for (; !ga.equals(gtmp); ) {
      GlobalObject oldga;
      a = (Tree) ga.open("r");
      test = distance(a, t);
      if (test < mindist) {
  mindist = test;
  gmin = ga;
      } /* if */
      oldga = ga;
      ga = a._next;
      try {
  oldga.release();
      } catch (AlephException ale) {
  Aleph.warning("Release failed: " + ale.getMessage());
      }
    } /* for ga... */

    min = (Tree) gmin.open("w");
    gnext = min._next;
    gprev = min._prev;
    next = (Tree) gnext.open("w");
    prev = (Tree) gprev.open("w");
    mintonext = distance(min, next);
    mintoprev = distance(min, prev);
    ttonext = distance(t, next);
    ttoprev = distance(t, prev);
    if ((ttoprev - mintoprev) < (ttonext - mintonext)) {
      /* would insert between min and prev */
      gp1 = gprev;
      p1 = prev;
      gn1 = gmin;
      n1 = min;
      tton1 = mindist;
      ttop1 = ttoprev;
      try {
  gnext.release();
      } catch (AlephException ale) {
  Aleph.warning("Release failed: " + ale.getMessage());
      }
    }
    else { /* would insert between min and next */
      gp1 = gmin;
      p1 = min;
      gn1 = gnext;
      n1 = next;
      ttop1 = mindist;
      tton1 = ttonext;
      try {
  gprev.release();
      } catch (AlephException ale) {
  Aleph.warning("Release failed: " + ale.getMessage());
      }
    }
   
    /* At this point, I am holding gt,gn1,gp1 in write mode */
    /* Compute location for second cycle */
    gmin = gb;
    b = (Tree) gb.open("r");
    mindist = distance(t, b);
    gtmp = gb;
    gb = b._next;
    try {
      gtmp.release(); /* gb from above */
    } catch (AlephException ale) {
      Aleph.warning("Release failed: " + ale.getMessage());
    }

    for (; !gb.equals(gtmp); ) {
      GlobalObject oldgb;
     
      b = (Tree) gb.open("r");
      test = distance(b, t);
      if (test < mindist) {
  mindist = test;
  gmin = gb;
      } /* if */
      oldgb = gb;
      gb = b._next;
      try {
  oldgb.release();
      } catch (AlephException ale) {
  Aleph.warning("Release failed: " + ale.getMessage());
      }
    } /* for tmp... */

 
View Full Code Here

Examples of aleph.GlobalObject

  public void go() {
    go(_root, 150, PE.numPEs());
  }

  private static GlobalObject go(GlobalObject gt,int sz,int nproc) {
    GlobalObject gleftval;
    GlobalObject grightval;
    GlobalObject gtleft,gtright;
    Tree t;
    int nproc_2 = nproc/2;
    try {
      t = (Tree) gt.open("r");
      gtleft = t._left;
      gtright = t._right;
      try {
  gt.release();
      } catch (AlephException ale) {
  Aleph.warning("Release failed: " + ale.getMessage());
      }
      if (t._size <= sz) return conquer(gt);
   
      Join jv = new Join();
      PE pid = gtleft.getHome();
      if (pid.equals(PE.thisPE())) {  // Local PE
  gleftval = go(gtleft, sz, nproc_2);
      } else // Remote PE
  gleftval = new GlobalObject(new Tree());
  GlobalObject gb = new GlobalObject(gleftval);
  Traveler traveler = new Traveler(gb, gtleft, sz, nproc_2);
  traveler.start(pid, jv);
      }
   
      grightval = go(gtright, sz, nproc_2);
View Full Code Here

Examples of aleph.GlobalObject

      this.sz = sz;
      this.nproc = nproc;
    }

    public void run() {
      GlobalObject gleftval = (GlobalObject) gg.open("w");
      GlobalObject gtleft = (GlobalObject) gt.open("r");
      gleftval = go(gtleft, sz, nproc);
      try {
  gg.release();
  gt.release();
      } catch (AlephException ale) {
View Full Code Here

Examples of aleph.GlobalObject

  /** ================================================================
   * barnus_huts_data.nbody main
   **/
  public static void main (String[] args) {
    int c, i;
    GlobalObject root;
    double dt;
    int pe;
    Join join = new Join();
 
    Data data[] = new Data[ PE.numPEs() ]; // store data distribution info
View Full Code Here

Examples of aleph.GlobalObject

      System.err.println("makecell: MAXCELLS limit reached");
      System.err.flush();
      Aleph.exit(1);
    }
    if (cellTab[n] == null)
      cellTab[n] = new GlobalObject( new Cell() );
    cell = (Cell) cellTab[n].open( "w" );
    for (i = 0; i < nSub; ++i)
      cell.next[i] = null;
    cell.type = 0;
    cell.mass = -1.0;
View Full Code Here

Examples of aleph.GlobalObject

          body.mass = srcs.readDouble();
          for( j = 0; j < nDim; j++ )
            body.pos[j] = srcs.readDouble();
          for( j = 0; j < nDim; j++ )
            body.vel[j] = srcs.readDouble();
          bodyTab[i] = new GlobalObject ( body );
 
        }
      }
      catch( IOException e ){ }
      finally{
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.