...
BSP Programming Model
Hama BSP programming interface model is designed to be similar to the MapReduce interfaceprogramming model. This allows the framework to be less complex than the traditional BSP libraries capable of executing sequential code, we to provide user-friendly and intuitive programming interface to existing users of MapReduce framework. See
Let's see the below example code to understand it:
No Format |
---|
public class BSPEaxmple { public static class MyBSP extends BSP { @Override public void bsp(BSPPeer bspPeer) throws IOException, KeeperException, InterruptedException { // A communication and synchronization phase of a BSP superstep // Send data to neighbor node bspPeer.send(hostname, msg); // Superstep synchronization bspPeer.sync(); // Receive current messages bspPeer.getCurrentMessage(); } @Override public Configuration getConf() { return conf; } @Override public void setConf(Configuration conf) { this.conf = conf; } } // BSP job configuration public void main(String[] args) throws Exception { BSPJob bsp = new BSPJob(new HamaConfiguration(), BSPEaxmple.class); // Set the job name bsp.setJobName("My BSP Job"); bsp.setBspClass(MyBSP.class); // Submit job BSPJobClient.runJob(bsp); } } |
...