Examples of BSPJob


Examples of org.apache.hama.bsp.BSPJob

    bsp.setMessageClass(DoubleWritable.class);
    return bsp;
  }

  static BSPJob getPiestimatorJob(HamaConfiguration conf) throws IOException {
    BSPJob bsp = new BSPJob(conf);
    bsp.setInputFormat(NullInputFormat.class);
    bsp.setOutputFormat(SequenceFileOutputFormat.class);
    bsp.setOutputKeyClass(NullWritable.class);
    bsp.setOutputValueClass(DoubleWritable.class);
    bsp.setMessageClass(IntWritable.class);
    return bsp;
  }
View Full Code Here

Examples of org.apache.hama.bsp.BSPJob

    return bsp;
  }

  static BSPJob getMatrixMultiplicationJob(HamaConfiguration conf,
      Path transposedMatrixB) throws IOException {
    BSPJob bsp = new BSPJob(conf);
    bsp.setInputFormat(SequenceFileInputFormat.class);
    bsp.setInputKeyClass(IntWritable.class);
    bsp.setInputValueClass(PipesVectorWritable.class);
    bsp.setOutputFormat(SequenceFileOutputFormat.class);
    bsp.setOutputKeyClass(IntWritable.class);
    bsp.setOutputValueClass(PipesVectorWritable.class);
    bsp.setMessageClass(PipesKeyValueWritable.class);

    bsp.set(Constants.RUNTIME_PARTITIONING_DIR, HAMA_TMP_OUTPUT + "/parts");
    bsp.setBoolean(Constants.ENABLE_RUNTIME_PARTITIONING, true);
    bsp.setPartitioner(PipesPartitioner.class);

    // sort sent messages
    bsp.set(MessageManager.RECEIVE_QUEUE_TYPE_CLASS,
        "org.apache.hama.bsp.message.queue.SortedMemoryQueue");
    bsp.set("hama.mat.mult.B.path", transposedMatrixB.toString());
    return bsp;
  }
View Full Code Here

Examples of org.apache.hama.bsp.BSPJob

            "unsupported RegressionModel").append(args[1])
            .append(", use 'logistic' or 'linear'").toString());
      }
    }

    BSPJob bsp = new BSPJob(conf, GradientDescentExample.class);
    // Set the job name
    bsp.setJobName("Gradient Descent Example");
    bsp.setBspClass(GradientDescentBSP.class);
    bsp.setInputFormat(VectorDoubleFileInputFormat.class);
    bsp.setInputPath(new Path(args[0]));
    bsp.setInputKeyClass(VectorWritable.class);
    bsp.setInputValueClass(DoubleWritable.class);
    bsp.setOutputKeyClass(VectorWritable.class);
    bsp.setOutputValueClass(DoubleWritable.class);
    bsp.setOutputFormat(TextOutputFormat.class);
    FileOutputFormat.setOutputPath(bsp, TMP_OUTPUT);

    long startTime = System.currentTimeMillis();
    if (bsp.waitForCompletion(true)) {
      printOutput(conf);
      System.out.println("Job Finished in "
          + (System.currentTimeMillis() - startTime) / 1000.0 + " seconds");
    }
View Full Code Here

Examples of org.apache.hama.bsp.BSPJob

    HamaConfiguration conf = new HamaConfiguration();

    conf.setInt(SIZE_OF_MATRIX, Integer.parseInt(args[0]));
    conf.setInt(DENSITY, Integer.parseInt(args[1]));

    BSPJob bsp = new BSPJob(conf, CombineExample.class);
    // Set the job name
    bsp.setJobName("Random Symmetric Matrix Generator");
    bsp.setBspClass(SymmetricMatrixGenBSP.class);
    bsp.setInputFormat(NullInputFormat.class);
    bsp.setOutputKeyClass(Text.class);
    bsp.setOutputValueClass(TextArrayWritable.class);
    bsp.setOutputFormat(SequenceFileOutputFormat.class);
    FileOutputFormat.setOutputPath(bsp, new Path(args[2]));
    bsp.setNumBspTask(Integer.parseInt(args[3]));

    long startTime = System.currentTimeMillis();
    if (bsp.waitForCompletion(true)) {
      System.out.println("Job Finished in "
          + (System.currentTimeMillis() - startTime) / 1000.0 + " seconds");
    }
  }
View Full Code Here

Examples of org.apache.hama.bsp.BSPJob

    HamaConfiguration conf = new HamaConfiguration();

    conf.setInt(SIZE_OF_MATRIX, Integer.parseInt(args[0]));
    conf.setInt(MAX_EDGES, Integer.parseInt(args[1]));

    BSPJob bsp = new BSPJob(conf, FastGraphGenBSP.class);
    // Set the job name
    bsp.setJobName("Random Fast Matrix Generator");
    bsp.setBspClass(FastGraphGenBSP.class);
    bsp.setInputFormat(NullInputFormat.class);
    bsp.setOutputKeyClass(Text.class);
    bsp.setOutputValueClass(TextArrayWritable.class);
    bsp.setOutputFormat(SequenceFileOutputFormat.class);
    FileOutputFormat.setOutputPath(bsp, new Path(args[2]));
    bsp.setNumBspTask(Integer.parseInt(args[3]));

    long startTime = System.currentTimeMillis();
    if (bsp.waitForCompletion(true)) {
      System.out.println("Job Finished in "
          + (System.currentTimeMillis() - startTime) / 1000.0 + " seconds");
    }
  }
View Full Code Here

Examples of org.apache.hama.bsp.BSPJob

      conf.set("layerSizeArray", layerSizeArraySb.toString());
    }

    HamaConfiguration hamaConf = new HamaConfiguration(conf);

    BSPJob job = new BSPJob(hamaConf, SmallMLPTrainer.class);
    job.setJobName("Small scale MLP training");
    job.setJarByClass(SmallMLPTrainer.class);
    job.setBspClass(SmallMLPTrainer.class);
    job.setInputPath(dataInputPath);
    job.setInputFormat(org.apache.hama.bsp.SequenceFileInputFormat.class);
    job.setInputKeyClass(LongWritable.class);
    job.setInputValueClass(VectorWritable.class);
    job.setOutputKeyClass(NullWritable.class);
    job.setOutputValueClass(NullWritable.class);
    job.setOutputFormat(org.apache.hama.bsp.NullOutputFormat.class);

    int numTasks = conf.getInt("tasks", 1);
    job.setNumBspTask(numTasks);
    job.waitForCompletion(true);

    // reload learned model
    Log.info(String.format("Reload model from %s.",
        trainingParams.get("modelPath")));
    this.modelPath = trainingParams.get("modelPath");
View Full Code Here

Examples of org.apache.hama.bsp.BSPJob

      indir = t.getStr();
      // no check for ll.isEmpty() to permit extension
    }

    private BSPJob getConf(BSPJob job) throws IOException {
      BSPJob bspJob = new BSPJob((HamaConfiguration) job.getConfiguration());
      FileInputFormat.setInputPaths(bspJob, indir);
      return bspJob;
    }
View Full Code Here

Examples of org.apache.hama.bsp.BSPJob

  public void test() throws Exception {
    HamaConfiguration jobConf = controller.getConfiguration();
    jobConf.set("hadoop.rpc.socket.factory.class.default",
        "org.apache.hadoop.net.StandardSocketFactory");

    BSPJob bsp = new BSPJob(jobConf, new BSPJobID());
    LOG.info("Job conf: "
        + bsp.getConf().get("hadoop.rpc.socket.factory.class.default") + ", "
        + bsp.getJobID().toString());

    bsp.setJarByClass(MyEstimator.class);
    bsp.setBspClass(MyEstimator.class);
    bsp.setInputFormat(NullInputFormat.class);
    bsp.setOutputKeyClass(Text.class);
    bsp.setOutputValueClass(DoubleWritable.class);
    bsp.setOutputFormat(TextOutputFormat.class);
    bsp.set("bsp.working.dir", "/tmp");
    FileOutputFormat.setOutputPath(bsp, TMP_OUTPUT);

    LOG.info("Client configuration start ..");

    HamaConfiguration clientConf = controller.getConfiguration();
    BSPJobClient jobClient = new BSPJobClient(clientConf);
    ClusterStatus cluster = jobClient.getClusterStatus(true);
    assertNotNull(cluster);
    assertTrue(cluster.getGroomServers() > 0);
    assertTrue(cluster.getMaxTasks() > 1);
    bsp.setNumBspTask(cluster.getMaxTasks());

    LOG.info("Client conf: "
        + clientConf.get("hadoop.rpc.socket.factory.class.default"));

    RunningJob rJob = jobClient.submitJob(bsp);
View Full Code Here

Examples of org.apache.hama.bsp.BSPJob

    } else {
      conf = PageRankBase
          .partitionTextFile(new Path(conf.get("in.path")), conf);
    }

    BSPJob job = new BSPJob(conf);
    job.setNumBspTask(cluster.getGroomServers());
    job.setBspClass(PageRank.class);
    job.setJarByClass(PageRank.class);
    job.setJobName("Pagerank");
    if (job.waitForCompletion(true)) {
      PageRankBase.printOutput(FileSystem.get(conf), conf);
    }
  }
View Full Code Here

Examples of org.apache.hama.bsp.BSPJob

    Map<ShortestPathVertex, List<ShortestPathVertex>> adjacencyList = null;
    if (adjacencyListPath == null)
      adjacencyList = ShortestPathsGraphLoader.loadGraph();

    BSPJob bsp = new BSPJob(conf, RandBench.class);
    // Set the job name
    bsp.setJobName("Single Source Shortest Path");
    bsp.setBspClass(ShortestPaths.class);

    // Set the task size as a number of GroomServer
    BSPJobClient jobClient = new BSPJobClient(conf);
    ClusterStatus cluster = jobClient.getClusterStatus(true);
    StringBuilder sb = new StringBuilder();
    for (String peerName : cluster.getActiveGroomNames().values()) {
      conf.set(MASTER_TASK, peerName);
      sb.append(peerName);
      sb.append(";");
    }
    LOG.info("Master is: " + conf.get(MASTER_TASK));
    conf.set(BSP_PEERS, sb.toString());
    LOG.info("Starting data partitioning...");
    if (adjacencyList == null)
      conf = partition(adjacencyListPath, conf, skipPartitioning);
    else
      conf = partition(adjacencyList, conf);
    LOG.info("Finished!");

    bsp.setNumBspTask(cluster.getGroomServers());

    long startTime = System.currentTimeMillis();
    if (bsp.waitForCompletion(true)) {
      System.out.println("Job Finished in "
          + (double) (System.currentTimeMillis() - startTime) / 1000.0
          + " seconds");
      printOutput(FileSystem.get(conf), conf);
    }
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.