You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

 The Habanero Java (HJ) language under development at Rice University builds on past work on X10 v1.5.  HJ is intended for use in teaching Computer Science at the undergraduate level (COMP 322), as well as to serve as a research testbed for new language, compiler, and runtime software technologies for extreme scale systems.  HJ proposes an execution model for multicore processors based on four orthogonal dimensions for portable parallelism:

  1. Lightweight dynamic task creation and termination using async, finish, future, forall, foreach, ateach constructs.
  2. Collective and point-to-point synchronization using phasers
  3. Mutual exclusion and isolation using isolated
  4. Locality control using hierarchical place trees

Since HJ is based on Java, the use of certain non-blocking primitives from the Java Concurrency Utilities is also permitted in HJ programs, most notably operations on Java Concurrent Collections such as java.util.concurrent.ConcurrentHashMap and on Java Atomic Variables.

A short summary of the HJ language is included below, and the following paper provides an overview of the language:

 Habanero-Java: the New Adventures of Old X10.  9th International Conference on the Principles and Practice of Programming in Java (PPPJ), August, 2011.

More details can be found in the papers in the Habanero publications web page.  A download of a research prototype of our HJ implementation can be found here.

HJ Language Summary

async [at (place)] 

           [phased [(ph1<mode1>, ...)] ] 

           [seq (condition)]                              

           [when (condition)] Stmt 

  • Asynchronously start a new child task to execute Stmt
  • A destination place can optionally be specified for where the task should execute
  • Task may optionally be phased on a specified subset, (ph1<mode1>, ...), of its parent’s phasers or on the entire set (default)
  • Task may optionally be delayed to not start until the side-effect-free when condition evaluates to true

finish Stmt

  • Execute Stmt, but wait until all (transitively) spawned asyncs and futures in Stmt’s scope have terminated
  • Propagate multiset of all exceptions thrown by spawned asyncs in Stmt’s scope

final future<T> f = async<T> [(place)] 

                      [phased [(ph1<mode1>, ...)] ]                                               

                      [when (condition)] Expr ;

  • Asynchronously start a new child task to evaluate Expr with place/phased/when options as inasync
  • f is a reference to object of type future<T> , which is a container for the value to be computed by the future  task
  • Expr is a statement sequence ending with return

f.get()

  • Wait until future f has completed execution, and propagate its return value  of type T
  • if T = void, then f.get() is evaluated as a statement (like a method call with a void return value)
  • get() also propagates any exception thrown by Expr

point

  • A point is an n-dimensional int tuple 
  • A point variable can hold values of different ranks e.g., point p; p = [1]; … p = [2,3]; …

for (point [i1, …] : [lo1:hi1, …]) Stmt

  • Execute multiple instances of Stmt sequentially in lexicographic order, one per iteration in rectangular region [lo1:hi1, …]

forall (point [i1, …] : [lo1:hi1, …]) Stmt

  • Create multiple parallel instances of Stmt as child tasks, one per forall iteration in rectangular region [lo1:hi1, …]
  • Implicit finish at end of forall
  • Each forall has a pre-allocated phaser

foreach (point [i1, …] : [lo1:hi1, …]) [phased [(ph1<mode1>, ...)] ] Stmt

  • Like forall, create multiple instances of Stmt as child tasks, one per foreach iteration in rectangular region [lo1:hi1, …]
    • No implicit finish in foreach
    • As with async, a foreach iteration may optionally be phased on a specified subset, ph1<mode1>, ...), of its parent’s phasers or on the entire set

isolated Stmt

  • Execute Stmt in isolation (mutual exclusion) relative to all other instances of isolated statements
  • Stmt must not contain any parallel constructs
  • Weak atomicity: no guarantee on interactions with non-isolated statements 

new phaser(mode1)

  • Allocate a phaser with the specified mode, which can be one of SIG, WAIT, SIG_WAIT, SINGLE
  • Scope of phaser is limited to immediately enclosing finish

next ;

  • Advance each phaser that this task is registered on to its next phase, in accordance with this task’s registration mode
  • Wait on each phaser that task is registered on with a wait capability (WAIT, SIG_WAIT, SINGLE)

next single Stmt

  • Execute a single instance of Stmt during the phase transition performed by next
  • All tasks executing the next single statement must be registered with all its phasers in SINGLE mode

signal 

  • signal each phaser that task is registered on with a signal capability (SIG, SIG_WAIT, SIGNAL)
  • signal is a non-blocking operation --- computation between signal and next serves as a “split phase barrier”

complex32, complex64

  • HJ includes complex as a primitive type e.g.,  

complex32 cf  = (1.0f, 2.0f); complex64 cd = (1.0, 2.0);

  • The following operations are supported on complex:

+,-,*,/, ==, !=, toString(), exp(), sin(), cos(), sqrt(), pow()

array views

T[.] declares a view on a 1-D Java array e.g.,

        double[.] view = new arrayView(baseArray, offset, [lo1:hi1, …])

   where

        baseArray = base 1-D Java array

        offset = starting offset in baseArray for view

        [lo1:hi1, …] = rectangular region for view

abstract performance metrics

  • Programmer inserts calls of the form, perf.addLocalOps(N), in sequential code
  • HJ implementation computes total work and critical path length in units of programmer’s local ops
  • No labels