public final class ModelParameterServer extends Object
| Modifier and Type | Field and Description |
|---|---|
protected VoidConfiguration |
configuration |
protected org.nd4j.common.primitives.AtomicBoolean |
gotFinalState |
protected static ModelParameterServer |
INSTANCE |
protected List<org.reactivestreams.Subscriber<org.nd4j.linalg.api.ndarray.INDArray>> |
modelParamsSubsribers |
protected org.nd4j.common.primitives.Atomic<UpdaterParametersHolder> |
updaterParameters |
protected ReentrantReadWriteLock |
updaterParamsLock |
protected List<org.reactivestreams.Subscriber<org.nd4j.linalg.api.ndarray.INDArray>> |
updaterParamsSubscribers |
protected BlockingQueue<org.nd4j.linalg.api.ndarray.INDArray> |
updatesBacklog |
protected List<UpdatesHandler> |
updatesSubscribers |
| Modifier | Constructor and Description |
|---|---|
protected |
ModelParameterServer() |
protected |
ModelParameterServer(@NonNull Transport transport)
This constructor is for tests only
|
protected |
ModelParameterServer(@NonNull Transport transport,
boolean isMasterNode)
This constructor is for tests only
|
|
ModelParameterServer(@NonNull VoidConfiguration configuration,
@NonNull Transport transport,
boolean isMasterNode)
This constructor creates new ModelParameterServer instance
|
| Modifier and Type | Method and Description |
|---|---|
void |
addModelParamsSubscriber(@NonNull org.reactivestreams.Subscriber<org.nd4j.linalg.api.ndarray.INDArray> s)
This method adds subcriber that will be called upon model params receival
|
void |
addUpdaterParamsSubscriber(@NonNull org.reactivestreams.Subscriber<org.nd4j.linalg.api.ndarray.INDArray> s)
This method adds subcriber that will be called upon updater params receival
|
void |
addUpdatesSubscriber(@NonNull UpdatesHandler s)
This method adds subcriber that will be called upon gradients update receival
|
void |
configure(@NonNull VoidConfiguration configuration,
@NonNull Transport transport,
boolean isMasterNode)
This method stores provided entities for MPS internal use
|
void |
configure(@NonNull VoidConfiguration configuration,
@NonNull Transport transport,
@NonNull UpdaterParametersProvider updaterProvider)
This method stores provided entities for MPS internal use
|
static ModelParameterServer |
getInstance() |
org.nd4j.common.primitives.Pair<Integer,Integer> |
getStartPosition()
This method returns pair of integers: iteration number and epoch number
|
Collection<org.nd4j.linalg.api.ndarray.INDArray> |
getUpdates()
This method returns updates received from network
|
boolean |
isInitialized()
This method checks if ModelParameterServer was initialized
|
void |
launch()
This method starts parameter server
|
void |
sendUpdate(@NonNull org.nd4j.linalg.api.ndarray.INDArray array)
This method sends gradient updates to the cluster
|
void |
sendUpdate(@NonNull org.nd4j.linalg.api.ndarray.INDArray array,
int iteration,
int epoch) |
void |
shutdown()
This method stops parameter server
|
protected static final ModelParameterServer INSTANCE
protected final List<UpdatesHandler> updatesSubscribers
protected final List<org.reactivestreams.Subscriber<org.nd4j.linalg.api.ndarray.INDArray>> modelParamsSubsribers
protected final List<org.reactivestreams.Subscriber<org.nd4j.linalg.api.ndarray.INDArray>> updaterParamsSubscribers
protected VoidConfiguration configuration
protected BlockingQueue<org.nd4j.linalg.api.ndarray.INDArray> updatesBacklog
protected final org.nd4j.common.primitives.Atomic<UpdaterParametersHolder> updaterParameters
protected final ReentrantReadWriteLock updaterParamsLock
protected final org.nd4j.common.primitives.AtomicBoolean gotFinalState
protected ModelParameterServer()
protected ModelParameterServer(@NonNull
@NonNull Transport transport)
transport - protected ModelParameterServer(@NonNull
@NonNull Transport transport,
boolean isMasterNode)
transport - isMasterNode - public ModelParameterServer(@NonNull
@NonNull VoidConfiguration configuration,
@NonNull
@NonNull Transport transport,
boolean isMasterNode)
configuration - VoidConfiguration beantransport - Transport instance to be used for communicationsisMasterNode - set to true if this parameter server instance will be a master node, false otherwisepublic static ModelParameterServer getInstance()
public void configure(@NonNull
@NonNull VoidConfiguration configuration,
@NonNull
@NonNull Transport transport,
boolean isMasterNode)
configuration - transport - isMasterNode - public void configure(@NonNull
@NonNull VoidConfiguration configuration,
@NonNull
@NonNull Transport transport,
@NonNull
@NonNull UpdaterParametersProvider updaterProvider)
configuration - transport - isMasterNode - public void addUpdatesSubscriber(@NonNull
@NonNull UpdatesHandler s)
s - public void addModelParamsSubscriber(@NonNull
@NonNull org.reactivestreams.Subscriber<org.nd4j.linalg.api.ndarray.INDArray> s)
s - public void addUpdaterParamsSubscriber(@NonNull
@NonNull org.reactivestreams.Subscriber<org.nd4j.linalg.api.ndarray.INDArray> s)
s - public boolean isInitialized()
public org.nd4j.common.primitives.Pair<Integer,Integer> getStartPosition()
public void launch()
public void shutdown()
public void sendUpdate(@NonNull
@NonNull org.nd4j.linalg.api.ndarray.INDArray array,
int iteration,
int epoch)
public void sendUpdate(@NonNull
@NonNull org.nd4j.linalg.api.ndarray.INDArray array)
public Collection<org.nd4j.linalg.api.ndarray.INDArray> getUpdates()
Copyright © 2021. All rights reserved.