Examples of Parallel


Examples of com.consol.citrus.container.Parallel

       
        assertEquals(builder.testCase().getActions().size(), 1);
        assertEquals(builder.testCase().getActions().get(0).getClass(), Parallel.class);
        assertEquals(builder.testCase().getActions().get(0).getName(), "parallel");
       
        Parallel container = (Parallel)builder.testCase().getActions().get(0);
        assertEquals(container.getActions().size(), 3);
        assertEquals(container.getTestAction(0).getClass(), EchoAction.class);
    }
View Full Code Here

Examples of com.impetus.labs.korus.addons.constructs.parallelfor.Parallel

  {
    long initialTime, finalTime;
    initialTime = System.currentTimeMillis();

    // Create an object of the construct to be used
    Parallel parallel = new Parallel();
    int number = 40000;
    // Specify begin, end and grainSize according to the machine
    int begin = 1;
    int end = number;
    int grainSize = 20000;

    BlockedRange range = new BlockedRange(begin, end, grainSize);

    // Create an object of a class extending ParallelTask Class
    ParallelFactorial af = new ParallelFactorial(parallel, range);

    // Pass the object to the parallelFor construct
    parallel.parallelFor(af);

    // Get the finalResult of execution
    Object obj = parallel.getResult();

    finalTime = System.currentTimeMillis();
    System.out.println("Total Time Taken by ParallelFactorialTest : "
        + (finalTime - initialTime));
View Full Code Here

Examples of com.impetus.labs.korus.addons.constructs.parallelfor.Parallel

    int start = 1;
    int end = 10;
    int grainSize = 5;
    BlockedRange range = new BlockedRange(start, end, grainSize);

    Parallel parallel = new Parallel();
    SummationTask task = new SummationTask(parallel, range);
    parallel.parallelFor(task);
    Object obj = parallel.getResult();
    assertTrue(obj instanceof Integer);
    assertEquals(55, ((Integer) obj).intValue());

  }
View Full Code Here

Examples of com.impetus.labs.korus.addons.constructs.parallelfor.Parallel

  {
    int start1 = 1;
    int end1 = 10;
    int grainSize1 = 5;
    BlockedRange range1 = new BlockedRange(start1, end1, grainSize1);
    Parallel parallel1 = new Parallel();

    int start2 = 1;
    int end2 = 12;
    int grainSize2 = 6;

    BlockedRange range2 = new BlockedRange(start2, end2, grainSize2);
    Parallel parallel2 = new Parallel();

    SummationTask task1 = new SummationTask(parallel1, range1);
    SummationTask task2 = new SummationTask(parallel2, range2);

    parallel1.parallelFor(task1);
    parallel2.parallelFor(task2);

    Object obj1 = parallel1.getResult();
    assertTrue(obj1 instanceof Integer);
    assertEquals(55, ((Integer) obj1).intValue());

    Object obj2 = parallel2.getResult();
    assertTrue(obj2 instanceof Integer);
    assertEquals(78, ((Integer) obj2).intValue());

  }
View Full Code Here

Examples of com.impetus.labs.korus.addons.constructs.parallelfor.Parallel

    // After data is generated actual value of
    long initalTime = System.currentTimeMillis();

    // Create an object of the construct to be used
    Parallel parallel = new Parallel();

    if (rccArray != null && rccArray.length >= 1)
    {

      // Specify begin, end and grainSize according to the machine
      int begin = 1;
      int end = rccArray.length;
      int grainSize = rccArray.length / 4;

      BlockedRange range = new BlockedRange(begin, end, grainSize);

      // Create an object of a class extending ParallelTask Class
      ParallelSpearmans ps = new ParallelSpearmans(parallel, range,
          rccArray);

      try
      {
        // Pass the object to the parallelFor construct
        parallel.parallelFor(ps);

        // Get the finalResult of execution
        Object obj = parallel.getResult();
        System.out.println("The value of Rho = "
            + ((Double) obj).doubleValue());

      } catch (Exception e)
      {
        e.printStackTrace();
      }

    }
    long finalTime = System.currentTimeMillis();
    System.out.println("Time Taken by ParallelSpearmansTest : "
        + (finalTime - initalTime));

    // ShutDown when task done.
    parallel.cleanup();

  }
View Full Code Here

Examples of com.impetus.labs.korus.addons.constructs.parallelfor.Parallel

  {

    long startTime = System.currentTimeMillis();

    // Create an object of the construct to be used
    Parallel parallel = new Parallel();

    // specify begin, end and grainSize according to the machine
    int begin = 1;
    // number of steps the curve should be divided. Bigger the number, more
    // accurate will be the value of the area under curve.
    // Therefore, blockedRangeEnd = num_steps(in SerialTrapezoid) =
    // 100000000;
    int end = 1000000000;

    // grainSize equal to blockedRangeEnd/2 to enable two threads
    int grainSize = end/4;

    BlockedRange range = new BlockedRange(begin, end, grainSize);

    // Create an object of a class extending ParallelTask Class
    ParallelTrapazoid pt = new ParallelTrapazoid(parallel, range);
    try
    {
      // Pass the object to the parallelFor construct
      parallel.parallelFor(pt);

      // Get the finalResult of execution
      Object object = parallel.getResult();

      System.out.println("AreaUnderCurve: "
          + ((Double) object).doubleValue());
    }

    catch (Exception e)
    {
      e.printStackTrace();
    }

    long endTime = System.currentTimeMillis();
    System.out.println("Total Time Taken :" + (endTime - startTime));

    // ShutDown when task done.
    parallel.cleanup();

  }
View Full Code Here

Examples of com.intel.hadoop.graphbuilder.util.Parallel

      list.add(new MutableInt(rnd.nextInt()));

    ArrayList<MutableInt> copylist = new ArrayList<MutableInt>();
    for (int i = 0; i < maxiter; ++i)
      copylist.add(new MutableInt(list.get(i).val));
    Parallel parfor = new Parallel();
    parfor.For(list, new Operation<MutableInt>() {
      @Override
      public void perform(MutableInt pParameter, int idx) {
        pParameter.val += idx;
      }

    });
    parfor.close();

    for (int i = 0; i < maxiter; ++i) {
      int j = list.get(i).val;
      int k = copylist.get(i).val + i;
      assertEquals(j, k);
View Full Code Here

Examples of org.apache.commons.scxml.model.Parallel

        serializeOnEntry(b, s, indent + INDENT);
        List t = s.getTransitionsList();
        for (int i = 0; i < t.size(); i++) {
            serializeTransition(b, (Transition) t.get(i), indent + INDENT);
        }
        Parallel p = s.getParallel(); //TODO: Remove in v1.0
        Invoke inv = s.getInvoke();
        if (p != null) {
            serializeParallel(b, p, indent + INDENT);
        } else if (inv != null) {
            serializeInvoke(b , inv, indent + INDENT);
View Full Code Here

Examples of org.apache.commons.scxml.model.Parallel

        List t = s.getTransitionsList();
        for (int i = 0; i < t.size(); i++) {
            Transition trn = (Transition) t.get(i);
            updateTransition(trn, targets);
        }
        Parallel p = s.getParallel(); //TODO: Remove in v1.0
        Invoke inv = s.getInvoke();
        if ((inv != null && p != null)
                || (inv != null && !c.isEmpty())
                || (p != null && !c.isEmpty())) {
            logAndThrowModelError(ERR_STATE_BAD_CONTENTS,
View Full Code Here

Examples of org.apache.commons.scxml.model.Parallel

        TransitionTarget lca = SCXMLHelper.getLCA((TransitionTarget)
            tts.get(0), (TransitionTarget) tts.get(1));
        if (lca == null || !(lca instanceof Parallel)) {
            return false; // Must have a Parallel LCA
        }
        Parallel p = (Parallel) lca;
        Set regions = new HashSet();
        for (int i = 0; i < tts.size(); i++) {
            TransitionTarget tt = (TransitionTarget) tts.get(i);
            while (tt.getParent() != p) {
                tt = tt.getParent();
            }
            if (!regions.add(tt)) {
                return false; // One per region
            }
        }
        if (regions.size() != p.getChildren().size()) {
            return false; // Must represent all regions
        }
        return true;
    }
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.