Skip to content

Commit a459764

Browse files
committed
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into fix_fetchop
2 parents 6f306f0 + 22ab14c commit a459764

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1310
-276
lines changed

benchmark/cluster/vgg16/vgg16_fluid.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ def str2bool(v):
8080
type=str,
8181
default="",
8282
help="Comma-separated list of hostname:port pairs")
83+
parser.add_argument(
84+
"--profile", action='store_true', help="If set, profile a few steps.")
8385

8486
# Flags for defining the tf.train.Server
8587
parser.add_argument(
@@ -183,8 +185,8 @@ def train_loop(exe, trainer_prog):
183185
start_time = time.time()
184186
num_samples = 0
185187
train_pass_acc.reset()
186-
for batch_id, data in enumerate(train_reader()):
187-
ts = time.time()
188+
189+
def run_step(batch_id, data):
188190
img_data = np.array(
189191
map(lambda x: x[0].reshape(data_shape), data)).astype(
190192
"float32")
@@ -196,14 +198,28 @@ def train_loop(exe, trainer_prog):
196198
feed={"pixel": img_data,
197199
"label": y_data},
198200
fetch_list=[avg_cost, batch_acc, batch_size])
201+
return loss, acc, b_size
202+
203+
if args.profile and args.task_index == 0:
204+
# warmup.
205+
for batch_id, data in enumerate(train_reader()):
206+
if batch_id > 5: break
207+
run_step(batch_id, data)
208+
with profiler.profiler('All', 'total', '/tmp/profile_vgg'):
209+
for batch_id, data in enumerate(train_reader()):
210+
if batch_id > 5: break
211+
run_step(batch_id, data)
212+
213+
for batch_id, data in enumerate(train_reader()):
214+
ts = time.time()
215+
loss, acc, b_size = run_step(batch_id, data)
199216
iters += 1
200217
num_samples += len(data)
201218
train_pass_acc.add(value=acc, weight=b_size)
202219
print(
203-
"Task:%d Pass = %d, Iters = %d, Loss = %f, Accuracy = %f, "
204-
"Speed = %.2f img/s " % (args.task_index, pass_id, iters,
205-
loss, acc,
206-
len(data) / (time.time() - ts))
220+
"Pass = %d, Iters = %d, Loss = %f, Accuracy = %f, "
221+
"Speed = %.2f img/s" % (pass_id, iters, loss, acc,
222+
len(data) / (time.time() - ts))
207223
) # The accuracy is the accumulation of batches, but not the current batch.
208224

209225
pass_elapsed = time.time() - start_time

contrib/float16/float16_inference_report.md renamed to contrib/float16/README.md

Lines changed: 38 additions & 30 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../v2/build_and_install/paddleci.png

doc/fluid/design/motivation/refactorization.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ Compile Time -> IR -> Runtime
125125
126126
## Operator/OpWithKernel/OpKernel
127127
128-
![class_diagram](http://api.paddlepaddle.org/graphviz?dot=https://gist.githubusercontent.com/reyoung/53df507f6749762675dff3e7ce53372f/raw/49caf1fb70820fb4a6c217634317c9306f361f36/op_op_with_kern_class_diagram.dot)
128+
![class_diagram](https://raw.githubusercontent.com/PaddlePaddle/Paddle/develop/doc/fluid/images/op_op_with_kern_class_diagram.dot)
129129
130130
---
131131
132132
## Operator
133-
![class_diagram](http://api.paddlepaddle.org/graphviz?dot=https://gist.githubusercontent.com/reyoung/53df507f6749762675dff3e7ce53372f/raw/dd598e8f1976f5759f58af5e5ef94738a6b2e661/op.dot)
133+
![class_diagram](https://raw.githubusercontent.com/PaddlePaddle/Paddle/develop/doc/fluid/images/op.dot)
134134
135135
* `Operator` is the fundamental building block of the user interface.
136136
* Operator stores input/output variable names and attributes.
@@ -141,7 +141,7 @@ Compile Time -> IR -> Runtime
141141
142142
## OpWithKernel/Kernel
143143
144-
![class_diagram](http://api.paddlepaddle.org/graphviz?dot=https://gist.githubusercontent.com/reyoung/53df507f6749762675dff3e7ce53372f/raw/9d7f4eba185cf41c8e2fbfb40ae21890dbddcd39/op_with_kernel.dot)
144+
![class_diagram](https://raw.githubusercontent.com/PaddlePaddle/Paddle/develop/doc/fluid/images/op_with_kernel.dot)
145145
146146
* `OpWithKernel` inherits `Operator`.
147147
* `OpWithKernel` contains a Kernel map.

doc/fluid/images/op.dot

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
digraph sample {
2+
graph [rankdir=TD]; node [shape=record];
3+
op [label="{Operator| InferShape()=0\lRun()=0\l | map<string, string[]> inputs_\lmap<string, string[]> outputs_ \l AttributeMap attrs_\l}"];
4+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
digraph sample {
2+
graph [rankdir=TD]; node [shape=record];
3+
op [label="{Operator| InferShape()=0\lRun()=0\l | map<string, string[]> inputs_\lmap<string, string[]> outputs_ \l AttributeMap attrs_\l}"];
4+
op_with_kern [label="{OpWithKernel | InferShape()=0\lRun()\l | map<OpKernelKey,OpKernel>kernels_ }"]
5+
op_kernel [label="{OpKernel | Compute()=0}"]
6+
op_kernel_key [label="{OpKernelKey| Place place\n...}"]
7+
8+
op -> op_with_kern [dir=back, arrowtail=onormal]
9+
op_with_kern -> op_kernel [arrowhead=vee, label="contains many"]
10+
11+
{
12+
rank=same;
13+
op_with_kern
14+
op_kernel
15+
}
16+
17+
op_kernel -> op_kernel_key [style=invis]
18+
19+
{
20+
rank=same;
21+
op_kernel
22+
op_kernel_key
23+
}
24+
25+
op_with_kern -> op_kernel_key [arrowhead=vee, label ="\nas map key"]
26+
27+
mul_op [label="MulOp"]
28+
op_with_kern -> mul_op [dir=back, arrowtail=onormal]
29+
mul_kernel [label="template <typename Place>\lclass MulOpKernel\l"]
30+
op_kernel -> mul_kernel [dir=back, arrowtail=onormal]
31+
mul_op -> mul_kernel [arrowhead=vee, label="register many"]
32+
33+
{
34+
rank=same;
35+
mul_op;
36+
mul_kernel;
37+
}
38+
}

doc/fluid/images/op_with_kernel.dot

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
digraph sample {
2+
graph [rankdir=TD]; node [shape=record];
3+
op [label="{Operator}"];
4+
op_with_kern [label="{OpWithKernel | InferShape()=0\lRun()\l | map<OpKernelKey,OpKernel>kernels_ }"]
5+
op_kernel [label="{OpKernel | Compute()=0}"]
6+
op_kernel_key [label="{OpKernelKey| Place place\n...}"]
7+
8+
op -> op_with_kern [dir=back, arrowtail=onormal]
9+
op_with_kern -> op_kernel [arrowhead=vee, label="contains many"]
10+
11+
{
12+
rank=same;
13+
op_with_kern
14+
op_kernel
15+
}
16+
17+
op_kernel -> op_kernel_key [style=invis]
18+
19+
{
20+
rank=same;
21+
op_kernel
22+
op_kernel_key
23+
}
24+
25+
op_with_kern -> op_kernel_key [arrowhead=vee, label ="\nas map key"]
26+
}

doc/v2/api/config/layer.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ gated_unit
142142
-----------
143143
.. autoclass:: paddle.v2.layer.gated_unit
144144
:noindex:
145-
145+
146146
Recurrent Layer Group
147147
=====================
148148

@@ -354,7 +354,7 @@ dropout
354354
--------
355355
.. autoclass:: paddle.v2.layer.dropout
356356
:noindex:
357-
357+
358358
dot_prod
359359
---------
360360
.. autoclass:: paddle.v2.layer.dot_prod
@@ -460,6 +460,11 @@ multi_binary_label_cross_entropy_cost
460460
.. autoclass:: paddle.v2.layer.multi_binary_label_cross_entropy_cost
461461
:noindex:
462462

463+
classification_cost
464+
-------------------
465+
.. autoclass:: paddle.v2.layer.classification_cost
466+
:noindex:
467+
463468
huber_regression_cost
464469
-------------------------
465470
.. autoclass:: paddle.v2.layer.huber_regression_cost
@@ -534,7 +539,7 @@ detection_output
534539
----------------
535540
.. autoclass:: paddle.v2.layer.detection_output
536541
:noindex:
537-
542+
538543
Check Layer
539544
============
540545

doc/v2/howto/cluster/multi_cluster/k8s_distributed_en.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Training docker image needs to package the paddle pserver and paddle trainer run
4141
- Generating the initialization arguments for `Paddle PServer` and `Paddle Training` processes.
4242

4343
Since the paddlepaddle official docker image already has the runtimes we need, we'll take it as the base image and pack some additional scripts for the processes mentioned above to build our training image. for more detail, please find from the following link:
44-
- https://github.com/PaddlePaddle/Paddle/blob/develop/doc/howto/usage/cluster/src/k8s_train/Dockerfile
44+
- https://github.com/PaddlePaddle/Paddle/tree/develop/doc/v2/howto/cluster/multi_cluster/src/k8s_train/Dockerfile
4545

4646

4747
```bash
@@ -62,7 +62,7 @@ represent the Docker Image which built in this step.
6262
### Prepare Training Data
6363

6464
We can download and split the training job by creating a Kubernetes Job, or custom your image
65-
by editing [k8s_train](./src/k8s_train/).
65+
by editing [k8s_train](https://github.com/PaddlePaddle/Paddle/tree/develop/doc/v2/howto/cluster/multi_cluster/src/k8s_train).
6666

6767
Before creating a Job, we need to bind a [persistenVolumeClaim](https://kubernetes.io/docs/user-guide/persistent-volumes) by the different type of
6868
the different file system, the generated dataset would be saved on this volume.

paddle/fluid/framework/executor.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,12 @@ void Executor::RunPreparedContext(ExecutorPrepareContext* ctx, Scope* scope,
348348
}
349349
}
350350
}
351+
platform::DeviceContextPool::Instance().Get(place_)->Wait();
351352
if (create_vars && create_local_scope) {
352353
scope->DeleteScope(local_scope);
354+
} else {
355+
// Delete the local scopes created in operators.
356+
scope->DropKids();
353357
}
354358
if (FLAGS_benchmark) {
355359
VLOG(2) << "-------------------------------------------------------";

0 commit comments

Comments
 (0)