Package org.nd4j.linalg.api.concurrency
Class BasicAffinityManager
- java.lang.Object
-
- org.nd4j.linalg.api.concurrency.BasicAffinityManager
-
- All Implemented Interfaces:
AffinityManager
public abstract class BasicAffinityManager extends Object implements AffinityManager
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.nd4j.linalg.api.concurrency.AffinityManager
AffinityManager.Location
-
-
Constructor Summary
Constructors Constructor Description BasicAffinityManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidallowCrossDeviceAccess(boolean reallyAllow)This method allows to block cross-device access.voidensureLocation(INDArray array, AffinityManager.Location location)This method propagates given INDArray to specified locationAffinityManager.LocationgetActiveLocation(INDArray array)This method returns last-updated location for the given INDArrayIntegergetDeviceForArray(INDArray array)This method returns id of current device for a given INDArrayIntegergetDeviceForCurrentThread()This method returns deviceId for current threadIntegergetDeviceForThread(long threadId)This method returns deviceId for a given threadintgetNumberOfDevices()This method returns number of available devicesbooleanisCrossDeviceAccessSupported()This method returns TRUE if cross-device access is allowed on this systemDataBufferreplicateToDevice(Integer deviceId, DataBuffer buffer)This method replicates given DataBuffer, and places it to target device.INDArrayreplicateToDevice(Integer deviceId, INDArray array)This method replicates given INDArray, and places it to target device.voidtagLocation(DataBuffer buffer, AffinityManager.Location location)This method tags specific DataBuffer as "recent" on specified locationvoidtagLocation(INDArray array, AffinityManager.Location location)This method tags specific INDArray as "recent" on specified locationvoidunsafeSetDevice(Integer deviceId)This method forces specific device for current thread.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nd4j.linalg.api.concurrency.AffinityManager
touch, touch
-
-
-
-
Method Detail
-
getDeviceForCurrentThread
public Integer getDeviceForCurrentThread()
Description copied from interface:AffinityManagerThis method returns deviceId for current thread- Specified by:
getDeviceForCurrentThreadin interfaceAffinityManager- Returns:
-
getDeviceForThread
public Integer getDeviceForThread(long threadId)
Description copied from interface:AffinityManagerThis method returns deviceId for a given thread- Specified by:
getDeviceForThreadin interfaceAffinityManager- Returns:
-
getDeviceForArray
public Integer getDeviceForArray(INDArray array)
Description copied from interface:AffinityManagerThis method returns id of current device for a given INDArray- Specified by:
getDeviceForArrayin interfaceAffinityManager- Returns:
-
getNumberOfDevices
public int getNumberOfDevices()
Description copied from interface:AffinityManagerThis method returns number of available devices- Specified by:
getNumberOfDevicesin interfaceAffinityManager- Returns:
-
replicateToDevice
public INDArray replicateToDevice(Integer deviceId, INDArray array)
This method replicates given INDArray, and places it to target device.- Specified by:
replicateToDevicein interfaceAffinityManager- Parameters:
deviceId- target deviceIdarray- INDArray to replicate- Returns:
-
replicateToDevice
public DataBuffer replicateToDevice(Integer deviceId, DataBuffer buffer)
This method replicates given DataBuffer, and places it to target device.- Specified by:
replicateToDevicein interfaceAffinityManager- Parameters:
deviceId- target deviceIdbuffer-- Returns:
-
tagLocation
public void tagLocation(INDArray array, AffinityManager.Location location)
Description copied from interface:AffinityManagerThis method tags specific INDArray as "recent" on specified location- Specified by:
tagLocationin interfaceAffinityManager
-
tagLocation
public void tagLocation(DataBuffer buffer, AffinityManager.Location location)
Description copied from interface:AffinityManagerThis method tags specific DataBuffer as "recent" on specified location- Specified by:
tagLocationin interfaceAffinityManager
-
unsafeSetDevice
public void unsafeSetDevice(Integer deviceId)
Description copied from interface:AffinityManagerThis method forces specific device for current thread. PLEASE NOTE: This method is UNSAFE and should NOT be used with 100% clearance about it.- Specified by:
unsafeSetDevicein interfaceAffinityManager
-
ensureLocation
public void ensureLocation(INDArray array, AffinityManager.Location location)
Description copied from interface:AffinityManagerThis method propagates given INDArray to specified location- Specified by:
ensureLocationin interfaceAffinityManager
-
isCrossDeviceAccessSupported
public boolean isCrossDeviceAccessSupported()
Description copied from interface:AffinityManagerThis method returns TRUE if cross-device access is allowed on this system- Specified by:
isCrossDeviceAccessSupportedin interfaceAffinityManager
-
allowCrossDeviceAccess
public void allowCrossDeviceAccess(boolean reallyAllow)
Description copied from interface:AffinityManagerThis method allows to block cross-device access. Mostly suitable for debugging/testing purposes- Specified by:
allowCrossDeviceAccessin interfaceAffinityManager
-
getActiveLocation
public AffinityManager.Location getActiveLocation(INDArray array)
Description copied from interface:AffinityManagerThis method returns last-updated location for the given INDArray- Specified by:
getActiveLocationin interfaceAffinityManager- Returns:
-
-