org.apache.sysml.runtime.instructions.gpu.context

Class GPUObject

  • Direct Known Subclasses:
    JCudaObject


    public abstract class GPUObject
    extends Object
    • Field Detail

      • isDeviceCopyModified

        protected boolean isDeviceCopyModified
      • isInSparseFormat

        protected boolean isInSparseFormat
      • mat

        protected org.apache.sysml.runtime.controlprogram.caching.MatrixObject mat
    • Constructor Detail

      • GPUObject

        protected GPUObject(org.apache.sysml.runtime.controlprogram.caching.MatrixObject mat2)
    • Method Detail

      • isInSparseFormat

        public boolean isInSparseFormat()
      • isAllocated

        public abstract boolean isAllocated()
      • acquireDeviceRead

        public abstract boolean acquireDeviceRead()
                                           throws DMLRuntimeException
        Signal intent that a matrix block will be read (as input) on the GPU
        Returns:
        true if a host memory to device memory transfer happened
        Throws:
        DMLRuntimeException - ?
      • acquireDeviceModifyDense

        public abstract boolean acquireDeviceModifyDense()
                                                  throws DMLRuntimeException
        To signal intent that a matrix block will be written to on the GPU
        Returns:
        true if memory was allocated on the GPU as a result of this call
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • acquireDeviceModifySparse

        public abstract boolean acquireDeviceModifySparse()
                                                   throws DMLRuntimeException
        To signal intent that a sparse matrix block will be written to on the GPU
        Returns:
        true if memory was allocated on the GPU as a result of this call
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • setDeviceModify

        public abstract void setDeviceModify(long numBytes)
        If memory on GPU has been allocated from elsewhere, this method updates the internal bookkeeping
        Parameters:
        numBytes - number of bytes
      • acquireHostRead

        public abstract boolean acquireHostRead()
                                         throws org.apache.sysml.runtime.controlprogram.caching.CacheException
        Signal intent that a block needs to be read on the host
        Returns:
        true if copied from device to host
        Throws:
        org.apache.sysml.runtime.controlprogram.caching.CacheException - ?
      • releaseInput

        public abstract void releaseInput()
                                   throws org.apache.sysml.runtime.controlprogram.caching.CacheException
        Throws:
        org.apache.sysml.runtime.controlprogram.caching.CacheException
      • releaseOutput

        public abstract void releaseOutput()
                                    throws org.apache.sysml.runtime.controlprogram.caching.CacheException
        Throws:
        org.apache.sysml.runtime.controlprogram.caching.CacheException
      • evict

        protected static void evict(long GPUSize)
                             throws DMLRuntimeException
        Convenience wrapper over evict(String, long)
        Parameters:
        GPUSize - Desired size to be freed up on the GPU
        Throws:
        DMLRuntimeException - If no blocks to free up or if not enough blocks with zero locks on them.
      • evict

        protected static void evict(String instructionName,
                                    long GPUSize)
                             throws DMLRuntimeException
        Cycles through the sorted list of allocated 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 policy
        Parameters:
        instructionName - name of the instruction for which performance measurements are made
        GPUSize - Desired size to be freed up on the GPU
        Throws:
        DMLRuntimeException - If no blocks to free up or if not enough blocks with zero locks on them.
      • clearData

        public void clearData()
                       throws org.apache.sysml.runtime.controlprogram.caching.CacheException
        lazily clears the data associated with this GPUObject instance
        Throws:
        org.apache.sysml.runtime.controlprogram.caching.CacheException - ?
      • clearData

        public void clearData(boolean eager)
                       throws org.apache.sysml.runtime.controlprogram.caching.CacheException
        Clears the data associated with this GPUObject instance
        Parameters:
        eager - whether to be done synchronously or asynchronously
        Throws:
        org.apache.sysml.runtime.controlprogram.caching.CacheException - ?
      • getAvailableMemory

        protected static long getAvailableMemory()

Copyright © 2017 The Apache Software Foundation. All rights reserved.