Skip to content

Commit 3d875b6

Browse files
committed
Merge branch 'develop' of github.com:PaddlePaddle/Paddle into overlap_memcpy_with_dist
2 parents f52d78d + d07d953 commit 3d875b6

File tree

87 files changed

+3085
-923
lines changed

Some content is hidden

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

87 files changed

+3085
-923
lines changed

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ option(EIGEN_USE_THREADS "Compile with multi-threaded Eigen" OFF)
6161
option(WITH_ARM_FP16 "Use half precision support on armv8.2-a cpu" OFF)
6262
option(WITH_FAST_BUNDLE_TEST "Bundle tests that can be run in a single process together to reduce launch overhead" OFF)
6363
option(WITH_CONTRIB "Compile the third-party contributation" OFF)
64+
option(WITH_ANAKIN "Compile with Anakin library" OFF)
6465
option(WITH_GRPC "Use grpc as the default rpc framework" ${WITH_DISTRIBUTE})
6566

6667
# CMAKE_BUILD_TYPE
@@ -193,7 +194,10 @@ set(EXTERNAL_LIBS
193194
if(WITH_GPU)
194195
include(cuda)
195196
include(tensorrt)
196-
endif(WITH_GPU)
197+
include(external/anakin)
198+
else()
199+
set(WITH_ANAKIN OFF CACHE STRING "Anakin is valid only when GPU is set." FORCE)
200+
endif()
197201

198202
if(WITH_AMD_GPU)
199203
find_package(HIP)

benchmark/fluid/fluid_benchmark.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def train(avg_loss, infer_prog, optimizer, train_reader, test_reader, batch_acc,
180180
print_train_time(start_time, time.time(), num_samples)
181181
print("Pass: %d, Loss: %f" % (pass_id, np.mean(train_losses))),
182182
# evaluation
183-
if not args.no_test and batch_acc:
183+
if not args.no_test and batch_acc and not args.use_reader_op:
184184
pass_test_acc = test(exe, infer_prog, test_reader, feeder,
185185
batch_acc)
186186
print(", Test Accuracy: %f" % pass_test_acc)
@@ -277,11 +277,12 @@ def train_parallel(avg_loss, infer_prog, optimizer, train_reader, test_reader,
277277
batch_id += 1
278278

279279
print_train_time(start_time, time.time(), num_samples)
280-
if not args.no_test and batch_acc:
280+
if not args.no_test and batch_acc and not args.use_reader_op:
281+
# we have not implement record io for test
282+
# skip test when use args.use_reader_op
281283
test_acc = test(startup_exe, infer_prog, test_reader, feeder,
282284
batch_acc)
283285
print("Pass: %d, Test Accuracy: %f\n" % (pass_id, test_acc))
284-
exit(0)
285286

286287

287288
def print_arguments(args):

benchmark/fluid/models/resnet.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,10 @@ def get_model(args):
199199
batched_train_reader = paddle.batch(
200200
paddle.reader.shuffle(
201201
train_reader, buf_size=5120),
202-
batch_size=args.batch_size * args.gpus)
203-
batched_test_reader = paddle.batch(train_reader, batch_size=args.batch_size)
202+
batch_size=args.batch_size * args.gpus,
203+
drop_last=True)
204+
batched_test_reader = paddle.batch(
205+
train_reader, batch_size=args.batch_size, drop_last=True)
204206

205-
return avg_cost, inference_program, optimizer, batched_train_reader, batched_test_reader, batch_acc
207+
return avg_cost, inference_program, optimizer, batched_train_reader,\
208+
batched_test_reader, batch_acc

cmake/configure.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ endif()
118118
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SIMD_FLAG}")
119119
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SIMD_FLAG}")
120120

121+
if(WITH_DISTRIBUTE)
122+
add_definitions(-DPADDLE_WITH_DISTRIBUTE)
123+
endif()
124+
121125
if(WITH_GOLANG)
122126
# we need to symlink Paddle directory into GOPATH. If we
123127
# don't do it and we have code that depends on Paddle, go

cmake/external/anakin.cmake

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
if (NOT WITH_ANAKIN)
2+
return()
3+
endif()
4+
5+
set(ANAKIN_INSTALL_DIR "${THIRD_PARTY_PATH}/install/anakin" CACHE PATH
6+
"Anakin install path." FORCE)
7+
set(ANAKIN_INCLUDE "${ANAKIN_INSTALL_DIR}" CACHE STRING "root of Anakin header files")
8+
set(ANAKIN_LIBRARY "${ANAKIN_INSTALL_DIR}" CACHE STRING "path of Anakin library")
9+
10+
set(ANAKIN_COMPILE_EXTRA_FLAGS -Wno-error=unused-variable -Wno-error=format-extra-args -Wno-error=comment -Wno-error=format -Wno-error=switch -Wno-error=return-type -Wno-error=non-virtual-dtor -Wno-reorder -Wno-error=cpp)
11+
12+
set(ANAKIN_LIBRARY_URL "https://github.com/pangge/Anakin/releases/download/3.0/anakin_release_simple.tar.gz")
13+
14+
# A helper function used in Anakin, currently, to use it, one need to recursively include
15+
# nearly all the header files.
16+
function(fetch_include_recursively root_dir)
17+
if (IS_DIRECTORY ${root_dir})
18+
include_directories(${root_dir})
19+
endif()
20+
21+
file(GLOB ALL_SUB RELATIVE ${root_dir} ${root_dir}/*)
22+
foreach(sub ${ALL_SUB})
23+
if (IS_DIRECTORY ${root_dir}/${sub})
24+
fetch_include_recursively(${root_dir}/${sub})
25+
endif()
26+
endforeach()
27+
endfunction()
28+
29+
# download library
30+
message(STATUS "Download Anakin library from ${ANAKIN_LIBRARY_URL}")
31+
execute_process(COMMAND bash -c "mkdir -p ${ANAKIN_INSTALL_DIR}")
32+
execute_process(COMMAND bash -c "rm -rf ${ANAKIN_INSTALL_DIR}/*")
33+
execute_process(COMMAND bash -c "cd ${ANAKIN_INSTALL_DIR}; wget -q ${ANAKIN_LIBRARY_URL}")
34+
execute_process(COMMAND bash -c "mkdir -p ${ANAKIN_INSTALL_DIR}")
35+
execute_process(COMMAND bash -c "cd ${ANAKIN_INSTALL_DIR}; tar xzf anakin_release_simple.tar.gz")
36+
37+
if (WITH_ANAKIN)
38+
message(STATUS "Anakin for inference is enabled")
39+
message(STATUS "Anakin is set INCLUDE:${ANAKIN_INCLUDE} LIBRARY:${ANAKIN_LIBRARY}")
40+
fetch_include_recursively(${ANAKIN_INCLUDE})
41+
link_directories(${ANAKIN_LIBRARY})
42+
endif()

doc/fluid/api/detection.rst

Whitespace-only changes.

doc/fluid/api/gen_doc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
python gen_doc.py layers --submodules control_flow device io nn ops tensor > layers.rst
2+
python gen_doc.py layers --submodules control_flow device io nn ops tensor detection learning_rate_scheduler > layers.rst
33

44
for module in data_feeder clip metrics executor initializer io nets optimizer param_attr profiler regularizer
55
do

doc/fluid/api/io.rst

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,3 @@ get_inference_program
5959
.. autofunction:: paddle.fluid.io.get_inference_program
6060
:noindex:
6161

62-
save_checkpoint
63-
---------------
64-
65-
.. autofunction:: paddle.fluid.io.save_checkpoint
66-
:noindex:
67-
68-
load_checkpoint
69-
---------------
70-
71-
.. autofunction:: paddle.fluid.io.load_checkpoint
72-
:noindex:
73-
74-
clean_checkpoint
75-
----------------
76-
77-
.. autofunction:: paddle.fluid.io.clean_checkpoint
78-
:noindex:
79-

doc/fluid/api/layers.rst

Lines changed: 90 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,6 @@ Print
181181
.. autofunction:: paddle.fluid.layers.Print
182182
:noindex:
183183

184-
is_empty
185-
--------
186-
187-
.. autofunction:: paddle.fluid.layers.is_empty
188-
:noindex:
189-
190184
device
191185
======
192186

@@ -261,19 +255,6 @@ double_buffer
261255
.. autofunction:: paddle.fluid.layers.double_buffer
262256
:noindex:
263257

264-
random_data_generator
265-
---------------------
266-
267-
.. autofunction:: paddle.fluid.layers.random_data_generator
268-
:noindex:
269-
270-
Preprocessor
271-
------------
272-
273-
.. autoclass:: paddle.fluid.layers.Preprocessor
274-
:members:
275-
:noindex:
276-
277258
nn
278259
==
279260

@@ -613,30 +594,6 @@ roi_pool
613594
.. autofunction:: paddle.fluid.layers.roi_pool
614595
:noindex:
615596

616-
dice_loss
617-
---------
618-
619-
.. autofunction:: paddle.fluid.layers.dice_loss
620-
:noindex:
621-
622-
resize_bilinear
623-
---------------
624-
625-
.. autofunction:: paddle.fluid.layers.resize_bilinear
626-
:noindex:
627-
628-
gather
629-
------
630-
631-
.. autofunction:: paddle.fluid.layers.gather
632-
:noindex:
633-
634-
random_crop
635-
-----------
636-
637-
.. autofunction:: paddle.fluid.layers.random_crop
638-
:noindex:
639-
640597
ops
641598
===
642599

@@ -784,12 +741,6 @@ sum
784741
.. autofunction:: paddle.fluid.layers.sum
785742
:noindex:
786743

787-
shape
788-
-----
789-
790-
.. autofunction:: paddle.fluid.layers.shape
791-
:noindex:
792-
793744
sigmoid
794745
-------
795746

@@ -1039,3 +990,93 @@ zeros
1039990
.. autofunction:: paddle.fluid.layers.zeros
1040991
:noindex:
1041992

993+
detection
994+
=========
995+
996+
multi_box_head
997+
--------------
998+
999+
.. autofunction:: paddle.fluid.layers.multi_box_head
1000+
:noindex:
1001+
1002+
bipartite_match
1003+
---------------
1004+
1005+
.. autofunction:: paddle.fluid.layers.bipartite_match
1006+
:noindex:
1007+
1008+
target_assign
1009+
-------------
1010+
1011+
.. autofunction:: paddle.fluid.layers.target_assign
1012+
:noindex:
1013+
1014+
detection_output
1015+
----------------
1016+
1017+
.. autofunction:: paddle.fluid.layers.detection_output
1018+
:noindex:
1019+
1020+
ssd_loss
1021+
--------
1022+
1023+
.. autofunction:: paddle.fluid.layers.ssd_loss
1024+
:noindex:
1025+
1026+
detection_map
1027+
-------------
1028+
1029+
.. autofunction:: paddle.fluid.layers.detection_map
1030+
:noindex:
1031+
1032+
iou_similarity
1033+
--------------
1034+
1035+
.. autofunction:: paddle.fluid.layers.iou_similarity
1036+
:noindex:
1037+
1038+
box_coder
1039+
---------
1040+
1041+
.. autofunction:: paddle.fluid.layers.box_coder
1042+
:noindex:
1043+
1044+
learning_rate_scheduler
1045+
=======================
1046+
1047+
exponential_decay
1048+
-----------------
1049+
1050+
.. autofunction:: paddle.fluid.layers.exponential_decay
1051+
:noindex:
1052+
1053+
natural_exp_decay
1054+
-----------------
1055+
1056+
.. autofunction:: paddle.fluid.layers.natural_exp_decay
1057+
:noindex:
1058+
1059+
inverse_time_decay
1060+
------------------
1061+
1062+
.. autofunction:: paddle.fluid.layers.inverse_time_decay
1063+
:noindex:
1064+
1065+
polynomial_decay
1066+
----------------
1067+
1068+
.. autofunction:: paddle.fluid.layers.polynomial_decay
1069+
:noindex:
1070+
1071+
piecewise_decay
1072+
---------------
1073+
1074+
.. autofunction:: paddle.fluid.layers.piecewise_decay
1075+
:noindex:
1076+
1077+
noam_decay
1078+
----------
1079+
1080+
.. autofunction:: paddle.fluid.layers.noam_decay
1081+
:noindex:
1082+

doc/fluid/api/optimizer.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,6 @@ DecayedAdagradOptimizer
8989
:members:
9090
:noindex:
9191

92-
RMSPropOptimizer
93-
----------------
94-
95-
.. autoclass:: paddle.fluid.optimizer.RMSPropOptimizer
96-
:members:
97-
:noindex:
98-
9992
Adadelta
10093
--------
10194

0 commit comments

Comments
 (0)