Package org.apache.sysds.runtime.instructions.gpu.context

# Class ShadowBuffer

java.lang.Object
org.apache.sysds.runtime.instructions.gpu.context.ShadowBuffer

public class ShadowBuffer extends Object

## Constructor Summary

Constructors
Constructor
Description
`ShadowBuffer(GPUObject gpuObj)`

## Method Summary

Modifier and Type
Method
Description
`void`
`clearShadowPointer()`
Removes the content from shadow buffer
`boolean`
`isBuffered()`
Check if the gpu object is shadow buffered
`boolean`
`isEligibleForBuffering(boolean isEviction, boolean eagerDelete)`
Checks if the GPU object is eligible for shadow buffering
`void`
`moveFromDevice(String instName)`
Move the data from GPU to shadow buffer
`void`
`moveToDevice()`
Move the data from shadow buffer to GPU
`void`
`moveToHost()`
Move the data from shadow buffer to Matrix object

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ShadowBuffer

public ShadowBuffer(GPUObject gpuObj)

## Method Details

### isBuffered

public boolean isBuffered()
Check if the gpu object is shadow buffered

Returns:
  true if the gpu object is shadow buffered

### moveFromDevice

public void moveFromDevice(String instName)
Move the data from GPU to shadow buffer

Parameters:
  `instName` - name of the instruction

### moveToHost

public void moveToHost()
Move the data from shadow buffer to Matrix object

### moveToDevice

public void moveToDevice()
Move the data from shadow buffer to GPU

### isEligibleForBuffering

public boolean isEligibleForBuffering(boolean isEviction, boolean eagerDelete)
Checks if the GPU object is eligible for shadow buffering

Parameters:
  `isEviction` - true if this method is called during eviction
  `eagerDelete` - true if the data on device has to be eagerly deleted
Returns:
  true if the given GPU object is eligible to be shadow buffered

### clearShadowPointer

public void clearShadowPointer()
Removes the content from shadow buffer