public abstract class GPUObject extends Object
Modifier and Type | Class and Description |
---|---|
static class |
GPUObject.EvictionPolicy |
Modifier and Type | Field and Description |
---|---|
static GPUObject.EvictionPolicy |
evictionPolicy |
protected boolean |
isDeviceCopyModified |
protected boolean |
isInSparseFormat |
protected org.apache.sysml.runtime.controlprogram.caching.MatrixObject |
mat |
protected AtomicInteger |
numLocks |
Modifier | Constructor and Description |
---|---|
protected |
GPUObject(org.apache.sysml.runtime.controlprogram.caching.MatrixObject mat2) |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
acquireDeviceModifyDense()
To signal intent that a matrix block will be written to on the GPU
|
abstract boolean |
acquireDeviceModifySparse()
To signal intent that a sparse matrix block will be written to on the GPU
|
abstract boolean |
acquireDeviceRead()
Signal intent that a matrix block will be read (as input) on the GPU
|
abstract boolean |
acquireHostRead()
Signal intent that a block needs to be read on the host
|
void |
clearData()
lazily clears the data associated with this
GPUObject instance |
void |
clearData(boolean eager)
Clears the data associated with this
GPUObject instance |
protected static void |
evict(long GPUSize)
Convenience wrapper over
evict(String, long) |
protected static void |
evict(String instructionName,
long GPUSize)
Cycles through the sorted list of allocated
GPUObject instances. |
protected static long |
getAvailableMemory() |
abstract boolean |
isAllocated() |
boolean |
isInSparseFormat() |
abstract void |
releaseInput() |
abstract void |
releaseOutput() |
abstract void |
setDeviceModify(long numBytes)
If memory on GPU has been allocated from elsewhere, this method
updates the internal bookkeeping
|
public static final GPUObject.EvictionPolicy evictionPolicy
protected boolean isDeviceCopyModified
protected AtomicInteger numLocks
protected boolean isInSparseFormat
protected org.apache.sysml.runtime.controlprogram.caching.MatrixObject mat
protected GPUObject(org.apache.sysml.runtime.controlprogram.caching.MatrixObject mat2)
public boolean isInSparseFormat()
public abstract boolean isAllocated()
public abstract boolean acquireDeviceRead() throws DMLRuntimeException
DMLRuntimeException
- ?public abstract boolean acquireDeviceModifyDense() throws DMLRuntimeException
DMLRuntimeException
- if DMLRuntimeException occurspublic abstract boolean acquireDeviceModifySparse() throws DMLRuntimeException
DMLRuntimeException
- if DMLRuntimeException occurspublic abstract void setDeviceModify(long numBytes)
numBytes
- number of bytespublic abstract boolean acquireHostRead() throws org.apache.sysml.runtime.controlprogram.caching.CacheException
org.apache.sysml.runtime.controlprogram.caching.CacheException
- ?public abstract void releaseInput() throws org.apache.sysml.runtime.controlprogram.caching.CacheException
org.apache.sysml.runtime.controlprogram.caching.CacheException
public abstract void releaseOutput() throws org.apache.sysml.runtime.controlprogram.caching.CacheException
org.apache.sysml.runtime.controlprogram.caching.CacheException
protected static void evict(long GPUSize) throws DMLRuntimeException
evict(String, long)
GPUSize
- Desired size to be freed up on the GPUDMLRuntimeException
- If no blocks to free up or if not enough blocks with zero locks on them.protected static void evict(String instructionName, long GPUSize) throws DMLRuntimeException
GPUObject
instances. Sorting is based on
number of (read) locks that have been obtained on it (reverse order). It repeatedly frees up
blocks on which there are zero locks until the required size has been freed up.
// TODO: update it with hybrid policyinstructionName
- name of the instruction for which performance measurements are madeGPUSize
- Desired size to be freed up on the GPUDMLRuntimeException
- If no blocks to free up or if not enough blocks with zero locks on them.public void clearData() throws org.apache.sysml.runtime.controlprogram.caching.CacheException
GPUObject
instanceorg.apache.sysml.runtime.controlprogram.caching.CacheException
- ?public void clearData(boolean eager) throws org.apache.sysml.runtime.controlprogram.caching.CacheException
GPUObject
instanceeager
- whether to be done synchronously or asynchronouslyorg.apache.sysml.runtime.controlprogram.caching.CacheException
- ?protected static long getAvailableMemory()
Copyright © 2017 The Apache Software Foundation. All rights reserved.