Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

No Format
  public final void bsp(
      BSPPeer<KEYIN, VALUEIN, KEYOUT, VALUEOUT> peer)
      throws IOException, InterruptedException, SyncException {

    for (String otherPeer : peer.getAllPeerNames()) {
      String peerName = peer.getPeerName();
      LongMessage msg = 
        new LongMessage("Hello from " + peer.getPeerName());
      bspPeer.send(peerName, mgs);
    }

    bspPeer.sync();
  
}

Wiki MarkupThe generics in the BSPPeer are related to the \[IOSystem | Input and Output System\].

Synchronization

When all processes have entered the barrier by sync() function, the Hama proceeds to the next superstep. In previous example case, the BSP job will be finished by one synchronization after sending a message “Hello from ...” to all peers. The sync() function is very flexible. For example, the sync() function can be also located in a for loop:

...