parent
7bcfa76df4
commit
6856b154b1
|
@ -51,7 +51,7 @@ public class AeronNDArraySubscriber implements AutoCloseable {
|
|||
// Create a context, needed for client connection to media driver
|
||||
// A separate media driver process need to run prior to running this application
|
||||
private Aeron.Context ctx;
|
||||
private AtomicBoolean running = new AtomicBoolean(true);
|
||||
private AtomicBoolean running;
|
||||
private final AtomicBoolean init = new AtomicBoolean(false);
|
||||
|
||||
private NDArrayCallback ndArrayCallback;
|
||||
|
|
|
@ -72,7 +72,8 @@ public class LargeNdArrayIpcTest extends BaseND4JTest {
|
|||
INDArray arr = Nd4j.ones(length);
|
||||
AeronNDArrayPublisher publisher;
|
||||
ctx = new Aeron.Context()
|
||||
.driverTimeoutMs(10000).availableImageHandler(AeronUtil::printAvailableImage)
|
||||
.driverTimeoutMs(10000)
|
||||
.availableImageHandler(AeronUtil::printAvailableImage)
|
||||
.unavailableImageHandler(AeronUtil::printUnavailableImage)
|
||||
.aeronDirectoryName(mediaDriver.aeronDirectoryName())
|
||||
.errorHandler(err -> err.printStackTrace());
|
||||
|
@ -82,8 +83,12 @@ public class LargeNdArrayIpcTest extends BaseND4JTest {
|
|||
int numSubscribers = 1;
|
||||
AeronNDArraySubscriber[] subscribers = new AeronNDArraySubscriber[numSubscribers];
|
||||
for (int i = 0; i < numSubscribers; i++) {
|
||||
AeronNDArraySubscriber subscriber = AeronNDArraySubscriber.builder().streamId(streamId).ctx(getContext())
|
||||
.channel(channel).aeron(aeron).running(running).ndArrayCallback(new NDArrayCallback() {
|
||||
AeronNDArraySubscriber subscriber = AeronNDArraySubscriber.builder()
|
||||
.streamId(streamId).ctx(getContext())
|
||||
.channel(channel)
|
||||
.aeron(aeron)
|
||||
.running(running)
|
||||
.ndArrayCallback(new NDArrayCallback() {
|
||||
/**
|
||||
* A listener for ndarray message
|
||||
*
|
||||
|
@ -110,7 +115,8 @@ public class LargeNdArrayIpcTest extends BaseND4JTest {
|
|||
try {
|
||||
subscriber.launch();
|
||||
} catch (Exception e) {
|
||||
log.error("",e);
|
||||
System.out.println(e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -122,17 +128,23 @@ public class LargeNdArrayIpcTest extends BaseND4JTest {
|
|||
|
||||
Thread.sleep(1000);
|
||||
|
||||
publisher = AeronNDArrayPublisher.builder().publishRetryTimeOut(3000).streamId(streamId).channel(channel)
|
||||
.aeron(aeron).build();
|
||||
publisher = AeronNDArrayPublisher.builder()
|
||||
.publishRetryTimeOut(3000)
|
||||
.streamId(streamId)
|
||||
.channel(channel)
|
||||
.aeron(aeron)
|
||||
.build();
|
||||
|
||||
|
||||
for (int i = 0; i < 1 && running.get(); i++) {
|
||||
log.info("About to send array.");
|
||||
for (int i = 0; i < 1; i++) {
|
||||
System.out.println("About to send array.");
|
||||
publisher.publish(arr);
|
||||
log.info("Sent array");
|
||||
System.out.println("Sent array");
|
||||
|
||||
}
|
||||
|
||||
Thread.sleep( 5000);
|
||||
|
||||
for (int i = 0; i < numSubscribers; i++)
|
||||
CloseHelper.close(subscribers[i]);
|
||||
CloseHelper.close(aeron);
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
* *****************************************************************************
|
||||
*
|
||||
*/
|
||||
apply from: "${project.rootProject.projectDir}/createTestBackends.gradle"
|
||||
|
||||
dependencies {
|
||||
implementation "com.fasterxml.jackson.core:jackson-databind"
|
||||
|
@ -29,4 +30,5 @@ dependencies {
|
|||
implementation "org.apache.commons:commons-compress"
|
||||
implementation "commons-codec:commons-codec"
|
||||
testImplementation projects.cavisNd4j.cavisNd4jCommonTests
|
||||
testRuntimeOnly "net.brutex.ai:dl4j-test-resources:1.0.1-SNAPSHOT"
|
||||
}
|
|
@ -24,9 +24,11 @@ package org.nd4j.common.io;
|
|||
import org.apache.commons.io.FileUtils;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.nd4j.common.io.ClassPathResource;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
@ -36,13 +38,12 @@ public class ClassPathResourceTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void testDirExtractingIntelliJ() throws Exception {
|
||||
public void testDirExtractingIntelliJ(@TempDir Path tempDir) throws Exception {
|
||||
//https://github.com/deeplearning4j/deeplearning4j/issues/6483
|
||||
|
||||
ClassPathResource cpr = new ClassPathResource("somedir");
|
||||
|
||||
File f = new File(FileUtils.getTempDirectoryPath()+File.separatorChar+ UUID.randomUUID().toString());
|
||||
FileUtils.forceMkdir(f);
|
||||
File f = tempDir.toFile();
|
||||
cpr.copyDirectory(f);
|
||||
|
||||
File[] files = f.listFiles();
|
||||
|
|
|
@ -325,7 +325,7 @@ public class ParameterServerSubscriber implements AutoCloseable {
|
|||
int tries=0;
|
||||
while (!subscriber.launched() && tries<12) {
|
||||
tries++;
|
||||
LockSupport.parkNanos(100000);
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
if(!subscriber.launched()) {
|
||||
throw new Exception("Subscriber did not start in time.");
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ /* ******************************************************************************
|
||||
~ *
|
||||
~
|
||||
~ ******************************************************************************
|
||||
~ *
|
||||
~ * This program and the accompanying materials are made available under the
|
||||
~ * terms of the Apache License, Version 2.0 which is available at
|
||||
|
@ -16,7 +16,8 @@
|
|||
~ * under the License.
|
||||
~ *
|
||||
~ * SPDX-License-Identifier: Apache-2.0
|
||||
~ ******************************************************************************/
|
||||
~ *****************************************************************************
|
||||
~
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
|
|
Loading…
Reference in New Issue