Search in sources :

Example 1 with FrameCompletionHandler

use of org.nd4j.parameterserver.distributed.logic.completion.FrameCompletionHandler in project nd4j by deeplearning4j.

the class FrameCompletionHandlerTest method testCompletion1.

/**
 * This test emulates 2 frames being processed at the same time
 * @throws Exception
 */
@Test
public void testCompletion1() throws Exception {
    FrameCompletionHandler handler = new FrameCompletionHandler();
    long[] frames = new long[] { 15L, 17L };
    long[] originators = new long[] { 123L, 183L };
    for (Long originator : originators) {
        for (Long frame : frames) {
            for (int e = 1; e <= 512; e++) {
                handler.addHook(originator, frame, (long) e);
            }
        }
        for (Long frame : frames) {
            for (int e = 1; e <= 512; e++) {
                handler.notifyFrame(originator, frame, (long) e);
            }
        }
    }
    for (Long originator : originators) {
        for (Long frame : frames) {
            assertEquals(true, handler.isCompleted(originator, frame));
        }
    }
}
Also used : FrameCompletionHandler(org.nd4j.parameterserver.distributed.logic.completion.FrameCompletionHandler) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 FrameCompletionHandler (org.nd4j.parameterserver.distributed.logic.completion.FrameCompletionHandler)1