Difference between revisions of "Habanero"

From CSE231 Wiki
Jump to navigation Jump to search
Line 29: Line 29:
 
[http://www.cse.wustl.edu/~cosgroved/courses/cse231/s17/javadocs/edu/wustl/cse231s/rice/classic/HabaneroClassic.html#newReducerFinishAccumulator-edu.wustl.cse231s.rice.classic.contrib.api.Reducer- newReducerFinishAccumulator]([http://www.cse.wustl.edu/~cosgroved/courses/cse231/s17/javadocs/edu/wustl/cse231s/rice/classic/contrib/api/Reducer.html Reducer<T>] reducer)
 
[http://www.cse.wustl.edu/~cosgroved/courses/cse231/s17/javadocs/edu/wustl/cse231s/rice/classic/HabaneroClassic.html#newReducerFinishAccumulator-edu.wustl.cse231s.rice.classic.contrib.api.Reducer- newReducerFinishAccumulator]([http://www.cse.wustl.edu/~cosgroved/courses/cse231/s17/javadocs/edu/wustl/cse231s/rice/classic/contrib/api/Reducer.html Reducer<T>] reducer)
  
===Registration===
+
===Finish Accumulator Registration===
 
[http://www.cse.wustl.edu/~cosgroved/courses/cse231/s17/javadocs/edu/wustl/cse231s/rice/classic/HabaneroClassic.html#finish-edu.wustl.cse231s.rice.classic.options.RegisterAccumulatorsOption-edu.rice.hj.api.HjSuspendable- finish]([http://www.cse.wustl.edu/~cosgroved/courses/cse231/s17/javadocs/edu/wustl/cse231s/rice/classic/HabaneroClassic.html#register-edu.wustl.cse231s.rice.classic.contrib.api.FinishAccumulator-edu.wustl.cse231s.rice.classic.contrib.api.FinishAccumulator...- register(accumulators)], body)
 
[http://www.cse.wustl.edu/~cosgroved/courses/cse231/s17/javadocs/edu/wustl/cse231s/rice/classic/HabaneroClassic.html#finish-edu.wustl.cse231s.rice.classic.options.RegisterAccumulatorsOption-edu.rice.hj.api.HjSuspendable- finish]([http://www.cse.wustl.edu/~cosgroved/courses/cse231/s17/javadocs/edu/wustl/cse231s/rice/classic/HabaneroClassic.html#register-edu.wustl.cse231s.rice.classic.contrib.api.FinishAccumulator-edu.wustl.cse231s.rice.classic.contrib.api.FinishAccumulator...- register(accumulators)], body)

Revision as of 06:04, 3 March 2017

Async, Finish

Async and finish make up the fundamental building blocks of task-level parallelism in Habanero.

These concepts are first covered in RiceX Topic 1.1.

async(body) creates a new child task that can run before, after, or in parallel with all remaining statements of the parent task.

finish(body) executes body and waits for all child tasks to complete.

Future

A future is a tasks that return a value.

Futures are covered in RiceX Topic 2.1.

future(body) returns an instance of HjFuture. Invoking the get() method on that instance waits for the task to complete.

FinishAccumulator

Finish Accumulators provide a convenient way to keep track of a count (for example: the number of solutions in the n-queens problem) or perform a reduction as in the MapReduce_Assignment.

FinishAccumulators are covered in RiceX Topic 2.3.

FinishAccumulator Creation

There are several ways to create the different forms of accumulators, but the two that come up in CSE231s are:

newIntegerFinishAccumulator( NumberReductionOperator.SUM )

and

newReducerFinishAccumulator(Reducer<T> reducer)

Finish Accumulator Registration

finish(register(accumulators), body)