public class MagicQueue
extends java.lang.Object
implements java.util.concurrent.BlockingQueue<org.nd4j.linalg.dataset.DataSet>
Modifier and Type | Class and Description |
---|---|
static class |
MagicQueue.Builder |
static class |
MagicQueue.Mode |
Modifier and Type | Field and Description |
---|---|
protected java.util.List<java.util.concurrent.LinkedBlockingQueue<org.nd4j.linalg.dataset.DataSet>> |
backingQueues |
protected int |
capacity |
protected java.util.concurrent.atomic.AtomicLong |
cntGet |
protected java.util.concurrent.atomic.AtomicLong |
cntPut |
protected java.util.List<org.deeplearning4j.parallelism.MagicQueue.QueueHandler> |
handlers |
protected java.util.concurrent.atomic.AtomicInteger |
interleavedCounter |
protected java.util.concurrent.atomic.AtomicInteger |
interleavedPutter |
protected MagicQueue.Mode |
mode |
protected java.util.concurrent.atomic.AtomicInteger |
nextBucket |
protected int |
numberOfBuckets |
Modifier | Constructor and Description |
---|---|
protected |
MagicQueue(int numberOfFlows,
int capacity) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(org.nd4j.linalg.dataset.DataSet dataSet) |
boolean |
addAll(java.util.Collection<? extends org.nd4j.linalg.dataset.DataSet> c) |
void |
clear() |
boolean |
contains(java.lang.Object o)
This method isn't supported
|
boolean |
containsAll(java.util.Collection<?> c)
This method isn't supported
|
int |
drainTo(java.util.Collection<? super org.nd4j.linalg.dataset.DataSet> c) |
int |
drainTo(java.util.Collection<? super org.nd4j.linalg.dataset.DataSet> c,
int maxElements) |
org.nd4j.linalg.dataset.DataSet |
element() |
boolean |
isEmpty() |
java.util.Iterator<org.nd4j.linalg.dataset.DataSet> |
iterator()
This method isn't supported
|
boolean |
offer(org.nd4j.linalg.dataset.DataSet dataSet) |
boolean |
offer(org.nd4j.linalg.dataset.DataSet dataSet,
long timeout,
java.util.concurrent.TimeUnit unit) |
org.nd4j.linalg.dataset.DataSet |
peek() |
org.nd4j.linalg.dataset.DataSet |
poll()
This method is supposed to be called from managed thread, attached to specific device.
|
org.nd4j.linalg.dataset.DataSet |
poll(long time,
java.util.concurrent.TimeUnit timeUnit)
This method is supposed to be called from managed thread, attached to specific device.
|
void |
put(org.nd4j.linalg.dataset.DataSet dataSet) |
int |
remainingCapacity() |
org.nd4j.linalg.dataset.DataSet |
remove() |
boolean |
remove(java.lang.Object o)
This method isn't supported
|
boolean |
removeAll(java.util.Collection<?> c)
This method isn't supported
|
boolean |
retainAll(java.util.Collection<?> c)
This method isn't supported
|
int |
size()
This method returns average queue size for all devices
|
protected int |
size(int deviceId) |
org.nd4j.linalg.dataset.DataSet |
take() |
java.lang.Object[] |
toArray()
This method isn't supported
|
<T> T[] |
toArray(T[] a)
This method isn't supported
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected final java.util.List<java.util.concurrent.LinkedBlockingQueue<org.nd4j.linalg.dataset.DataSet>> backingQueues
protected final java.util.concurrent.atomic.AtomicInteger nextBucket
protected final int numberOfBuckets
protected final java.util.List<org.deeplearning4j.parallelism.MagicQueue.QueueHandler> handlers
protected int capacity
protected MagicQueue.Mode mode
protected java.util.concurrent.atomic.AtomicInteger interleavedCounter
protected java.util.concurrent.atomic.AtomicInteger interleavedPutter
protected java.util.concurrent.atomic.AtomicLong cntPut
protected java.util.concurrent.atomic.AtomicLong cntGet
public int size()
size
in interface java.util.Collection<org.nd4j.linalg.dataset.DataSet>
protected int size(int deviceId)
public boolean isEmpty()
isEmpty
in interface java.util.Collection<org.nd4j.linalg.dataset.DataSet>
public boolean contains(java.lang.Object o)
contains
in interface java.util.Collection<org.nd4j.linalg.dataset.DataSet>
contains
in interface java.util.concurrent.BlockingQueue<org.nd4j.linalg.dataset.DataSet>
o
- public int drainTo(java.util.Collection<? super org.nd4j.linalg.dataset.DataSet> c)
drainTo
in interface java.util.concurrent.BlockingQueue<org.nd4j.linalg.dataset.DataSet>
public int drainTo(java.util.Collection<? super org.nd4j.linalg.dataset.DataSet> c, int maxElements)
drainTo
in interface java.util.concurrent.BlockingQueue<org.nd4j.linalg.dataset.DataSet>
public java.util.Iterator<org.nd4j.linalg.dataset.DataSet> iterator()
iterator
in interface java.lang.Iterable<org.nd4j.linalg.dataset.DataSet>
iterator
in interface java.util.Collection<org.nd4j.linalg.dataset.DataSet>
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection<org.nd4j.linalg.dataset.DataSet>
public <T> T[] toArray(T[] a)
toArray
in interface java.util.Collection<org.nd4j.linalg.dataset.DataSet>
T
- a
- public boolean add(org.nd4j.linalg.dataset.DataSet dataSet)
add
in interface java.util.Collection<org.nd4j.linalg.dataset.DataSet>
add
in interface java.util.concurrent.BlockingQueue<org.nd4j.linalg.dataset.DataSet>
add
in interface java.util.Queue<org.nd4j.linalg.dataset.DataSet>
public boolean remove(java.lang.Object o)
remove
in interface java.util.Collection<org.nd4j.linalg.dataset.DataSet>
remove
in interface java.util.concurrent.BlockingQueue<org.nd4j.linalg.dataset.DataSet>
o
- public boolean containsAll(java.util.Collection<?> c)
containsAll
in interface java.util.Collection<org.nd4j.linalg.dataset.DataSet>
c
- public boolean addAll(java.util.Collection<? extends org.nd4j.linalg.dataset.DataSet> c)
addAll
in interface java.util.Collection<org.nd4j.linalg.dataset.DataSet>
public boolean removeAll(java.util.Collection<?> c)
removeAll
in interface java.util.Collection<org.nd4j.linalg.dataset.DataSet>
c
- public boolean retainAll(java.util.Collection<?> c)
retainAll
in interface java.util.Collection<org.nd4j.linalg.dataset.DataSet>
c
- public void clear()
clear
in interface java.util.Collection<org.nd4j.linalg.dataset.DataSet>
public boolean offer(org.nd4j.linalg.dataset.DataSet dataSet)
offer
in interface java.util.concurrent.BlockingQueue<org.nd4j.linalg.dataset.DataSet>
offer
in interface java.util.Queue<org.nd4j.linalg.dataset.DataSet>
public void put(org.nd4j.linalg.dataset.DataSet dataSet) throws java.lang.InterruptedException
put
in interface java.util.concurrent.BlockingQueue<org.nd4j.linalg.dataset.DataSet>
java.lang.InterruptedException
public boolean offer(org.nd4j.linalg.dataset.DataSet dataSet, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
offer
in interface java.util.concurrent.BlockingQueue<org.nd4j.linalg.dataset.DataSet>
java.lang.InterruptedException
public org.nd4j.linalg.dataset.DataSet take() throws java.lang.InterruptedException
take
in interface java.util.concurrent.BlockingQueue<org.nd4j.linalg.dataset.DataSet>
java.lang.InterruptedException
public org.nd4j.linalg.dataset.DataSet remove()
remove
in interface java.util.Queue<org.nd4j.linalg.dataset.DataSet>
public org.nd4j.linalg.dataset.DataSet poll(long time, java.util.concurrent.TimeUnit timeUnit) throws java.lang.InterruptedException
poll
in interface java.util.concurrent.BlockingQueue<org.nd4j.linalg.dataset.DataSet>
time
- time to wait for something appear in queuetimeUnit
- TimeUnit for time paramjava.lang.InterruptedException
public int remainingCapacity()
remainingCapacity
in interface java.util.concurrent.BlockingQueue<org.nd4j.linalg.dataset.DataSet>
public org.nd4j.linalg.dataset.DataSet poll()
poll
in interface java.util.Queue<org.nd4j.linalg.dataset.DataSet>
public org.nd4j.linalg.dataset.DataSet element()
element
in interface java.util.Queue<org.nd4j.linalg.dataset.DataSet>
public org.nd4j.linalg.dataset.DataSet peek()
peek
in interface java.util.Queue<org.nd4j.linalg.dataset.DataSet>