public void JGFrun(int size) throws MPIException {

    if (rank == 0) {
      JGFInstrumentor.addTimer("Section3:MonteCarlo:Total", "Solutions", size);
      JGFInstrumentor.addTimer("Section3:MonteCarlo:Run", "Samples", size);
    }

    JGFsetsize(size);

    MPI.COMM_WORLD.Barrier();
    if (rank == 0) {
      JGFInstrumentor.startTimer("Section3:MonteCarlo:Total");
    }

    JGFinitialise();
    JGFapplication();

    if (rank == 0) {
      JGFvalidate();
    }
    JGFtidyup();

    MPI.COMM_WORLD.Barrier();
    if (rank == 0) {
      JGFInstrumentor.stopTimer("Section3:MonteCarlo:Total");

      JGFInstrumentor.addOpsToTimer("Section3:MonteCarlo:Run", (double) input[1]);
      JGFInstrumentor.addOpsToTimer("Section3:MonteCarlo:Total", 1);

      JGFInstrumentor.printTimer("Section3:MonteCarlo:Run");
      JGFInstrumentor.printTimer("Section3:MonteCarlo:Total");
    }
  }
  public void JGFapplication() throws MPIException {

    MPI.COMM_WORLD.Barrier();
    if (rank == 0) {
      JGFInstrumentor.startTimer("Section3:MonteCarlo:Run");
    }

    runiters();

    MPI.COMM_WORLD.Barrier();
    if (rank == 0) {
      JGFInstrumentor.stopTimer("Section3:MonteCarlo:Run");
    }

    if (rank == 0) {
      presults();
    }
  }
示例#3
0
  public scanO(String[] args) throws Exception {

    final int MAXLEN = 10000;

    int i, j, k;
    complexNum out[] = new complexNum[MAXLEN];
    complexNum in[] = new complexNum[MAXLEN];
    int myself, tasks;
    boolean bool = false;

    MPI.Init(args);
    myself = MPI.COMM_WORLD.Rank();
    tasks = MPI.COMM_WORLD.Size();

    for (i = 0; i < MAXLEN; i++) {
      in[i] = new complexNum();
      out[i] = new complexNum();
      out[i].realPart = i;
      out[i].imaginPart = i;
    }

    complexAdd cadd = new complexAdd();
    Op op = new Op(cadd, bool);
    MPI.COMM_WORLD.Scan(out, 0, in, 0, MAXLEN, MPI.OBJECT, op);

    for (k = 0; k < MAXLEN; k++) {
      if (in[k].realPart != k * (myself + 1)) {
        System.out.println(
            "bad answer ("
                + (in[k].realPart)
                + ") at index "
                + k
                + "(should be "
                + (k * (myself + 1))
                + ")");
        break;
      }
    }

    MPI.COMM_WORLD.Barrier();
    if (myself == 0) System.out.println("ScanO TEST COMPLETE");
    MPI.Finalize();
  }