use of org.nd4j.jita.conf.Configuration in project nd4j by deeplearning4j.
the class AsynchronousFlowControllerTest method testDependencies4.
@Test
public void testDependencies4() throws Exception {
INDArray arrayWrite = Nd4j.create(new float[] { 1f, 2f, 3f });
INDArray array = Nd4j.create(new float[] { 1f, 2f, 3f });
// we use synchronization to make sure it completes activeWrite caused by array creation
String arrayContents = array.toString();
AllocationPoint point = allocator.getAllocationPoint(array);
AllocationPoint pointWrite = allocator.getAllocationPoint(arrayWrite);
assertPointHasNoDependencies(point);
controller.cutTail();
CudaContext context = controller.prepareAction(arrayWrite, array);
controller.registerAction(context, arrayWrite, array);
assertTrue(controller.hasActiveReads(point));
assertFalse(controller.hasActiveReads(pointWrite));
assertNotEquals(-1, controller.hasActiveWrite(pointWrite));
Configuration configuration = CudaEnvironment.getInstance().getConfiguration();
controller.sweepTail();
assertTrue(controller.hasActiveReads(point));
assertFalse(controller.hasActiveReads(pointWrite));
assertNotEquals(-1, controller.hasActiveWrite(pointWrite));
controller.sweepTail();
assertTrue(controller.hasActiveReads(point));
assertFalse(controller.hasActiveReads(pointWrite));
assertNotEquals(-1, controller.hasActiveWrite(pointWrite));
for (int i = 0; i < configuration.getCommandQueueLength(); i++) controller.sweepTail();
assertPointHasNoDependencies(point);
assertPointHasNoDependencies(pointWrite);
}
use of org.nd4j.jita.conf.Configuration in project nd4j by deeplearning4j.
the class AtomicAllocatorTest method setUp.
@Before
public void setUp() throws Exception {
DataTypeUtil.setDTypeForContext(DataBuffer.Type.FLOAT);
if (allocator == null) {
Configuration configuration = new Configuration();
// configuration.setHostDeallocAggressiveness(Aggressiveness.IMMEDIATE);
configuration.setMaximumSingleHostAllocation(5000);
configuration.setMaximumZeroAllocation(1000000000);
// singleDevice4GBcc52 = new CudaEnvironment(configuration);
DeviceInformation device1 = new DeviceInformation();
device1.setDeviceId(0);
device1.setCcMajor(5);
device1.setCcMinor(2);
device1.setTotalMemory(4 * 1024 * 1024 * 1024L);
device1.setAvailableMemory(4 * 1024 * 1024 * 1024L);
// singleDevice4GBcc52.addDevice(device1);
allocator = AtomicAllocator.getInstance();
// allocator.applyConfiguration(configuration);
// allocator.setEnvironment(singleDevice4GBcc52);
// allocator.setMemoryHandler(new CudaZeroHandler());
}
}
Aggregations