Class NativeND4JCUDASparseTensorBackend
java.lang.Object
org.episteme.nativ.mathematics.linearalgebra.tensors.backends.NativeND4JCUDASparseTensorBackend
- All Implemented Interfaces:
TensorBackend, TensorProvider, AlgorithmProvider, Backend, ComputeBackend
@AutoService({TensorBackend.class,AlgorithmProvider.class})
public class NativeND4JCUDASparseTensorBackend
extends Object
implements TensorBackend
NativeND4J Sparse Tensor backend.
This backend implements sparse tensor operations using ND4J on CUDA. Delegation to fallbacks is strictly prohibited by architectural rules.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> Tensor<T> create(T[] data, int... shape) Creates a tensor from a flat array and shape.Creates an execution context for running operations.Returns the type of hardware accelerator used by this backend.Returns a description of the backend.getId()Returns the unique identifier for this backend (e.g., "javafx", "jmol", "cuda").getName()Returns the name of this provider.intReturns the priority of this provider (higher = preferred).booleanChecks if this backend is currently available (libraries loaded, etc.).<T> Tensor<T> Creates a tensor with the given shape, filled with ones.booleanReturns true if this provider supports GPU acceleration.booleanChecks if this backend supports parallel operations.<T> Tensor<T> Creates a tensor with the given shape, filled with zeros.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AlgorithmProvider
description, getMetadata, scoreMethods inherited from interface Backend
getAlgorithmProviders, getStatusMessage, isExplicitlyDisabledMethods inherited from interface ComputeBackend
createBackend, getType, supportsComplexNumbers, supportsFloatingPointMethods inherited from interface TensorBackend
shutdownMethods inherited from interface TensorProvider
getAlgorithmType
-
Constructor Details
-
NativeND4JCUDASparseTensorBackend
public NativeND4JCUDASparseTensorBackend()
-
-
Method Details
-
isAvailable
public boolean isAvailable()Description copied from interface:BackendChecks if this backend is currently available (libraries loaded, etc.).Default implementation checks
Backend.isExplicitlyDisabled()and returns false if it is.- Specified by:
isAvailablein interfaceAlgorithmProvider- Specified by:
isAvailablein interfaceBackend- Specified by:
isAvailablein interfaceTensorBackend
-
zeros
Description copied from interface:TensorBackendCreates a tensor with the given shape, filled with zeros.- Specified by:
zerosin interfaceTensorBackend- Specified by:
zerosin interfaceTensorProvider- Type Parameters:
T- the element type- Parameters:
elementType- the class of field elementsshape- the tensor shape- Returns:
- zero-initialized tensor
-
ones
Description copied from interface:TensorBackendCreates a tensor with the given shape, filled with ones.- Specified by:
onesin interfaceTensorBackend- Specified by:
onesin interfaceTensorProvider- Type Parameters:
T- the element type- Parameters:
elementType- the class of field elementsshape- the tensor shape- Returns:
- one-initialized tensor
-
create
Description copied from interface:TensorBackendCreates a tensor from a flat array and shape.- Specified by:
createin interfaceTensorBackend- Specified by:
createin interfaceTensorProvider- Type Parameters:
T- the element type- Parameters:
data- the flat data arrayshape- the tensor shape- Returns:
- tensor with given data
-
supportsGPU
public boolean supportsGPU()Description copied from interface:TensorBackendReturns true if this provider supports GPU acceleration.- Specified by:
supportsGPUin interfaceTensorBackend- Returns:
- true if GPU is available
-
getName
Description copied from interface:TensorBackendReturns the name of this provider.- Specified by:
getNamein interfaceAlgorithmProvider- Specified by:
getNamein interfaceBackend- Specified by:
getNamein interfaceTensorBackend- Specified by:
getNamein interfaceTensorProvider- Returns:
- provider name (e.g., "Native", "ND4J", "DJL")
-
getPriority
public int getPriority()Description copied from interface:TensorBackendReturns the priority of this provider (higher = preferred).Used for automatic selection when multiple providers are available.
- Specified by:
getPriorityin interfaceAlgorithmProvider- Specified by:
getPriorityin interfaceBackend- Specified by:
getPriorityin interfaceTensorBackend- Returns:
- priority (0-100, default native = 50)
-
supportsParallelOps
public boolean supportsParallelOps()Description copied from interface:ComputeBackendChecks if this backend supports parallel operations.- Specified by:
supportsParallelOpsin interfaceComputeBackend- Returns:
- true if parallel execution is supported
-
createContext
Description copied from interface:ComputeBackendCreates an execution context for running operations.The context should be used within a try-with-resources block to ensure proper cleanup of resources.
- Specified by:
createContextin interfaceComputeBackend- Returns:
- new execution context
-
getId
-
getDescription
Description copied from interface:BackendReturns a description of the backend.- Specified by:
getDescriptionin interfaceBackend- Specified by:
getDescriptionin interfaceComputeBackend
-
getAcceleratorType
Description copied from interface:ComputeBackendReturns the type of hardware accelerator used by this backend.- Specified by:
getAcceleratorTypein interfaceComputeBackend- Returns:
- the accelerator type
-