Search in sources :

Example 21 with MemoryWorkspace

use of org.nd4j.linalg.api.memory.MemoryWorkspace in project nd4j by deeplearning4j.

the class CpuWorkspaceManager method createNewWorkspace.

@Override
public MemoryWorkspace createNewWorkspace(@NonNull WorkspaceConfiguration configuration) {
    ensureThreadExistense();
    MemoryWorkspace workspace = new CpuWorkspace(configuration);
    backingMap.get().put(workspace.getId(), workspace);
    pickReference(workspace);
    return workspace;
}
Also used : MemoryWorkspace(org.nd4j.linalg.api.memory.MemoryWorkspace)

Example 22 with MemoryWorkspace

use of org.nd4j.linalg.api.memory.MemoryWorkspace in project nd4j by deeplearning4j.

the class CpuWorkspaceManager method createNewWorkspace.

@Override
public MemoryWorkspace createNewWorkspace(@NonNull WorkspaceConfiguration configuration, @NonNull String id, Integer deviceId) {
    ensureThreadExistense();
    MemoryWorkspace workspace = new CpuWorkspace(configuration, id, deviceId);
    backingMap.get().put(id, workspace);
    pickReference(workspace);
    return workspace;
}
Also used : MemoryWorkspace(org.nd4j.linalg.api.memory.MemoryWorkspace)

Example 23 with MemoryWorkspace

use of org.nd4j.linalg.api.memory.MemoryWorkspace in project nd4j by deeplearning4j.

the class CpuNDArrayFactory method createUninitializedDetached.

@Override
public INDArray createUninitializedDetached(int[] shape, char ordering) {
    MemoryWorkspace workspace = Nd4j.getMemoryManager().getCurrentWorkspace();
    Nd4j.getMemoryManager().setCurrentWorkspace(null);
    INDArray ret = new NDArray(shape, Nd4j.getStrides(shape, ordering), 0, ordering, false);
    Nd4j.getMemoryManager().setCurrentWorkspace(workspace);
    return ret;
}
Also used : INDArray(org.nd4j.linalg.api.ndarray.INDArray) ComplexNDArray(org.nd4j.linalg.cpu.nativecpu.complex.ComplexNDArray) IComplexNDArray(org.nd4j.linalg.api.complex.IComplexNDArray) INDArray(org.nd4j.linalg.api.ndarray.INDArray) MemoryWorkspace(org.nd4j.linalg.api.memory.MemoryWorkspace)

Example 24 with MemoryWorkspace

use of org.nd4j.linalg.api.memory.MemoryWorkspace in project nd4j by deeplearning4j.

the class CudaWorkspaceManager method createNewWorkspace.

@Override
public MemoryWorkspace createNewWorkspace(WorkspaceConfiguration configuration, String id, Integer deviceId) {
    ensureThreadExistense();
    MemoryWorkspace workspace = new CudaWorkspace(configuration, id, deviceId);
    backingMap.get().put(id, workspace);
    pickReference(workspace);
    return workspace;
}
Also used : MemoryWorkspace(org.nd4j.linalg.api.memory.MemoryWorkspace)

Example 25 with MemoryWorkspace

use of org.nd4j.linalg.api.memory.MemoryWorkspace in project nd4j by deeplearning4j.

the class CudaWorkspaceManager method createNewWorkspace.

@Override
public MemoryWorkspace createNewWorkspace(@NonNull WorkspaceConfiguration configuration) {
    ensureThreadExistense();
    MemoryWorkspace workspace = new CudaWorkspace(configuration);
    backingMap.get().put(workspace.getId(), workspace);
    pickReference(workspace);
    return workspace;
}
Also used : MemoryWorkspace(org.nd4j.linalg.api.memory.MemoryWorkspace)

Aggregations

MemoryWorkspace (org.nd4j.linalg.api.memory.MemoryWorkspace)62 Test (org.junit.Test)39 BaseNd4jTest (org.nd4j.linalg.BaseNd4jTest)35 INDArray (org.nd4j.linalg.api.ndarray.INDArray)35 Nd4jWorkspace (org.nd4j.linalg.memory.abstracts.Nd4jWorkspace)18 WorkspaceConfiguration (org.nd4j.linalg.api.memory.conf.WorkspaceConfiguration)14 DataBuffer (org.nd4j.linalg.api.buffer.DataBuffer)6 AtomicLong (java.util.concurrent.atomic.AtomicLong)5 AllocationPoint (org.nd4j.jita.allocator.impl.AllocationPoint)4 ND4JIllegalStateException (org.nd4j.linalg.exception.ND4JIllegalStateException)3 CudaContext (org.nd4j.linalg.jcublas.context.CudaContext)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 DataInputStream (java.io.DataInputStream)2 DataOutputStream (java.io.DataOutputStream)2 File (java.io.File)2 ArrayList (java.util.ArrayList)2 Ignore (org.junit.Ignore)2 IOException (java.io.IOException)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1