Search in sources :

Example 1 with DeviceTADManager

use of org.nd4j.jita.allocator.tad.DeviceTADManager in project nd4j by deeplearning4j.

the class DelayedMemoryTest method testDelayedTAD1.

@Test
public void testDelayedTAD1() throws Exception {
    TADManager tadManager = new DeviceTADManager();
    INDArray array = Nd4j.create(128, 256);
    Pair<DataBuffer, DataBuffer> tadBuffers = tadManager.getTADOnlyShapeInfo(array, new int[] { 0 });
    DataBuffer tadBuffer = tadBuffers.getFirst();
    DataBuffer offBuffer = tadBuffers.getSecond();
    AllocationPoint pointTad = AtomicAllocator.getInstance().getAllocationPoint(tadBuffer);
    AllocationPoint pointOff = AtomicAllocator.getInstance().getAllocationPoint(offBuffer);
    assertEquals(AllocationStatus.CONSTANT, pointTad.getAllocationStatus());
    assertEquals(AllocationStatus.DEVICE, pointOff.getAllocationStatus());
}
Also used : INDArray(org.nd4j.linalg.api.ndarray.INDArray) AllocationPoint(org.nd4j.jita.allocator.impl.AllocationPoint) TADManager(org.nd4j.linalg.cache.TADManager) DeviceTADManager(org.nd4j.jita.allocator.tad.DeviceTADManager) DeviceTADManager(org.nd4j.jita.allocator.tad.DeviceTADManager) DataBuffer(org.nd4j.linalg.api.buffer.DataBuffer) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 AllocationPoint (org.nd4j.jita.allocator.impl.AllocationPoint)1 DeviceTADManager (org.nd4j.jita.allocator.tad.DeviceTADManager)1 DataBuffer (org.nd4j.linalg.api.buffer.DataBuffer)1 INDArray (org.nd4j.linalg.api.ndarray.INDArray)1 TADManager (org.nd4j.linalg.cache.TADManager)1