Skip to content

Commit 35b5aa1

Browse files
author
Helin Wang
committed
fix grammar, update illustration
1 parent d41b402 commit 35b5aa1

File tree

4 files changed

+21
-22
lines changed

4 files changed

+21
-22
lines changed

doc/design/dist/README.md

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,17 @@ Their relation is illustrated in the following graph:
2727

2828
The master process will:
2929

30-
- Shard dataset into [tasks](#task) and dispatch tasks to trainers.
30+
- Partition a dataset into [tasks](#task) and dispatch tasks to trainers.
3131
- Keep track of training progress on the dataset with [task queue](#task-queue). A training job will iterate on the dataset for a full pass until it goes into next pass.
3232

33-
Now we will explain the concepts mentioned above:
3433

3534
#### Task
3635

37-
A task is a piece of sharded data to be trained. The total number of tasks will be much bigger than the total number of trainers. The number of data instances inside a task will be much bigger than the mini-batch size.
36+
A task is a data shard to be trained. The total number of tasks will be much bigger than the total number of trainers. The number of data instances inside a task will be much bigger than the mini-batch size.
3837

3938
#### Task Queue
4039

41-
Master process has three task queues to track training progress. As illustrated in the graph below, Job A and Job B both have one master process. Each master process has three task queues.
40+
The master process has three task queues to track training progress. As illustrated in the graph below, Job A and Job B both have one master process. Each master process has three task queues.
4241

4342
<img src="src/paddle-task-queues.png"/>
4443

@@ -52,20 +51,20 @@ The life cycle of a single task is illustrated below:
5251

5352
1. When a new pass of training starts, all tasks will be placed in the todo queue.
5453
1. The master process will dispatch few tasks to each trainer at a time, puts them in the pending queue and waits for completion.
55-
1. The trainer will work on it's tasks and tell the master process once a task is completed. The master process will dispatch a new task to that trainer.
56-
1. If a task timeout. the master process will move it back to the todo queue. The timeout count will increase by one. If the timeout count is above an threashold, the task is likely to cause a trainer to crash, so it will be discarded.
57-
1. The master process will move completed task to the done queue. When the todo queue is empty, the master process will start a new pass by moving all tasks in the done queue to todo queue and resetting the timeout counter of all tasks to zero.
54+
1. The trainer will work on its tasks and tell the master process once a task is completed. The master process will dispatch a new task to that trainer.
55+
1. If a task timeout. the master process will move it back to the todo queue. The timeout count will increase by one. If the timeout count is above a threshold, the task is likely to cause a trainer to crash, so it will be discarded.
56+
1. The master process will move completed task to the done queue. When the todo queue is empty, the master process will start a new pass by moving all tasks in the done queue to todo queue and reset the timeout counter of all tasks to zero.
5857

5958
### Trainer Process
6059

6160
The trainer process will:
6261

63-
- Receive the tasks from the master.
64-
- Work on the tasks: alculate and upload gradient to the parameter servers, and update local model by downloading new parameters from the parameter servers.
62+
- Receive tasks from the master.
63+
- Work on the tasks: calculate and upload gradient to parameter servers, and update local model by downloading new parameters from parameter servers.
6564

6665
### Parameter Server Process
6766

68-
Parameter server processes hold the parameters collabratively. The parameters are sharded on different parameter servers.
67+
Parameter server processes hold the parameters collaboratively. The parameters are partitioned on different parameter servers.
6968

7069
The parameter server will:
7170

@@ -76,21 +75,21 @@ The parameter server will:
7675

7776
The communication pattern between the trainers and the parameter servers depends on the category of optimization algorithm:
7877

79-
- Synchronous Stochastic Gradient Decent (sync-SGD)
78+
- Synchronous Stochastic Gradient Descent (sync-SGD)
8079

8180
Parameter server will wait for all trainer finish n-th mini-batch calculation and send their gradients before broadcasting new parameters to every trainer. Every trainer will wait for the new parameters before starting n+1-th mini-batch.
8281

83-
- Asynchronous Stochastic Gradient Decent (async-SGD)
82+
- Asynchronous Stochastic Gradient Descent (async-SGD)
8483

8584
There will no synchronization between different trainers, and parameter server updates its parameter as soon as it receives new gradient:
8685

87-
- Each trainer uploads its accumulated gradient every **n** mini-batches.
88-
- Every **m** mini-batches, the trainer downloads new parameters from parameter server.
89-
- **n** and **m** do not have to be equal.
86+
- Each trainer uploads its accumulated gradient every n mini-batches.
87+
- Every m mini-batches, the trainer downloads new parameters from parameter server.
88+
- n and m do not have to be equal.
9089

9190
## Fault Tolerant
9291

93-
The training job will pause if the master process is dead, or any of the parameter server process is dead. They will be started by [Kubernetes](https://kubernetes.io/) and recover in few minutes. Please refer to [fault recovery](#fault-recovery).
92+
The training job will pause if the master processes is dead, or any of the parameter server process is dead. They will be started by [Kubernetes](https://kubernetes.io/) and recover in few minutes. Please refer to [fault recovery](#fault-recovery).
9493

9594
The training job will continue to make progress if there is at least one training process running. The strategy depends on the type of optimization algorithm:
9695

@@ -104,9 +103,9 @@ The training job will continue to make progress if there is at least one trainin
104103

105104
## Fault Recovery
106105

107-
PaddlePaddle uses [etcd](https://github.com/coreos/etcd) to keep track of the states of processes. Because etcd is a distributed reliable key-value store, the restarted process can recover its states from etcd. The model parameter are periodically saved into distributed file system, so a restarted parameter server can recover its parameters from the saved file.
106+
PaddlePaddle uses [etcd](https://github.com/coreos/etcd) to keep track of the states of processes. Because etcd is a distributed reliable key-value store, the restarted process can recover its states from etcd. The model parameters are periodically saved into distributed file system, so a restarted parameter server can recover its parameters from the saved file.
108107

109-
Now we will introduce how each process recovers from failure, the graph below provides an illustration:
108+
Now we will introduce how each process recovers from a failure, the graph below shows how etcd is used:
110109

111110
<img src="src/paddle-etcd.png"/>
112111

@@ -115,7 +114,7 @@ Now we will introduce how each process recovers from failure, the graph below pr
115114
When the master is started by the Kubernetes, it executes the following steps at startup:
116115

117116
1. Grabs a unique *master* lock in etcd, which prevents concurrent master instantiations.
118-
1. Recovers the task queues from etcd if they already exists, otherwise the master will create them.
117+
1. Recovers the task queues from etcd if they already exist, otherwise, the master will create them.
119118
1. Watches the trainer prefix keys `/trainer/` on etcd to find the live trainers.
120119
1. Starts dispatching the tasks to the trainers.
121120

@@ -127,8 +126,8 @@ When the master process is dead for any reason, Kubernetes will restart it. It w
127126

128127
When the trainer is started by the Kubernetes, it executes the following steps at startup:
129128

130-
1. Watches the available parameter server prefix keys `/ps/` on etcd and waits until count of parameter servers reaches the desired count.
131-
1. Generates an unique ID, and sets key `/trainer/<unique ID>` with its contact address as value. The key will be deleted when the lease expires, so the master will be aware of the trainer being online and offline.
129+
1. Watches the available parameter server prefix keys `/ps/` on etcd and waits until the count of parameter servers reaches the desired count.
130+
1. Generates a unique ID, and sets key `/trainer/<unique ID>` with its contact address as value. The key will be deleted when the lease expires, so the master will be aware of the trainer being online and offline.
132131
1. Waits for tasks from the master to start training.
133132

134133
If trainer's etcd lease expires, it will try set key `/trainer/<unique ID>` again so that the master process can discover the trainer again.
@@ -138,7 +137,7 @@ If trainer's etcd lease expires, it will try set key `/trainer/<unique ID>` agai
138137
When the parameter server is started by Kubernetes, it executes the following steps at startup:
139138

140139
1. Read desired total number of parameter servers from etcd `/ps_desired`
141-
1. Search though etcd keys `/ps/<index>` (`/ps/0`, `/ps/1`, ...) to find the first non-existant key whose index is smaller than the total number of parameter servers. Set the key using a transaction to avoid concurrent writes. The parameter server's index is inferred from the key name.
140+
1. Search through etcd keys `/ps/<index>` (`/ps/0`, `/ps/1`, ...) to find the first non-existant key whose index is smaller than the total number of parameter servers. Set the key using a transaction to avoid concurrent writes. The parameter server's index is inferred from the key name.
142141

143142
The desired number of parameter servers is 3:
144143

2.01 KB
Loading
3 KB
Loading
20 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)