public class AsynchronousFlowController extends Object implements FlowController
Modifier and Type | Field and Description |
---|---|
protected AtomicLong |
asyncHit |
protected AtomicLong |
asyncMiss |
protected ArrayList<AtomicLong> |
deviceClocks |
protected static AtomicLong |
eventCounts |
protected ArrayList<ArrayList<Queue<cudaEvent_t>>> |
eventsBarrier |
protected ArrayList<ArrayList<AtomicLong>> |
laneClocks |
protected Map<Integer,AtomicLong> |
lanesCounter |
protected static int |
MAX_EXECUTION_QUEUE |
protected NativeOps |
nativeOps |
Constructor and Description |
---|
AsynchronousFlowController() |
Modifier and Type | Method and Description |
---|---|
void |
commitTransfer(cudaStream_t streamUsed)
This method should be called after memcpy operations, to control their flow.
|
protected void |
cutTail() |
protected void |
fillTail(int deviceId,
int lane,
cudaEvent_t event) |
protected Queue<cudaEvent_t> |
getReadLanes(INDArray array) |
protected cudaEvent_t |
getWriteLane(INDArray array) |
protected boolean |
hasActiveReads(AllocationPoint point) |
protected boolean |
hasActiveReads(INDArray array) |
protected int |
hasActiveWrite(AllocationPoint point) |
protected int |
hasActiveWrite(INDArray array) |
void |
init(Allocator allocator) |
protected boolean |
isMatchingLanes(int[] lanes) |
protected boolean |
isMatchingLanes(int zLane,
int[] lanes) |
protected int |
pickFirstLane(int[] lanes) |
CudaContext |
prepareAction(AllocationPoint result,
AllocationPoint... operands) |
CudaContext |
prepareAction(INDArray result,
INDArray... operands)
This method is called before operation was executed
|
void |
registerAction(CudaContext context,
AllocationPoint result,
AllocationPoint... operands) |
void |
registerAction(CudaContext context,
INDArray result,
INDArray... operands)
This method is called after operation was executed
|
protected void |
setReadLane(INDArray array,
cudaEvent_t event) |
protected void |
setWriteLane(INDArray array,
cudaEvent_t event) |
protected void |
sweepTail()
This method ensures the events in the beginning of FIFO queues are finished
|
protected void |
synchronizeReadLanes(AllocationPoint point) |
protected void |
synchronizeReadLanes(INDArray array) |
void |
synchronizeToHost(AllocationPoint point)
This method ensures, that all asynchronous operations on referenced AllocationPoint are finished, and host memory state is up-to-date
|
void |
waitTillFinished(AllocationPoint point)
This method ensures, that all asynchronous operations on referenced AllocationPoint are finished
|
void |
waitTillReleased(AllocationPoint point) |
protected NativeOps nativeOps
protected AtomicLong asyncHit
protected AtomicLong asyncMiss
protected Map<Integer,AtomicLong> lanesCounter
protected static final int MAX_EXECUTION_QUEUE
protected static final AtomicLong eventCounts
protected ArrayList<ArrayList<Queue<cudaEvent_t>>> eventsBarrier
protected ArrayList<ArrayList<AtomicLong>> laneClocks
protected ArrayList<AtomicLong> deviceClocks
public void init(Allocator allocator)
init
in interface FlowController
public void synchronizeToHost(AllocationPoint point)
FlowController
synchronizeToHost
in interface FlowController
public void waitTillFinished(AllocationPoint point)
FlowController
waitTillFinished
in interface FlowController
public void waitTillReleased(AllocationPoint point)
waitTillReleased
in interface FlowController
public void registerAction(CudaContext context, INDArray result, INDArray... operands)
FlowController
registerAction
in interface FlowController
protected void setWriteLane(INDArray array, cudaEvent_t event)
protected void setReadLane(INDArray array, cudaEvent_t event)
protected Queue<cudaEvent_t> getReadLanes(INDArray array)
protected cudaEvent_t getWriteLane(INDArray array)
protected int hasActiveWrite(INDArray array)
protected int hasActiveWrite(AllocationPoint point)
protected boolean hasActiveReads(AllocationPoint point)
protected boolean hasActiveReads(INDArray array)
protected boolean isMatchingLanes(int[] lanes)
protected boolean isMatchingLanes(int zLane, int[] lanes)
protected void synchronizeReadLanes(AllocationPoint point)
protected void synchronizeReadLanes(INDArray array)
public void registerAction(CudaContext context, AllocationPoint result, AllocationPoint... operands)
registerAction
in interface FlowController
public CudaContext prepareAction(AllocationPoint result, AllocationPoint... operands)
prepareAction
in interface FlowController
protected int pickFirstLane(int[] lanes)
public CudaContext prepareAction(INDArray result, INDArray... operands)
FlowController
prepareAction
in interface FlowController
protected void fillTail(int deviceId, int lane, cudaEvent_t event)
protected void sweepTail()
protected void cutTail()
public void commitTransfer(cudaStream_t streamUsed)
FlowController
commitTransfer
in interface FlowController
Copyright © 2016. All Rights Reserved.