|
org.codehaus.gpars | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jsr166y.ForkJoinTask groovyx.gpars.extra166y.PAS.FJScan
static abstract class PAS.FJScan extends ForkJoinTask
Cumulative scan A basic version of scan is straightforward. Keep dividing by two to threshold segment size, and then: Pass 1: Create tree of partial sums for each segment Pass 2: For each segment, cumulate with offset of left sibling See G. Blelloch's http://www.cs.cmu.edu/~scandal/alg/scan.html This version improves performance within FJ framework mainly by allowing second pass of ready left-hand sides to proceed even if some right-hand side first passes are still executing. It also combines first and second pass for leftmost segment, and for cumulate (not precumulate) also skips first pass for rightmost segment (whose result is not needed for second pass). To manage this, it relies on "phase" phase/state control field maintaining bits CUMULATE, SUMMED, and FINISHED. CUMULATE is main phase bit. When false, segments compute only their sum. When true, they cumulate array elements. CUMULATE is set at root at beginning of second pass and then propagated down. But it may also be set earlier for subtrees with lo==origin (the left spine of tree). SUMMED is a one bit join count. For leafs, set when summed. For internal nodes, becomes true when one child is summed. When second child finishes summing, it then moves up tree to trigger cumulate phase. FINISHED is also a one bit join count. For leafs, it is set when cumulated. For internal nodes, it becomes true when one child is cumulated. When second child finishes cumulating, it then moves up tree, executing complete() at the root. This class maintains only the basic control logic. Subclasses maintain the "in" and "out" fields, and *Ops classes perform computations.
Field Summary | |
---|---|
static short |
CUMULATE
|
static short |
FINISHED
|
static short |
SUMMED
|
int |
hi
|
FJScan |
left
|
int |
lo
|
FJScanOp |
op
|
FJScan |
parent
|
int |
phase
|
static java.util.concurrent.atomic.AtomicIntegerFieldUpdater |
phaseUpdater
|
FJScan |
right
|
Constructor Summary | |
PAS.FJScan(FJScan parent, FJScanOp op, int lo, int hi)
|
Method Summary | |
---|---|
double
|
dgetIn()
|
double
|
dgetOut()
|
void
|
dsetIn(double x)
|
void
|
dsetOut(double x)
|
boolean
|
exec()
|
java.lang.Void
|
getRawResult()
|
long
|
lgetIn()
|
long
|
lgetOut()
|
void
|
lsetIn(long x)
|
void
|
lsetOut(long x)
|
java.lang.Object
|
ogetIn()
|
java.lang.Object
|
ogetOut()
|
void
|
rsetIn(java.lang.Object x)
|
void
|
rsetOut(java.lang.Object x)
|
protected void
|
setRawResult(java.lang.Void mustBeNull)
|
boolean
|
transitionToCumulate()
|
Field Detail |
---|
static final short CUMULATE
static final short FINISHED
static final short SUMMED
final int hi
FJScan left
final int lo
final FJScanOp op
final FJScan parent
int phase
static final java.util.concurrent.atomic.AtomicIntegerFieldUpdater phaseUpdater
FJScan right
Constructor Detail |
---|
PAS.FJScan(FJScan parent, FJScanOp op, int lo, int hi)
Method Detail |
---|
double dgetIn()
double dgetOut()
void dsetIn(double x)
void dsetOut(double x)
public final boolean exec()
public final java.lang.Void getRawResult()
long lgetIn()
long lgetOut()
void lsetIn(long x)
void lsetOut(long x)
java.lang.Object ogetIn()
java.lang.Object ogetOut()
void rsetIn(java.lang.Object x)
void rsetOut(java.lang.Object x)
protected final void setRawResult(java.lang.Void mustBeNull)
final boolean transitionToCumulate()
Copyright © 2008–2013 Václav Pech. All Rights Reserved.