Package aleph

Examples of aleph.PE


      Aleph.exit(1);
    }

    // If I'm the first PE, skip one.
    Iterator e = PE.roundRobin();
    PE pe = (PE) e.next(); // first PE
    if (pe.equals(PE.thisPE()))  // it's me
      pe = (PE) e.next(); // use the next PE
    System.out.println("RoundTrip: " + PE.thisPE().getAddress() +
                       " and " + pe.getAddress() +
                       " " + howMany + " rounds.");

    System.out.println("Size\tmin\tmax\tavg");
    try {
      for (int i = 0; i < MAX_SIZE; i++) {
View Full Code Here


      Aleph.exit(1);
    }

    // If I'm the first PE, skip one.
    Iterator e = PE.roundRobin();
    PE pe = (PE) e.next(); // first PE
    if (pe.equals(PE.thisPE()))  // it's me
      pe = (PE) e.next(); // use the next PE
    System.out.println("AsynchRoundTrip: " + PE.thisPE().getAddress() +
                       " and " + pe.getAddress() +
                       " " + howMany + " rounds.");

    System.out.println("Size\tmin\tmax\tavg");
    for (int i = 0; i < MAX_SIZE; i++) {
      long min = Integer.MAX_VALUE;
View Full Code Here

               double maxX, double minY, double maxY)
  {
    double med;
    Tree t = new Tree();
    Join jv = new Join();
    PE me = PE.thisPE();
    GlobalObject gb;
    int leftN, rightN;
   
    if (Aleph.verbosity(Constants.LOQUACIOUS))
      System.out.println("n:"+n+" dir:"+dir+" peNo:"+peNo+" numPE:"+numPE);
    if (n == 0) return null;
    gb = new GlobalObject(t);
   
    t = (Tree) gb.open("w");
    leftN = (n-1)/2;
    rightN = n-1-leftN;
    if (dir == 1) {
      dir = 0;
      med = median(minX, maxX, n);

      if (leftN == 0)
  t._left = null;
      else {
  if (me.equals(PE.getPE(peNo+numPE/2))) {  // Local PE
    if (Aleph.verbosity(Constants.LOQUACIOUS))
      System.out.print("Left ");
    t._left = buildTree(leftN, dir, peNo+numPE/2, numPE/2, minX, med, minY, maxY);
  } else // Remote PE
    try {
      gb.release();
    } catch (AlephException ale) {
      Aleph.warning("Release failed: " + ale.getMessage());
    }
    Builder builder = new Builder(gb, leftN, dir, peNo+numPE/2, numPE/2,
          minX, med, minY, maxY);
    builder.start(PE.getPE(peNo+numPE/2), jv);
    jv.waitFor();
    t = (Tree) gb.open("w");
  }
      }
     
      if (rightN == 0)
  t._right = null;
      else {
  if (Aleph.verbosity(Constants.LOQUACIOUS))
    System.out.print("Right ");
  // Right subtree always in local PE
  t._right = buildTree(rightN, dir, peNo, numPE/2, med, maxX, minY, maxY);
      }

      t._x = med;
      t._y = uniform(minY, maxY);

    } else {
      dir = 1;
      med = median(minY, maxY, n);

      if (leftN == 0)
  t._left = null;
      else {
  if (me.equals(PE.getPE(peNo+numPE/2))) {  // Local PE
    if (Aleph.verbosity(Constants.LOQUACIOUS))
      System.out.print("Left ");
    t._left = buildTree(leftN, dir, peNo+numPE/2, numPE/2, minX, maxX, minY, med);
  } else // Remote PE
    try {
View Full Code Here

  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);
View Full Code Here

   * @param mode   Mode in which to open object.
   **/
  public synchronized Object open (AbstractContext context, GlobalObject key, String mode) {
    Logger.debug("TryOpen " + key + " for context " + context);
    Status status  = (Status) arrow.get(key);
    PE     thisPE  = PE.thisPE();
    int    myIndex = thisPE.getIndex();
    try {
      if (status == null)  {      // object is unknown
        status = new Status(thisPE);
        arrow.put(key, status);   // legalize it
        FindMessage find = new FindMessage(context, key);
View Full Code Here

    PE requestor;
    Vector<PE> path; //record the path a find message travels
   // boolean test;

    FindMessage(AbstractContext context, GlobalObject key) {
      PE pe = PE.thisPE();
      this.from = pe;
      this.context = context;
      this.key = key;
      requestor = pe;
      path = new Vector <PE>();
View Full Code Here

    public void run() {
      try{
        Logger.debug("Receving find message " + this);
        synchronized (theManager) {
          Status status = (Status) theManager.arrow.get(key);
          PE newDirection = from;
          if (RelayDirectory.DEBUG)
            Aleph.debug(this + " called\t " + status);
          if (status == null) {
            /* Object is unknown.
             * Install status record for object.
             * Flip arrow toward incoming edge.
             * send toward object's id.home
             */
            status = new Status(newDirection); // install status
            theManager.arrow.put(key, status);
            this.from = PE.thisPE();
            this.path.add(from);
            PE direction = theManager.route(key.getHome());
            Logger.debug("New Object, forwarding find msg " + this + " to " + direction);
            this.send(direction);
          } else {
            /* Object is known.
             * Flip arrow toward incoming edge.
             * Check whether object is local.
             */
            PE direction = status.direction;
            //this.path.add(this.from);
            //System.out.println("find msg from this " + this.from.getIndex());
            //System.out.println("find msg from " + from.getIndex());
            //status.direction = newDirection; // flip arrow
            if (direction.equals(PE.thisPE())) { // object is local
              if (status.busy || status.count > 0 || status.object == null) {
                // object is real busy
                status.pending = requestor; // so get in line
                status.pendingPath = (Vector) this.path.clone();
               
View Full Code Here

   * @param mode   Mode in which to open object.
   **/
  public synchronized Object open (AbstractContext context, GlobalObject key, String mode) {
  Logger.debug("TryOpen " + key + " for context " + context);
    Status status  = (Status) arrow.get(key);
    PE     thisPE  = PE.thisPE();
    int    myIndex = thisPE.getIndex();
    try {
      if (status == null)  {      // object is unknown
        status = new Status(thisPE);
        arrow.put(key, status);   // legalize it
        FindMessage find = new FindMessage(context, key);
View Full Code Here

    AbstractContext context;
    GlobalObject key;
    PE requestor;

    FindMessage(AbstractContext context, GlobalObject key) {
      PE pe = PE.thisPE();
      this.from = pe;
      this.context = context;
      this.key = key;
      requestor = pe;
    }
View Full Code Here

    public void run() {
      Logger.debug("Context " + context + "@" + requestor.getIndex() + " try finding here " + key);
      try{
          synchronized (theManager) {
            Status status = (Status) theManager.arrow.get(key);
            PE newDirection = from;
            if (ArrowDirectory.DEBUG)
              Aleph.debug(this + " called\t " + status);
            if (status == null) {
              /* Object is unknown.
               * Install status record for object.
               * Flip arrow toward incoming edge.
               * send toward object's id.home
               */
              status = new Status(newDirection); // install status
              theManager.arrow.put(key, status);
              this.from = PE.thisPE();
              Logger.debug("Install new status:" + status);
              PE pe = theManager.route(key.getHome());
              this.send(pe);
              Logger.debug("Sending first find to " + pe);
            } else {
              /* Object is known.
               * Flip arrow toward incoming edge.
               * Check whether object is local.
               */
              PE direction = status.direction;
              status.direction = newDirection; // flip arrow
              if (direction.equals(PE.thisPE())) { // object is local
                if (status.busy || status.localPending.size() > 0 || status.object == null) {
                  // object is real busy
                  status.requester = requestor; // so get in line
                  status.pending = context;
                 
View Full Code Here

TOP

Related Classes of aleph.PE

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.