Package org.nd4j.linalg.api.concurrency
Interface AffinityManager
-
- All Known Implementing Classes:
BasicAffinityManager
public interface AffinityManager
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
AffinityManager.Location
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
allowCrossDeviceAccess(boolean reallyAllow)
This method allows to block cross-device access.void
ensureLocation(INDArray array, AffinityManager.Location location)
This method propagates given INDArray to specified locationAffinityManager.Location
getActiveLocation(INDArray array)
This method returns last-updated location for the given INDArrayInteger
getDeviceForArray(INDArray array)
This method returns id of current device for a given INDArrayInteger
getDeviceForCurrentThread()
This method returns deviceId for current threadInteger
getDeviceForThread(long threadId)
This method returns deviceId for a given threadint
getNumberOfDevices()
This method returns number of available devicesboolean
isCrossDeviceAccessSupported()
This method returns TRUE if cross-device access is allowed on this systemDataBuffer
replicateToDevice(Integer deviceId, DataBuffer buffer)
This method replicates given DataBuffer, and places it to target device.INDArray
replicateToDevice(Integer deviceId, INDArray array)
This method replicates given INDArray, and places it to target device.void
tagLocation(DataBuffer buffer, AffinityManager.Location location)
This method tags specific DataBuffer as "recent" on specified locationvoid
tagLocation(INDArray array, AffinityManager.Location location)
This method tags specific INDArray as "recent" on specified locationvoid
touch(DataBuffer buffer)
Utility method, to associate INDArray with specific device (backend-specific)void
touch(INDArray array)
Utility method, to associate INDArray with specific device (backend-specific)void
unsafeSetDevice(Integer deviceId)
This method forces specific device for current thread.
-
-
-
Method Detail
-
getDeviceForCurrentThread
Integer getDeviceForCurrentThread()
This method returns deviceId for current thread- Returns:
-
getDeviceForThread
Integer getDeviceForThread(long threadId)
This method returns deviceId for a given thread- Returns:
-
getDeviceForArray
Integer getDeviceForArray(INDArray array)
This method returns id of current device for a given INDArray- Parameters:
array
-- Returns:
-
getNumberOfDevices
int getNumberOfDevices()
This method returns number of available devices- Returns:
-
touch
void touch(INDArray array)
Utility method, to associate INDArray with specific device (backend-specific)- Parameters:
array
-
-
touch
void touch(DataBuffer buffer)
Utility method, to associate INDArray with specific device (backend-specific)- Parameters:
buffer
-
-
replicateToDevice
INDArray replicateToDevice(Integer deviceId, INDArray array)
This method replicates given INDArray, and places it to target device.- Parameters:
deviceId
- target deviceIdarray
- INDArray to replicate- Returns:
-
replicateToDevice
DataBuffer replicateToDevice(Integer deviceId, DataBuffer buffer)
This method replicates given DataBuffer, and places it to target device.- Parameters:
deviceId
- target deviceIdbuffer
-- Returns:
-
tagLocation
void tagLocation(INDArray array, AffinityManager.Location location)
This method tags specific INDArray as "recent" on specified location- Parameters:
location
-
-
tagLocation
void tagLocation(DataBuffer buffer, AffinityManager.Location location)
This method tags specific DataBuffer as "recent" on specified location- Parameters:
location
-
-
ensureLocation
void ensureLocation(INDArray array, AffinityManager.Location location)
This method propagates given INDArray to specified location- Parameters:
array
-location
-
-
getActiveLocation
AffinityManager.Location getActiveLocation(INDArray array)
This method returns last-updated location for the given INDArray- Parameters:
array
-- Returns:
-
unsafeSetDevice
void unsafeSetDevice(Integer deviceId)
This method forces specific device for current thread. PLEASE NOTE: This method is UNSAFE and should NOT be used with 100% clearance about it.- Parameters:
deviceId
-
-
isCrossDeviceAccessSupported
boolean isCrossDeviceAccessSupported()
This method returns TRUE if cross-device access is allowed on this system
-
allowCrossDeviceAccess
void allowCrossDeviceAccess(boolean reallyAllow)
This method allows to block cross-device access. Mostly suitable for debugging/testing purposes- Parameters:
reallyAllow
-
-
-