利用MapReduse进行同步并行梯度计算
什么是MapReduce
MapReduce is a programming model and software system developedby Google [1].
Characters: client-server architecture, message-passing communication,and bulk synchronous parallel.
Apache Hadoop[2]: is an open-source implementation of MapReduce.
Apache Spark [3]: is an improved open-source MapReduce.
Reference
1.Dean and Ghemawat: MapReduce: simplified data processing on large clusters. Communications of the ACM, 2008.
3.Zaharia and others: Apache Spark: a unified engine for big data processing. Communications of the ACM, 2016.
Parallel Gradient Descent Using MapReduce
利用MapReduse进行同步并行梯度计算的步骤
Broadcast广播: Server broadcast the up-to-date parameters to workers.
Map(不需要通信): Workers do computation locally.
Map to 将数据映射到向量g上
Obtain vectors:
Reduce: Compute the sum:
Every worker sums all the {} stored in its local memory to get a vector
Then, the server sums the resulting vectors(there are m wokers)
Server updates the parameters:
一直重复直到算法收敛
Every worker stores of the data
Every worker does of the computation
Is the runtime reduce to ?
No. Because communication and synchronization must be considered
Communication Cost 通信开销
Communication complexity通信复杂度:How many words are transmitted between server and workers
Proportional to number of parameters
Grow eith number of worker nodes
Latency: How much time it takes for a packet of data to get from onepoint to another.(Determined by the compute network.)
Communication time: complexity/bandwith + latency
Synchronization Cost 同步开销:
Question: What if a node fails and then restart?
This node will be much slower than all the others.
It is called straggler.
Straggler effect:
The wall-clock time is determined by the slowest node.
It is a consequence of synchronization.
总结 Recap:
Gradient descent can be implemented using MapReduce.
Data parallelism: Data are partitioned among the workers
One gradient descent step requires a broadcast, a map, and areduce.
Cost: computation, communication, and synchronization.
Using m workers, the speedup ratio is lower than m