Skip to content

Commit 557229b

Browse files
committed
Merge remote-tracking branch 'ups/develop' into fea/jit/rnn
2 parents 6a7f83d + 6224e61 commit 557229b

File tree

79 files changed

+1943
-359
lines changed

Some content is hidden

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

79 files changed

+1943
-359
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ include(external/eigen) # download eigen3
204204
include(external/pybind11) # download pybind11
205205
include(external/cares)
206206
include(external/cub)
207+
include(external/rocprim)
207208
include(external/xxhash) # download xxhash
208209
include(external/dlpack)
209210
include(external/snappy) # download snappy

Dockerfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,27 @@ ENV HOME /root
2222
# Add bash enhancements
2323
COPY ./paddle/scripts/docker/root/ /root/
2424

25+
# Prepare packages for Python
26+
RUN apt-get update && \
27+
apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
28+
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
29+
xz-utils tk-dev libffi-dev liblzma-dev
30+
31+
# Install Python3.6
32+
RUN mkdir -p /root/python_build/ && wget -q https://www.sqlite.org/2018/sqlite-autoconf-3250300.tar.gz && \
33+
tar -zxf sqlite-autoconf-3250300.tar.gz && cd sqlite-autoconf-3250300 && \
34+
./configure -prefix=/usr/local && make -j8 && make install && cd ../ && rm sqlite-autoconf-3250300.tar.gz && \
35+
wget -q https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz && \
36+
tar -xzf Python-3.6.0.tgz && cd Python-3.6.0 && \
37+
CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \
38+
make -j8 > /dev/null && make altinstall > /dev/null
39+
40+
# Install Python3.7
41+
RUN wget -q https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz && \
42+
tar -xzf Python-3.7.0.tgz && cd Python-3.7.0 && \
43+
CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \
44+
make -j8 > /dev/null && make altinstall > /dev/null
45+
2546
RUN apt-get update && \
2647
apt-get install -y --allow-downgrades patchelf \
2748
python3 python3-dev python3-pip \
@@ -74,6 +95,12 @@ RUN localedef -i en_US -f UTF-8 en_US.UTF-8
7495
RUN pip3 install -U wheel && \
7596
pip3 install -U docopt PyYAML sphinx==1.5.6 && \
7697
pip3 install sphinx-rtd-theme==0.1.9 recommonmark && \
98+
pip3.6 install -U wheel && \
99+
pip3.6 install -U docopt PyYAML sphinx==1.5.6 && \
100+
pip3.6 install sphinx-rtd-theme==0.1.9 recommonmark && \
101+
pip3.7 install -U wheel && \
102+
pip3.7 install -U docopt PyYAML sphinx==1.5.6 && \
103+
pip3.7 install sphinx-rtd-theme==0.1.9 recommonmark && \
77104
easy_install -U pip && \
78105
pip install -U pip setuptools wheel && \
79106
pip install -U docopt PyYAML sphinx==1.5.6 && \
@@ -82,22 +109,34 @@ RUN pip3 install -U wheel && \
82109
RUN pip3 install 'pre-commit==1.10.4' 'ipython==5.3.0' && \
83110
pip3 install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \
84111
pip3 install opencv-python && \
112+
pip3.6 install 'pre-commit==1.10.4' 'ipython==5.3.0' && \
113+
pip3.6 install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \
114+
pip3.6 install opencv-python && \
115+
pip3.7 install 'pre-commit==1.10.4' 'ipython==5.3.0' && \
116+
pip3.7 install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \
117+
pip3.7 install opencv-python && \
85118
pip install 'pre-commit==1.10.4' 'ipython==5.3.0' && \
86119
pip install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \
87120
pip install opencv-python
88121

89122
#For docstring checker
90123
RUN pip3 install pylint pytest astroid isort
124+
RUN pip3.6 install pylint pytest astroid isort
125+
RUN pip3.7 install pylint pytest astroid isort
91126
RUN pip install pylint pytest astroid isort LinkChecker
92127

93128
COPY ./python/requirements.txt /root/
94129
RUN pip3 install -r /root/requirements.txt
130+
RUN pip3.6 install -r /root/requirements.txt
131+
RUN pip3.7 install -r /root/requirements.txt
95132
RUN pip install -r /root/requirements.txt
96133

97134
# To fix https://github.com/PaddlePaddle/Paddle/issues/1954, we use
98135
# the solution in https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl-py2
99136
RUN apt-get install -y libssl-dev libffi-dev
100137
RUN pip3 install certifi urllib3[secure]
138+
RUN pip3.6 install certifi urllib3[secure]
139+
RUN pip3.7 install certifi urllib3[secure]
101140
RUN pip install certifi urllib3[secure]
102141

103142

cmake/external/eigen.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if(WITH_AMD_GPU)
1717
extern_eigen3
1818
${EXTERNAL_PROJECT_LOG_ARGS}
1919
GIT_REPOSITORY "https://github.com/sabreshao/hipeigen.git"
20-
GIT_TAG 0cba03ff9f8f9f70bbd92ac5857b031aa8fed6f9
20+
GIT_TAG 7cb2b6e5a4b4a1efe658abb215cd866c6fb2275e
2121
PREFIX ${EIGEN_SOURCE_DIR}
2222
UPDATE_COMMAND ""
2323
CONFIGURE_COMMAND ""

cmake/external/mkldnn.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ ExternalProject_Add(
5353
${EXTERNAL_PROJECT_LOG_ARGS}
5454
DEPENDS ${MKLDNN_DEPENDS}
5555
GIT_REPOSITORY "https://github.com/01org/mkl-dnn.git"
56-
GIT_TAG "21fb5f2af1dd14e132af4f1b79160977ee487818"
56+
GIT_TAG "830a10059a018cd2634d94195140cf2d8790a75a"
5757
PREFIX ${MKLDNN_SOURCES_DIR}
5858
UPDATE_COMMAND ""
5959
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}

cmake/external/rocprim.cmake

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
if (NOT WITH_AMD_GPU)
2+
return()
3+
endif()
4+
5+
# rocprim is "ROCm Parallel Primitives" for short.
6+
# It is a header-only library providing HIP and HC parallel primitives
7+
# for developing performant GPU-accelerated code on AMD ROCm platform.
8+
9+
if("x${HCC_HOME}" STREQUAL "x")
10+
set(HCC_HOME "/opt/rocm/hcc")
11+
endif()
12+
13+
INCLUDE(ExternalProject)
14+
15+
SET(ROCPRIM_SOURCE_DIR ${THIRD_PARTY_PATH}/rocprim)
16+
SET(ROCPRIM_INSTALL_DIR ${THIRD_PARTY_PATH}/install/rocprim)
17+
SET(ROCPRIM_INCLUDE_DIR ${ROCPRIM_INSTALL_DIR}/include)
18+
19+
ExternalProject_Add(
20+
extern_rocprim
21+
GIT_REPOSITORY "https://github.com/ROCmSoftwarePlatform/rocPRIM.git"
22+
GIT_TAG 5bd41b96ab8d8343330fb2c3e1b96775bde3b3fc
23+
PREFIX ${ROCPRIM_SOURCE_DIR}
24+
UPDATE_COMMAND ""
25+
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${HCC_HOME}/bin/hcc
26+
CMAKE_ARGS -DONLY_INSTALL=ON
27+
CMAKE_ARGS -DBUILD_TEST=OFF
28+
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${ROCPRIM_INSTALL_DIR}
29+
30+
INSTALL_DIR ${ROCPRIM_INSTALL_DIR}
31+
${EXTERNAL_PROJECT_LOG_ARGS}
32+
)
33+
34+
INCLUDE_DIRECTORIES(${ROCPRIM_INCLUDE_DIR})
35+
36+
if (${CMAKE_VERSION} VERSION_LESS "3.3.0")
37+
set(dummyfile ${CMAKE_CURRENT_BINARY_DIR}/rocprim_dummy.c)
38+
file(WRITE ${dummyfile} "const char *dummy_rocprim = \"${dummyfile}\";")
39+
add_library(rocprim STATIC ${dummyfile})
40+
else()
41+
add_library(rocprim INTERFACE)
42+
endif()
43+
44+
add_dependencies(rocprim extern_rocprim)

cmake/flags.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ set(COMMON_FLAGS
129129
-Wno-error=parentheses-equality # Warnings in pybind11
130130
-Wno-error=ignored-attributes # Warnings in Eigen, gcc 6.3
131131
-Wno-error=terminate # Warning in PADDLE_ENFORCE
132+
-Wno-error=int-in-bool-context # Warning in Eigen gcc 7.2
133+
-Wimplicit-fallthrough=0 # Warning in tinyformat.h
134+
-Wno-error=maybe-uninitialized # Warning in boost gcc 7.2
132135
)
133136

134137
set(GPU_COMMON_FLAGS

cmake/generic.cmake

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -454,25 +454,29 @@ function(hip_library TARGET_NAME)
454454
else()
455455
add_library(${TARGET_NAME} STATIC ${_cmake_options} ${_generated_files} ${_sources})
456456
set_target_properties(${TARGET_NAME} PROPERTIES LINKER_LANGUAGE CXX)
457-
target_link_libraries(${TARGET_NAME} /opt/rocm/hip/lib/libhip_hcc.so /opt/rocm/hip/lib/libhip_device.a)
458-
find_fluid_modules(${TARGET_NAME})
457+
target_link_libraries(${TARGET_NAME} /opt/rocm/hip/lib/libhip_hcc.so /opt/rocm/hip/lib/libhip_device.a /opt/rocm/rccl/lib/librccl.so /opt/rocm/hiprand/lib/libhiprand.so)
458+
find_fluid_modules(${TARGET_NAME})
459459
endif()
460-
if (hip_library_DEPS)
461-
add_dependencies(${TARGET_NAME} ${hip_library_DEPS})
462-
target_link_libraries(${TARGET_NAME} ${hip_library_DEPS})
460+
if("${hip_library_DEPS}" MATCHES "ARCHIVE_START")
461+
# Support linking flags: --whole-archive (Linux) / -force_load (MacOS).
462+
# WARNING: Please don't use ARCHIVE_START&ARCHIVE_END if TARGET_NAME will be linked by other libraries.
463+
target_circle_link_libraries(${TARGET_NAME} ${hip_library_DEPS})
464+
list(REMOVE_ITEM hip_library_DEPS ARCHIVE_START ARCHIVE_END)
465+
else()
466+
target_link_libraries(${TARGET_NAME} ${hip_library_DEPS})
463467
endif()
464468
# cpplint code style
465469
foreach(source_file ${hip_library_SRCS})
466-
string(REGEX REPLACE "\\.[^.]*$" "" source ${source_file})
467-
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${source}.h)
468-
list(APPEND hip_library_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/${source}.h)
469-
endif()
470+
string(REGEX REPLACE "\\.[^.]*$" "" source ${source_file})
471+
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${source}.h)
472+
list(APPEND hip_library_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/${source}.h)
473+
endif()
470474
endforeach()
471475
else(hip_library_SRCS)
472476
if (hip_library_DEPS)
473-
merge_static_libs(${TARGET_NAME} ${hip_library_DEPS})
477+
merge_static_libs(${TARGET_NAME} ${hip_library_DEPS})
474478
else()
475-
message(FATAL "Please specify source file or library in nv_library.")
479+
message(FATAL "Please specify source file or library in nv_library.")
476480
endif()
477481
endif(hip_library_SRCS)
478482
endif()

cmake/hip.cmake

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ if(NOT WITH_AMD_GPU)
33
endif()
44

55
include_directories("/opt/rocm/include")
6+
include_directories("/opt/rocm/hip/include")
7+
include_directories("/opt/rocm/miopen/include")
68
include_directories("/opt/rocm/hipblas/include")
79
include_directories("/opt/rocm/hiprand/include")
810
include_directories("/opt/rocm/rocrand/include")
@@ -11,20 +13,40 @@ include_directories("/opt/rocm/thrust")
1113

1214
list(APPEND EXTERNAL_LIBS "-L/opt/rocm/lib/ -lhip_hcc")
1315

14-
set(HIP_HCC_FLAGS "${HIP_HCC_FLAGS} -fPIC -DPADDLE_WITH_HIP -std=c++14" )
16+
set(HIP_HCC_FLAGS "${HIP_HCC_FLAGS} -fPIC -DPADDLE_WITH_HIP -std=c++11" )
1517

1618
if(WITH_DSO)
1719
set(HIP_HCC_FLAGS "${HIP_HCC_FLAGS} -DPADDLE_USE_DSO")
1820
endif(WITH_DSO)
1921

20-
if(WITH_DOUBLE)
21-
set(HIP_HCC_FLAGS "${HIP_HCC_FLAGS} -DPADDLE_TYPE_DOUBLE")
22-
endif(WITH_DOUBLE)
23-
2422
if(WITH_TESTING)
2523
set(HIP_HCC_FLAGS "${HIP_HCC_FLAGS} -DPADDLE_WITH_TESTING")
2624
endif(WITH_TESTING)
2725

26+
if(WITH_DISTRIBUTE)
27+
set(HIP_HCC_FLAGS "${HIP_HCC_FLAGS} -DPADDLE_WITH_DISTRIBUTE")
28+
endif(WITH_DISTRIBUTE)
29+
30+
if(WITH_GRPC)
31+
set(HIP_HCC_FLAGS "${HIP_HCC_FLAGS} -DPADDLE_WITH_GRPC")
32+
endif(WITH_GRPC)
33+
34+
if(NOT WITH_GOLANG)
35+
set(HIP_HCC_FLAGS "${HIP_HCC_FLAGS} -DPADDLE_WITHOUT_GOLANG")
36+
endif(NOT WITH_GOLANG)
37+
38+
if(WITH_MKLDNN)
39+
set(HIP_HCC_FLAGS "${HIP_HCC_FLAGS} -DPADDLE_WITH_MKLDNN")
40+
endif(WITH_MKLDNN)
41+
42+
set(HIP_HCC_FLAGS "${HIP_HCC_FLAGS} -DANY_IMPL_ANY_CAST_MOVEABLE")
43+
44+
if(NOT WITH_RDMA)
45+
set(HIP_HCC_FLAGS "${HIP_HCC_FLAGS} -DPADDLE_DISABLE_RDMA")
46+
endif(NOT WITH_RDMA)
47+
48+
49+
2850
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
2951
list(APPEND HIP_HCC_FLAGS ${CMAKE_CXX_FLAGS_DEBUG})
3052
elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")

cmake/operators.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ function(op_library TARGET)
109109

110110
# Define operators that don't need pybind here.
111111
foreach(manual_pybind_op "compare_op" "logical_op" "nccl_op"
112-
"tensor_array_read_write_op" "tensorrt_engine_op" "conv_fusion_op")
112+
"tensor_array_read_write_op" "tensorrt_engine_op" "conv_fusion_op"
113+
"fusion_transpose_flatten_concat_op")
113114
if ("${TARGET}" STREQUAL "${manual_pybind_op}")
114115
set(pybind_flag 1)
115116
endif()

paddle/fluid/API.spec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ paddle.fluid.layers.hard_shrink ArgSpec(args=['x', 'threshold'], varargs=None, k
276276
paddle.fluid.layers.cumsum ArgSpec(args=['x', 'axis', 'exclusive', 'reverse'], varargs=None, keywords=None, defaults=(None, None, None))
277277
paddle.fluid.layers.thresholded_relu ArgSpec(args=['x', 'threshold'], varargs=None, keywords=None, defaults=(None,))
278278
paddle.fluid.layers.prior_box ArgSpec(args=['input', 'image', 'min_sizes', 'max_sizes', 'aspect_ratios', 'variance', 'flip', 'clip', 'steps', 'offset', 'name', 'min_max_aspect_ratios_order'], varargs=None, keywords=None, defaults=(None, [1.0], [0.1, 0.1, 0.2, 0.2], False, False, [0.0, 0.0], 0.5, None, False))
279-
paddle.fluid.layers.density_prior_box ArgSpec(args=['input', 'image', 'densities', 'fixed_sizes', 'fixed_ratios', 'variance', 'clip', 'steps', 'offset', 'name'], varargs=None, keywords=None, defaults=(None, None, None, [0.1, 0.1, 0.2, 0.2], False, [0.0, 0.0], 0.5, None))
279+
paddle.fluid.layers.density_prior_box ArgSpec(args=['input', 'image', 'densities', 'fixed_sizes', 'fixed_ratios', 'variance', 'clip', 'steps', 'offset', 'flatten_to_2d', 'name'], varargs=None, keywords=None, defaults=(None, None, None, [0.1, 0.1, 0.2, 0.2], False, [0.0, 0.0], 0.5, False, None))
280280
paddle.fluid.layers.multi_box_head ArgSpec(args=['inputs', 'image', 'base_size', 'num_classes', 'aspect_ratios', 'min_ratio', 'max_ratio', 'min_sizes', 'max_sizes', 'steps', 'step_w', 'step_h', 'offset', 'variance', 'flip', 'clip', 'kernel_size', 'pad', 'stride', 'name', 'min_max_aspect_ratios_order'], varargs=None, keywords=None, defaults=(None, None, None, None, None, None, None, 0.5, [0.1, 0.1, 0.2, 0.2], True, False, 1, 0, 1, None, False))
281281
paddle.fluid.layers.bipartite_match ArgSpec(args=['dist_matrix', 'match_type', 'dist_threshold', 'name'], varargs=None, keywords=None, defaults=(None, None, None))
282282
paddle.fluid.layers.target_assign ArgSpec(args=['input', 'matched_indices', 'negative_indices', 'mismatch_value', 'name'], varargs=None, keywords=None, defaults=(None, None, None))
@@ -342,7 +342,7 @@ paddle.fluid.transpiler.RoundRobin.dispatch ArgSpec(args=['self', 'varlist'], va
342342
paddle.fluid.transpiler.RoundRobin.reset ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None)
343343
paddle.fluid.transpiler.DistributeTranspilerConfig.__init__
344344
paddle.fluid.nets.simple_img_conv_pool ArgSpec(args=['input', 'num_filters', 'filter_size', 'pool_size', 'pool_stride', 'pool_padding', 'pool_type', 'global_pooling', 'conv_stride', 'conv_padding', 'conv_dilation', 'conv_groups', 'param_attr', 'bias_attr', 'act', 'use_cudnn'], varargs=None, keywords=None, defaults=(0, 'max', False, 1, 0, 1, 1, None, None, None, True))
345-
paddle.fluid.nets.sequence_conv_pool ArgSpec(args=['input', 'num_filters', 'filter_size', 'param_attr', 'act', 'pool_type'], varargs=None, keywords=None, defaults=(None, 'sigmoid', 'max'))
345+
paddle.fluid.nets.sequence_conv_pool ArgSpec(args=['input', 'num_filters', 'filter_size', 'param_attr', 'act', 'pool_type', 'bias_attr'], varargs=None, keywords=None, defaults=(None, 'sigmoid', 'max', None))
346346
paddle.fluid.nets.glu ArgSpec(args=['input', 'dim'], varargs=None, keywords=None, defaults=(-1,))
347347
paddle.fluid.nets.scaled_dot_product_attention ArgSpec(args=['queries', 'keys', 'values', 'num_heads', 'dropout_rate'], varargs=None, keywords=None, defaults=(1, 0.0))
348348
paddle.fluid.nets.img_conv_group ArgSpec(args=['input', 'conv_num_filter', 'pool_size', 'conv_padding', 'conv_filter_size', 'conv_act', 'param_attr', 'conv_with_batchnorm', 'conv_batchnorm_drop_rate', 'pool_stride', 'pool_type', 'use_cudnn'], varargs=None, keywords=None, defaults=(1, 3, None, None, False, 0.0, 1, 'max', True))

0 commit comments

Comments
 (0)