galois.runtime
Class GaloisRuntime

java.lang.Object
  extended by galois.runtime.GaloisRuntime

public final class GaloisRuntime
extends Object

Provides methods to access Galois runtime from application code.


Method Summary
static
<T> void
foreach(Iterable<T> initial, Lambda2Void<T,ForeachContext<T>> body, Priority.Rule priority)
          Creates an unordered Galois iterator that concurrently applies a function over all elements in some initial collection.
static
<T,A1> void
foreach(Mappable<T> initial, Lambda2Void<T,A1> body, A1 arg1)
          Creates an unordered Galois iterator that concurrently applies a function over all elements in some initial collection.
static
<T> void
foreach(Mappable<T> initial, Lambda2Void<T,ForeachContext<T>> body, Priority.Rule priority)
          Creates an unordered Galois iterator that concurrently applies a function over all elements in some initial collection.
static
<T,A1,A2> void
foreach(Mappable<T> initial, Lambda3Void<T,A1,A2> body, A1 arg1, A2 arg2)
          Creates an unordered Galois iterator that concurrently applies a function over all elements in some initial collection.
static
<T> void
foreach(Mappable<T> initial, LambdaVoid<T> body)
          Creates an unordered Galois iterator that concurrently applies a function over all elements in some initial collection.
static
<T> void
foreachOrdered(Iterable<T> initial, Lambda2Void<T,ForeachContext<T>> body, Priority.Rule priority)
          Creates an ordered Galois iterator that concurrently applies a function over all elements in some initial collection.
static
<T> void
foreachOrdered(Mappable<T> initial, Lambda2Void<T,ForeachContext<T>> body, Priority.Rule priority)
          Creates an ordered Galois iterator that concurrently applies a function over all elements in some initial collection.
 int getMaxIterations()
           
 int getMaxThreads()
          Gets the maximum number of threads that can be used by the Runtime.
static GaloisRuntime getRuntime()
          Returns the current instance of the runtime.
 boolean ignoreUserFlags()
           
 boolean inRoot()
           
static void main(String[] args)
           
 boolean moreStats()
           
static boolean needMethodFlag(byte flags, byte option)
           
 void onCommit(Iteration it, Callback action)
           
 void onRelease(Iteration it, ReleaseCallback action)
           
 void onUndo(Iteration it, Callback action)
           
 void raiseConflict(Iteration it, Iteration conflicter)
          Signals that conflict has been detected by the user/library code.
 boolean useParameter()
           
 boolean useSerial()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRuntime

public static GaloisRuntime getRuntime()
Returns the current instance of the runtime.

Returns:
a reference to the current runtime

foreach

public static <T> void foreach(Iterable<T> initial,
                               Lambda2Void<T,ForeachContext<T>> body,
                               Priority.Rule priority)
                    throws ExecutionException
Creates an unordered Galois iterator that concurrently applies a function over all elements in some initial collection. Additional elements may be added during iteration.

Type Parameters:
T - type of elements to iterate over
Parameters:
initial - initial elements to iterate over
body - function to apply
priority - specification of the order elements are processed
Throws:
ExecutionException - if there is an uncaught exception during execution
See Also:
foreach(Mappable, LambdaVoid), foreach(Mappable, Lambda2Void, galois.runtime.wl.Priority.Rule)

foreach

public static <T> void foreach(Mappable<T> initial,
                               Lambda2Void<T,ForeachContext<T>> body,
                               Priority.Rule priority)
                    throws ExecutionException
Creates an unordered Galois iterator that concurrently applies a function over all elements in some initial collection. Additional elements may be added during iteration.

Type Parameters:
T - type of elements to iterate over
Parameters:
initial - initial elements to iterate over
body - function to apply
priority - specification of the order elements are processed
Throws:
ExecutionException - if there is an uncaught exception during execution
See Also:
foreach(Mappable, LambdaVoid), foreach(Iterable, Lambda2Void, galois.runtime.wl.Priority.Rule)

foreachOrdered

public static <T> void foreachOrdered(Iterable<T> initial,
                                      Lambda2Void<T,ForeachContext<T>> body,
                                      Priority.Rule priority)
                           throws ExecutionException
Creates an ordered Galois iterator that concurrently applies a function over all elements in some initial collection. Additional elements may be added during iteration. Elements are processed strictly according to some order.

Type Parameters:
T - type of elements to iterate over
Parameters:
initial - initial elements to iterate over
body - function to apply
priority - specification of the order elements are processed
Throws:
ExecutionException - if there is an uncaught exception during execution
See Also:
foreachOrdered(Mappable, Lambda2Void, galois.runtime.wl.Priority.Rule)

foreachOrdered

public static <T> void foreachOrdered(Mappable<T> initial,
                                      Lambda2Void<T,ForeachContext<T>> body,
                                      Priority.Rule priority)
                           throws ExecutionException
Creates an ordered Galois iterator that concurrently applies a function over all elements in some initial collection. Additional elements may be added during iteration. Elements are processed strictly according to some order.

Type Parameters:
T - type of elements to iterate over
Parameters:
initial - initial elements to iterate over
body - function to apply
priority - specification of the order elements are processed
Throws:
ExecutionException - if there is an uncaught exception during execution
See Also:
foreachOrdered(Iterable, Lambda2Void, galois.runtime.wl.Priority.Rule)

foreach

public static <T> void foreach(Mappable<T> initial,
                               LambdaVoid<T> body)
                    throws ExecutionException
Creates an unordered Galois iterator that concurrently applies a function over all elements in some initial collection. In contrast to foreach(Mappable, Lambda2Void, galois.runtime.wl.Priority.Rule), no additional elements may be added during iteration and the particular order elements are processed in is dictated by the particular Mappable instance.

Type Parameters:
T - type of elements to iterate over
Parameters:
initial - initial elements to iterate over
body - function to apply
Throws:
ExecutionException - if there is an uncaught exception during execution
See Also:
foreach(Mappable, Lambda2Void, Object), foreach(Mappable, Lambda3Void, Object, Object)

foreach

public static <T,A1> void foreach(Mappable<T> initial,
                                  Lambda2Void<T,A1> body,
                                  A1 arg1)
                    throws ExecutionException
Creates an unordered Galois iterator that concurrently applies a function over all elements in some initial collection. In contrast to foreach(Mappable, Lambda2Void,galois.runtime.wl.Priority.Rule), no additional elements may be added during iteration and the particular order elements are processed in is dictated by the particular Mappable instance.

Type Parameters:
T - type of elements to iterate over
Parameters:
initial - initial elements to iterate over
body - function to apply
arg1 - additional argument to function
Throws:
ExecutionException - if there is an uncaught exception during execution
See Also:
foreach(Mappable, LambdaVoid), foreach(Mappable, Lambda3Void, Object, Object)

foreach

public static <T,A1,A2> void foreach(Mappable<T> initial,
                                     Lambda3Void<T,A1,A2> body,
                                     A1 arg1,
                                     A2 arg2)
                    throws ExecutionException
Creates an unordered Galois iterator that concurrently applies a function over all elements in some initial collection. In contrast to foreach(Mappable, Lambda2Void, galois.runtime.wl.Priority.Rule), no additional elements may be added during iteration and the particular order elements are processed in is dictated by the particular Mappable instance.

Type Parameters:
T - type of elements to iterate over
Parameters:
initial - initial elements to iterate over
body - function to apply
arg1 - additional argument to function
arg2 - additional argument to function
Throws:
ExecutionException - if there is an uncaught exception during execution
See Also:
foreach(Mappable, LambdaVoid), foreach(Mappable, Lambda2Void, Object)

onCommit

public void onCommit(Iteration it,
                     Callback action)

onUndo

public void onUndo(Iteration it,
                   Callback action)

onRelease

public void onRelease(Iteration it,
                      ReleaseCallback action)

needMethodFlag

public static boolean needMethodFlag(byte flags,
                                     byte option)

getMaxThreads

public int getMaxThreads()
Gets the maximum number of threads that can be used by the Runtime.

Returns:
maximum number of threads available

getMaxIterations

public int getMaxIterations()

raiseConflict

public void raiseConflict(Iteration it,
                          Iteration conflicter)
Signals that conflict has been detected by the user/library code.

Parameters:
it - the current iteration
conflicter - the iteration that is in conflict with the current iteration

useParameter

public boolean useParameter()

useSerial

public boolean useSerial()

ignoreUserFlags

public boolean ignoreUserFlags()

inRoot

public boolean inRoot()

moreStats

public boolean moreStats()

main

public static void main(String[] args)
                 throws Exception
Parameters:
args -
Throws:
Exception