Skip to content

Commit

Permalink
Merge branch 'develop' into historgram
Browse files Browse the repository at this point in the history
  • Loading branch information
TBD1 authored Sep 8, 2023
2 parents aaabf00 + ad0e7a2 commit a9d4482
Show file tree
Hide file tree
Showing 3,011 changed files with 42,966 additions and 28,496 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
28 changes: 14 additions & 14 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ bugprone-exception-escape,
-bugprone-fold-init-type,
-bugprone-forwarding-reference-overload,
-bugprone-inaccurate-erase,
-bugprone-incorrect-roundings,
bugprone-incorrect-roundings,
-bugprone-infinite-loop,
bugprone-integer-division,
-bugprone-macro-repeated-side-effects,
Expand All @@ -24,15 +24,15 @@ bugprone-misplaced-widening-cast,
-bugprone-not-null-terminated-result,
-bugprone-parent-virtual-call,
-bugprone-posix-return,
-bugprone-signed-char-misuse,
bugprone-signed-char-misuse,
-bugprone-sizeof-container,
-bugprone-sizeof-expression,
-bugprone-string-constructor,
-bugprone-string-integer-assignment,
-bugprone-string-literal-with-embedded-nul,
-bugprone-suspicious-enum-usage,
-bugprone-suspicious-memset-usage,
-bugprone-suspicious-missing-comma,
bugprone-suspicious-missing-comma,
-bugprone-suspicious-semicolon,
-bugprone-suspicious-string-compare,
-bugprone-terminating-continue,
Expand All @@ -42,18 +42,18 @@ bugprone-misplaced-widening-cast,
-bugprone-undelegated-constructor,
bugprone-unhandled-self-assignment,
bugprone-unused-raii,
-bugprone-unused-return-value,
bugprone-unused-return-value,
bugprone-use-after-move,
-bugprone-virtual-near-miss,
-clang-analyzer-apiModeling.StdCLibraryFunctions,
-clang-analyzer-apiModeling.TrustNonnull,
-clang-analyzer-apiModeling.google.GTest,
-clang-analyzer-apiModeling.llvm.CastValue,
-clang-analyzer-apiModeling.llvm.ReturnValue,
-clang-analyzer-core.CallAndMessage,
clang-analyzer-core.CallAndMessage,
-clang-analyzer-core.DivideZero,
-clang-analyzer-core.DynamicTypePropagation,
-clang-analyzer-core.NonNullParamChecker,
clang-analyzer-core.NonNullParamChecker,
-clang-analyzer-core.NonnilStringConstants,
-clang-analyzer-core.NullDereference,
-clang-analyzer-core.StackAddrEscapeBase,
Expand Down Expand Up @@ -83,15 +83,15 @@ clang-analyzer-cplusplus.InnerPointer,
-clang-analyzer-nullability.NullableDereferenced,
-clang-analyzer-nullability.NullablePassedToNonnull,
-clang-analyzer-nullability.NullableReturnedFromNonnull,
-clang-analyzer-optin.cplusplus.UninitializedObject,
clang-analyzer-optin.cplusplus.UninitializedObject,
-clang-analyzer-optin.cplusplus.VirtualCall,
-clang-analyzer-optin.mpi.MPI-Checker,
-clang-analyzer-optin.osx.OSObjectCStyleCast,
-clang-analyzer-optin.osx.cocoa.localizability.EmptyLocalizationContextChecker,
-clang-analyzer-optin.osx.cocoa.localizability.NonLocalizedStringChecker,
-clang-analyzer-optin.performance.GCDAntipattern,
-clang-analyzer-optin.performance.Padding,
-clang-analyzer-optin.portability.UnixAPI,
clang-analyzer-optin.portability.UnixAPI,
-clang-analyzer-osx.API,
-clang-analyzer-osx.MIG,
-clang-analyzer-osx.NSOrCFErrorDerefChecker,
Expand Down Expand Up @@ -154,23 +154,23 @@ clang-analyzer-unix.Vfork,
cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-goto,
cppcoreguidelines-c-copy-assignment-signature,
-cppcoreguidelines-explicit-virtual-functions,
cppcoreguidelines-explicit-virtual-functions,
-cppcoreguidelines-init-variables,
-cppcoreguidelines-narrowing-conversions,
-cppcoreguidelines-no-malloc,
-cppcoreguidelines-pro-type-const-cast,
-cppcoreguidelines-pro-type-member-init,
-cppcoreguidelines-slicing,
-hicpp-avoid-goto,
-hicpp-exception-baseclass,
hicpp-exception-baseclass,
misc-unused-alias-decls,
misc-unused-using-decls,
modernize-avoid-bind,
modernize-avoid-c-arrays,
-modernize-deprecated-headers,
modernize-deprecated-headers,
-modernize-deprecated-ios-base-aliases,
modernize-loop-convert,
-modernize-make-shared,
modernize-make-shared,
modernize-make-unique,
-modernize-pass-by-value,
modernize-raw-string-literal,
Expand All @@ -186,7 +186,7 @@ modernize-use-equals-default,
-modernize-use-noexcept,
modernize-use-nullptr,
modernize-use-override,
-modernize-use-transparent-functors,
modernize-use-transparent-functors,
-modernize-use-uncaught-exceptions,
performance-faster-string-find,
-performance-for-range-copy,
Expand All @@ -197,7 +197,7 @@ performance-inefficient-string-concatenation,
-performance-move-const-arg,
-performance-move-constructor-init,
-performance-no-automatic-move,
-performance-noexcept-move-constructor,
performance-noexcept-move-constructor,
-performance-trivially-destructible,
-performance-type-promotion-in-math-fn,
-performance-unnecessary-copy-initialization,
Expand Down
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ select = C,E,W
exclude =
./build,
# Exclude fluid directory
./python/paddle/fluid/**,
./python/paddle/base/**,
# Exclude third-party libraries
./third_party/**,
./python/paddle/utils/gast/**,
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ tools/nvcc_lazy

# This file is automatically generated.
# TODO(zhiqiang) Move this file to build directory.
paddle/fluid/pybind/eager_op_function.cc
paddle/fluid/pybind/eager_op_function.*
tools/nvcc_lazy
paddle/phi/kernels/sparse/gpu/cutlass_generator/all_gemm_operations.h
paddle/phi/kernels/sparse/gpu/cutlass_generator/configurations.h
Expand All @@ -95,6 +95,7 @@ paddle/fluid/framework/__init__.py
paddle/phi/api/profiler/__init__.py
python/paddle/incubate/fleet/parameter_server/pslib/ps_pb2.py
paddle/phi/kernels/fusion/cutlass/conv2d/generated/*
python/paddle/fluid/incubate/fleet/parameter_server/pslib/ps_pb2.py
python/paddle/base/incubate/fleet/parameter_server/pslib/ps_pb2.py
paddle/fluid/ir_adaptor/translator/op_compat_info.cc
paddle/fluid/pybind/static_op_function.*
paddle/fluid/pybind/ops_api.cc
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ option(WITH_BRPC_RDMA "Use brpc rdma as the rpc protocal" OFF)
option(ON_INFER "Turn on inference optimization and inference-lib generation"
ON)
option(WITH_CPP_DIST "Install PaddlePaddle C++ distribution" OFF)
option(WITH_GFLAGS "Compile PaddlePaddle with gflags support" OFF)
################################ Internal Configurations #######################################
option(WITH_NV_JETSON "Compile PaddlePaddle with NV JETSON" OFF)
option(WITH_PROFILER "Compile PaddlePaddle with GPU profiler and gperftools"
Expand Down Expand Up @@ -604,10 +605,14 @@ if(WITH_CINN)
add_definitions(-DPADDLE_WITH_CINN)

if(CINN_ONLY)
add_definitions(-DCINN_WITH_ONLY)
if(WITH_PYTHON)
add_subdirectory(python)
endif()
add_subdirectory(test)
if(NOT WITH_GFLAGS)
add_subdirectory(paddle/utils)
endif()
return()
endif()
endif()
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ English | [简体中文](./README_cn.md) | [日本語](./README_ja.md)
Welcome to the PaddlePaddle GitHub.

PaddlePaddle, as the first independent R&D deep learning platform in China, has been officially open-sourced to professional communities since 2016. It is an industrial platform with advanced technologies and rich features that cover core deep learning frameworks, basic model libraries, end-to-end development kits, tools & components as well as service platforms.
PaddlePaddle is originated from industrial practices with dedication and commitments to industrialization. It has been widely adopted by a wide range of sectors including manufacturing, agriculture, enterprise service, and so on while serving more than 5.35 million developers, 200,000 companies and generating 670,000 models. With such advantages, PaddlePaddle has helped an increasing number of partners commercialize AI.
PaddlePaddle is originated from industrial practices with dedication and commitments to industrialization. It has been widely adopted by a wide range of sectors including manufacturing, agriculture, enterprise service, and so on while serving more than 8 million developers, 220,000 companies and generating 800,000 models. With such advantages, PaddlePaddle has helped an increasing number of partners commercialize AI.


## Installation
Expand Down
2 changes: 1 addition & 1 deletion README_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

欢迎来到 PaddlePaddle GitHub

飞桨(PaddlePaddle)以百度多年的深度学习技术研究和业务应用为基础,是中国首个自主研发、功能完备、 开源开放的产业级深度学习平台,集深度学习核心训练和推理框架、基础模型库、端到端开发套件和丰富的工具组件于一体。目前,飞桨累计开发者535万,服务企业20万家,基于飞桨开源深度学习平台产生了67万个模型。飞桨助力开发者快速实现AI想法,快速上线AI业务。帮助越来越多的行业完成AI赋能,实现产业智能化升级。
飞桨(PaddlePaddle)以百度多年的深度学习技术研究和业务应用为基础,是中国首个自主研发、功能完备、 开源开放的产业级深度学习平台,集深度学习核心训练和推理框架、基础模型库、端到端开发套件和丰富的工具组件于一体。目前,飞桨累计开发者800万,服务企业22万家,基于飞桨开源深度学习平台产生了80万个模型。飞桨助力开发者快速实现AI想法,快速上线AI业务。帮助越来越多的行业完成AI赋能,实现产业智能化升级。

## 安装

Expand Down
2 changes: 1 addition & 1 deletion README_ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
PaddlePaddle GitHub へようこそ。

PaddlePaddle は中国初の独立系 R&D ディープラーニングプラットフォームとして、2016年からプロのコミュニティに正式にオープンソース化されました。コアとなる深層学習フレームワーク、基本モデルライブラリ、エンドツーエンドの開発キット、ツール&コンポーネント、さらにサービスプラットフォームを網羅する、高度な技術と豊富な機能を備えた産業プラットフォームです。
PaddlePaddle は、工業化に対するコミットメントを持つ工業的実践から生まれたものです。製造業、農業、企業サービスなど幅広い分野で採用され、535万人以上の開発者、20万以上の企業、67万以上のモデルを生み出しています。それにより PaddlePaddle は、ますます多くのパートナーの AI 商用化を支援しています。
PaddlePaddle は、工業化に対するコミットメントを持つ工業的実践から生まれたものです。製造業、農業、企業サービスなど幅広い分野で採用され、800万人以上の開発者、22万以上の企業、80万以上のモデルを生み出しています。それにより PaddlePaddle は、ますます多くのパートナーの AI 商用化を支援しています。


## インストール
Expand Down
24 changes: 16 additions & 8 deletions cmake/cinn.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,6 @@ include(cmake/cinn/core.cmake)
include(cmake/cinn/nvrtc.cmake)
include(cmake/cinn/nvtx.cmake)

if(CINN_ONLY)
link_libraries(gflags)
endif()

set(LINK_FLAGS
"-Wl,--version-script ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cinn/export.map"
CACHE INTERNAL "")
Expand Down Expand Up @@ -168,8 +164,8 @@ cinn_cc_library(
add_dependencies(cinnapi GEN_LLVM_RUNTIME_IR_HEADER ZLIB::ZLIB)
add_dependencies(cinnapi GEN_LLVM_RUNTIME_IR_HEADER ${core_deps})
if(NOT CINN_ONLY)
target_link_libraries(cinnapi phi)
add_dependencies(cinnapi phi)
target_link_libraries(cinnapi pd_dialect phi)
add_dependencies(cinnapi pd_dialect phi)
endif()

target_link_libraries(cinnapi ${PYTHON_LIBRARIES})
Expand All @@ -183,6 +179,11 @@ if(WITH_MKL)
endif()
endif()

if(CINN_ONLY)
target_link_libraries(cinnapi ${flags_dep})
add_dependencies(cinnapi ${flags_dep})
endif()

if(WITH_GPU)
target_link_libraries(
cinnapi
Expand Down Expand Up @@ -221,8 +222,8 @@ function(gen_cinncore LINKTYPE)
add_dependencies(${CINNCORE_TARGET} GEN_LLVM_RUNTIME_IR_HEADER ZLIB::ZLIB)
add_dependencies(${CINNCORE_TARGET} GEN_LLVM_RUNTIME_IR_HEADER ${core_deps})
if(NOT CINN_ONLY)
target_link_libraries(${CINNCORE_TARGET} phi)
add_dependencies(${CINNCORE_TARGET} phi)
target_link_libraries(${CINNCORE_TARGET} pd_dialect phi)
add_dependencies(${CINNCORE_TARGET} pd_dialect phi)
endif()

add_dependencies(${CINNCORE_TARGET} pybind)
Expand All @@ -237,6 +238,11 @@ function(gen_cinncore LINKTYPE)
endif()
endif()

if(CINN_ONLY)
target_link_libraries(${CINNCORE_TARGET} ${flags_dep})
add_dependencies(${CINNCORE_TARGET} ${flags_dep})
endif()

if(WITH_GPU)
target_link_libraries(
${CINNCORE_TARGET}
Expand All @@ -262,6 +268,8 @@ set(PUBLISH_LIBS ON)
if(PUBLISH_LIBS)
set(core_includes
"${core_includes};paddle/cinn/runtime/cuda/cinn_cuda_runtime_source.cuh")
set(core_includes
"${core_includes};paddle/utils/flags.h;paddle/utils/flags_native.h")
foreach(header ${core_includes})
get_filename_component(prefix ${header} DIRECTORY)
file(COPY ${header}
Expand Down
13 changes: 13 additions & 0 deletions cmake/external/brpc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,16 @@ add_dependencies(brpc extern_brpc)
add_definitions(-DBRPC_WITH_GLOG)

list(APPEND external_project_dependencies brpc)

set(EXTERNAL_BRPC_DEPS
brpc
protobuf
ssl
crypto
leveldb
glog
snappy)

if(NOT WITH_GFLAGS)
set(EXTERNAL_BRPC_DEPS ${EXTERNAL_BRPC_DEPS} gflags)
endif()
12 changes: 12 additions & 0 deletions cmake/external/gflags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,15 @@ if(WIN32)
set_property(GLOBAL PROPERTY OS_DEPENDENCY_MODULES shlwapi.lib)
endif()
endif()

# We have implemented a custom flags tool paddle_flags to replace gflags.
# User can also choose to use gflags by setting WITH_GFLAGS=ON. But when
# using paddle_flags, gflags is also needed for other third party libraries
# including glog and brpc. So we can not remove gflags completely.
set(flags_dep)
if(WITH_GFLAGS)
list(APPEND flags_dep gflags)
add_definitions(-DPADDLE_WITH_GFLAGS)
else()
list(APPEND flags_dep paddle_flags)
endif()
18 changes: 7 additions & 11 deletions cmake/external/openblas.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,13 @@ set(CBLAS_PREFIX_DIR ${THIRD_PARTY_PATH}/openblas)
set(CBLAS_INSTALL_DIR ${THIRD_PARTY_PATH}/install/openblas)
set(CBLAS_SOURCE_DIR ${PADDLE_SOURCE_DIR}/third_party/openblas)
set(CBLAS_TAG v0.3.7)
set(CMAKE_VERBOSE_MAKEFILE 1)

# Why use v0.3.18? The IDG business line encountered a random openblas error,
# which can be resolved after upgrading openblas.
# And why compile when gcc>8.2? Please refer to
# https://github.com/spack/spack/issues/19932#issuecomment-733452619
# v0.3.18 only support gcc>=8.3 or gcc>=7.4
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.2
# OpenBLAS support Raptor Lake from v0.3.22
if(UNIX
AND NOT APPLE
AND NOT WITH_ROCM
AND NOT WITH_XPU)
# We only compile with openblas 0.3.18 when gcc >= 8.3
set(CBLAS_TAG v0.3.18)
set(CBLAS_TAG v0.3.23)
endif()

if(APPLE AND WITH_ARM)
Expand Down Expand Up @@ -94,7 +89,7 @@ if(NOT WIN32)
PREFIX ${CBLAS_PREFIX_DIR}
INSTALL_DIR ${CBLAS_INSTALL_DIR}
BUILD_IN_SOURCE 1
BUILD_COMMAND make ${ARM_ARGS} -j${NPROC} ${COMMON_ARGS} ${OPTIONAL_ARGS}
BUILD_COMMAND make ${ARM_ARGS} -s -j${NPROC} ${COMMON_ARGS} ${OPTIONAL_ARGS}
INSTALL_COMMAND make install NO_SHARED=1 NO_LAPACK=1 PREFIX=<INSTALL_DIR>
UPDATE_COMMAND ""
CONFIGURE_COMMAND ""
Expand Down Expand Up @@ -122,6 +117,7 @@ else()
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_BUILD_TYPE=${THIRD_PARTY_BUILD_TYPE}
-DBUILD_SHARED_LIBS=ON
-DCMAKE_VERBOSE_MAKEFILE=OFF
-DMSVC_STATIC_CRT=${MSVC_STATIC_CRT}
${EXTERNAL_OPTIONAL_ARGS}
CMAKE_CACHE_ARGS
Expand Down
5 changes: 5 additions & 0 deletions cmake/flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ if(NOT WIN32)
set(COMMON_FLAGS
-fPIC
-fno-omit-frame-pointer
-pipe
-ffunction-sections
-fdata-sections
-Wl
-gc-sections
-Werror
-Wall
-Wextra
Expand Down
16 changes: 15 additions & 1 deletion cmake/generic.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,21 @@ function(py_proto_compile TARGET_NAME)
"${multiValueArgs}" ${ARGN})
set(py_srcs)
protobuf_generate_python(py_srcs ${py_proto_compile_SRCS})
add_custom_target(${TARGET_NAME} ALL DEPENDS ${py_srcs} protobuf)

add_custom_target(${TARGET_NAME}_replace DEPENDS ${py_srcs})

foreach(py_src ${py_srcs})
add_custom_command(
TARGET ${TARGET_NAME}_replace
POST_BUILD
COMMAND ${PYTHON_EXECUTABLE} ${PADDLE_SOURCE_DIR}/cmake/replace_string.py
${py_src}
COMMENT
"Replacing 'paddle.fluid' with 'paddle.base' generated by protobuf"
COMMENT "Replace ${py_src}")
endforeach()

add_custom_target(${TARGET_NAME} ALL DEPENDS protobuf ${TARGET_NAME}_replace)
endfunction()

function(py_test TARGET_NAME)
Expand Down
11 changes: 11 additions & 0 deletions cmake/inference_lib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,22 @@ copy(
inference_lib_dist
SRCS ${PADDLE_SOURCE_DIR}/paddle/utils/flat_hash_map.h
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/utils/)
copy(
inference_lib_dist
SRCS ${PADDLE_SOURCE_DIR}/paddle/utils/flags.h
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/utils/)
copy(
inference_lib_dist
SRCS ${PADDLE_SOURCE_DIR}/paddle/extension.h
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/)

if(NOT WITH_GFLAGS)
copy(
inference_lib_dist
SRCS ${PADDLE_SOURCE_DIR}/paddle/utils/flags_native.h
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/utils/)
endif()

# the include path of phi needs to be changed to adapt to inference api path
add_custom_command(
TARGET inference_lib_dist
Expand Down
Loading

0 comments on commit a9d4482

Please sign in to comment.