class AllReduceParameter[T] extends Serializable
Represent parameters stored on the block manager. In distributed optimization, we put parameters on block manager of spark. Each worker syncs parameters through the block manager. Block manager here serves as a parameter server.
A Tensor is sliced into partitionNum chunks and each chunk is assigned to a particular node
(Spark executor). Likewise, gradients for each chunk are also assigned and stored on separate
nodes. In this way, gradient aggregation and parameter updates can be performed independently for
each chunk on separate nodes.
- T
Tensor element type
- Alphabetic
- By Inheritance
- AllReduceParameter
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
AllReduceParameter(id: Long, partitionNum: Int, size: Int, paramOffset: Int = 1, compress: String = "fp16")(implicit arg0: ClassTag[T], ev: TensorNumeric[T])
- id
distinguish from other parameters
- partitionNum
how many partitions will use this parameter
- size
size of the parameter (1D vector)
- paramOffset
start index in the origin parameter.
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
aggregateGradientPartition(avgNumbers: Int): Unit
Retrieve gradients for the slice of the model that this node is responsible for from all the other nodes.
Retrieve gradients for the slice of the model that this node is responsible for from all the other nodes. A new thread is created for each separate node. The gradients are then summed and then stored in decompressed form in
gradientPartition.- avgNumbers
average numbers.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
- val compress: String
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getWeights(localParameter: Tensor[T]): FutureResult[Int]
Use a fixed thread pool to launch a thread for each partition of the weights.
Use a fixed thread pool to launch a thread for each partition of the weights. Each thread requests a partition of the weights from the Spark block manager and copies it into
localParameter.- localParameter
The Tensor that will hold the retrieved weights.
- returns
A FutureResult which contains a Future for each thread.
-
lazy val
gradientPartition: Tensor[T]
Tensor to hold a slice of the global gradients.
Tensor to hold a slice of the global gradients.
- Annotations
- @transient()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
init(parameter: Tensor[T])(implicit ev: TensorNumeric[T]): (Int, Int, Int)
This method should be called on each RDD partition before parameter synchronization begins.
This method should be called on each RDD partition before parameter synchronization begins. An empty gradient tensor is placed in the block manager that can be used to store gradients. A 1 / numPartition fraction of the
parametertensor is copied to the block manager as a compressed tensor.- parameter
A tensor representing the initial underlying weights of this
AllReduceParameter
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- val paramOffset: Int
-
def
putGradients(parameter: Tensor[T]): Unit
Slice gradients learned from this partition of data into chunks, and mark each chunk to be sent to the appropriate parameter node, and put it in the block manager.
Slice gradients learned from this partition of data into chunks, and mark each chunk to be sent to the appropriate parameter node, and put it in the block manager.
- parameter
A Tensor that contains gradients computed on the entire model on a single partition of data.
-
def
sendWeightPartition(): Unit
Put the portion of the weights that this partition is responsible for to the block manager.
Put the portion of the weights that this partition is responsible for to the block manager. Weights are placed locally, then pulled when needed by other partitions.
- val size: Int
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
lazy val
weightPartition: Tensor[T]
Tensor to hold a slice of the global weights.
Tensor to hold a slice of the global weights.
- Annotations
- @transient()