use of org.nd4j.parameterserver.distributed.logic.Storage in project nd4j by deeplearning4j.
the class FrameTest method testFrame1.
/**
* Simple test for Frame functionality
*/
@Test
public void testFrame1() {
final AtomicInteger count = new AtomicInteger(0);
Frame<TrainingMessage> frame = new Frame<>();
for (int i = 0; i < 10; i++) {
frame.stackMessage(new TrainingMessage() {
@Override
public byte getCounter() {
return 2;
}
@Override
public void setTargetId(short id) {
}
@Override
public int getRetransmitCount() {
return 0;
}
@Override
public void incrementRetransmitCount() {
}
@Override
public long getFrameId() {
return 0;
}
@Override
public void setFrameId(long frameId) {
}
@Override
public long getOriginatorId() {
return 0;
}
@Override
public void setOriginatorId(long id) {
}
@Override
public short getTargetId() {
return 0;
}
@Override
public long getTaskId() {
return 0;
}
@Override
public int getMessageType() {
return 0;
}
@Override
public byte[] asBytes() {
return new byte[0];
}
@Override
public UnsafeBuffer asUnsafeBuffer() {
return null;
}
@Override
public void attachContext(VoidConfiguration voidConfiguration, TrainingDriver<? extends TrainingMessage> trainer, Clipboard clipboard, Transport transport, Storage storage, NodeRole role, short shardIndex) {
// no-op intentionally
}
@Override
public void extractContext(BaseVoidMessage message) {
// no-op intentionally
}
@Override
public void processMessage() {
count.incrementAndGet();
}
@Override
public boolean isJoinSupported() {
return false;
}
@Override
public void joinMessage(VoidMessage message) {
// no-op
}
@Override
public boolean isBlockingMessage() {
return false;
}
});
}
assertEquals(10, frame.size());
frame.processMessage();
assertEquals(20, count.get());
}
Aggregations