@Test public void testSimulateRun() throws Exception { int numCores = Runtime.getRuntime().availableProcessors(); ExecutorService executorService = Executors.newFixedThreadPool(numCores); ParameterServerClient[] clients = new ParameterServerClient[numCores]; String host = "localhost"; for (int i = 0; i < numCores; i++) { clients[i] = ParameterServerClient.builder().aeron(aeron).masterStatusHost(host) .masterStatusPort(statusPort).subscriberHost(host).subscriberPort(40325 + i) .subscriberStream(10 + i) .ndarrayRetrieveUrl(parameterServerNode.getSubscriber()[i].getResponder().connectionUrl()) .ndarraySendUrl(parameterServerNode.getSubscriber()[i].getSubscriber().connectionUrl()) .build(); } Thread.sleep(60000); for (int i = 0; i < numCores; i++) { assertFalse(clients[i].isReadyForNext()); } for (int i = 0; i < numCores; i++) { clients[i].pushNDArrayMessage(NDArrayMessage.wholeArrayUpdate(Nd4j.ones(parameterLength))); } Thread.sleep(10000); for (int i = 0; i < numCores; i++) { assertTrue(clients[i].isReadyForNext()); } Thread.sleep(10000); for (int i = 0; i < 1; i++) { assertEquals(Nd4j.valueArrayOf(1, parameterLength, numCores), clients[i].getArray()); Thread.sleep(1000); } executorService.shutdown(); Thread.sleep(60000); parameterServerNode.close(); }
@Override public void close() throws Exception { if (subscriber != null) { for (int i = 0; i < subscriber.length; i++) { if (subscriber[i] != null) { subscriber[i].close(); } } } if (server != null) server.stop(); if (mediaDriver != null) CloseHelper.quietClose(mediaDriver); if (aeron != null) CloseHelper.quietClose(aeron); }
ParameterServerNode implements AutoCloseable { @Override public void close() throws Exception { if (subscriber != null) { for (int i = 0; i < subscriber.length; i++) { if (subscriber[i] != null) { subscriber[i].close(); } } } if (server != null) server.stop(); if (mediaDriver != null) CloseHelper.quietClose(mediaDriver); if (aeron != null) CloseHelper.quietClose(aeron); } }
ParameterServerNode implements AutoCloseable { @Override public void close() throws Exception { if (subscriber != null) { for (int i = 0; i < subscriber.length; i++) { if (subscriber[i] != null) { subscriber[i].close(); } } } if (server != null) server.stop(); if (mediaDriver != null) CloseHelper.quietClose(mediaDriver); if (aeron != null) CloseHelper.quietClose(aeron); } ParameterServerNode(MediaDriver mediaDriver, int statusPort);  ParameterServerNode(MediaDriver mediaDriver, int statusPort, int numWorkers);  ParameterServerNode(MediaDriver mediaDriver); }
ParameterServerNode implements AutoCloseable { @Override public void close() throws Exception { if (subscriber != null) { for (int i = 0; i < subscriber.length; i++) { if (subscriber[i] != null) { subscriber[i].close(); } } } if (server != null) server.stop(); if (mediaDriver != null) CloseHelper.quietClose(mediaDriver); if (aeron != null) CloseHelper.quietClose(aeron); } ParameterServerNode(MediaDriver mediaDriver, int statusPort);  ParameterServerNode(MediaDriver mediaDriver, int statusPort, int numWorkers);  ParameterServerNode(MediaDriver mediaDriver); void runMain(String[] args); boolean subscriberLaunched(); @Override void close(); static void main(String[] args); }
ParameterServerNode implements AutoCloseable { @Override public void close() throws Exception { if (subscriber != null) { for (int i = 0; i < subscriber.length; i++) { if (subscriber[i] != null) { subscriber[i].close(); } } } if (server != null) server.stop(); if (mediaDriver != null) CloseHelper.quietClose(mediaDriver); if (aeron != null) CloseHelper.quietClose(aeron); } ParameterServerNode(MediaDriver mediaDriver, int statusPort);  ParameterServerNode(MediaDriver mediaDriver, int statusPort, int numWorkers);  ParameterServerNode(MediaDriver mediaDriver); void runMain(String[] args); boolean subscriberLaunched(); @Override void close(); static void main(String[] args);  }