Skip to content

Commit

Permalink
Merge branch 'develop' into triplet_margin_loss
Browse files Browse the repository at this point in the history
  • Loading branch information
yangguohao committed Jun 13, 2022
2 parents e6aac2b + 5d48528 commit 187fa6d
Show file tree
Hide file tree
Showing 241 changed files with 12,155 additions and 2,309 deletions.
48 changes: 1 addition & 47 deletions .pre-commit-config.yaml
Expand Up @@ -83,65 +83,34 @@ repos:
# exclude files which need to be fixed
exclude: |
(?x)^(
cmake/generic.cmake|
CMakeLists.txt|
paddle/fluid/pybind/CMakeLists.txt|
python/paddle/fluid/tests/unittests/CMakeLists.txt|
paddle/fluid/eager/auto_code_generator/CMakeLists.txt|
paddle/fluid/framework/CMakeLists.txt|
paddle/fluid/eager/auto_code_generator/final_state_generator/CMakeLists.txt|
cmake/third_party.cmake|
python/paddle/fluid/tests/unittests/CMakeLists.txt|
paddle/fluid/inference/tests/infer_ut/CMakeLists.txt|
cmake/configure.cmake|
paddle/fluid/inference/api/demo_ci/CMakeLists.txt|
cmake/flags.cmake|
cmake/inference_lib.cmake|
cmake/external/protobuf.cmake|
cmake/system.cmake|
cmake/cudnn.cmake|
cmake/external/mkldnn.cmake|
cmake/unity_build.cmake|
paddle/fluid/framework/fleet/CMakeLists.txt|
paddle/fluid/inference/CMakeLists.txt|
paddle/fluid/inference/tests/api/CMakeLists.txt|
paddle/fluid/operators/CMakeLists.txt|
paddle/phi/api/lib/CMakeLists.txt|
cmake/external/gflags.cmake|
cmake/external/lite.cmake|
cmake/external/poplar.cmake|
cmake/python_module.cmake|
python/paddle/fluid/tests/unittests/asp/CMakeLists.txt|
cmake/cuda.cmake|
cmake/FindNumPy.cmake|
cmake/phi.cmake|
paddle/fluid/framework/ir/CMakeLists.txt|
paddle/fluid/platform/CMakeLists.txt|
python/paddle/fluid/tests/unittests/mlu/CMakeLists.txt|
python/paddle/tests/CMakeLists.txt|
cmake/ccache.cmake|
cmake/coveralls.cmake|
cmake/external/glog.cmake|
cmake/external/onnxruntime.cmake|
cmake/external/openblas.cmake|
cmake/external/xpu.cmake|
cmake/hip.cmake|
paddle/fluid/distributed/CMakeLists.txt|
paddle/fluid/framework/details/CMakeLists.txt|
paddle/fluid/imperative/CMakeLists.txt|
paddle/fluid/inference/analysis/ir_passes/CMakeLists.txt|
paddle/fluid/inference/api/CMakeLists.txt|
paddle/fluid/operators/controlflow/CMakeLists.txt|
python/paddle/fluid/tests/unittests/distributed_passes/CMakeLists.txt|
cmake/cblas.cmake|
cmake/coverallsGcovJsons.cmake|
cmake/external/brpc.cmake|
cmake/external/cryptopp.cmake|
cmake/external/gtest.cmake|
cmake/external/llvm.cmake|
cmake/external/utf8proc.cmake|
cmake/external/warpctc.cmake|
cmake/external/zlib.cmake|
cmake/FindGperftools.cmake|
cmake/operators.cmake|
cmake/tensorrt.cmake|
paddle/fluid/inference/api/details/CMakeLists.txt|
Expand All @@ -154,28 +123,13 @@ repos:
cmake/miopen.cmake|
cmake/nccl.cmake|
cmake/simd.cmake|
paddle/fluid/distributed/fleet_executor/CMakeLists.txt|
paddle/fluid/eager/api/generated/fluid_generated/forwards/CMakeLists.txt|
paddle/fluid/framework/io/CMakeLists.txt|
paddle/fluid/imperative/tests/CMakeLists.txt|
paddle/fluid/inference/analysis/CMakeLists.txt|
paddle/fluid/inference/tests/infer_ut/external-cmake/gtest-cpp.cmake|
paddle/fluid/memory/allocation/CMakeLists.txt|
paddle/fluid/memory/CMakeLists.txt|
paddle/fluid/operators/cinn/CMakeLists.txt|
paddle/fluid/operators/collective/CMakeLists.txt|
paddle/fluid/operators/ipu/CMakeLists.txt|
paddle/fluid/operators/jit/CMakeLists.txt|
paddle/fluid/operators/pscore/CMakeLists.txt|
paddle/fluid/platform/device/ipu/CMakeLists.txt|
paddle/fluid/platform/dynload/CMakeLists.txt|
paddle/infrt/external_kernels/CMakeLists.txt|
paddle/infrt/kernel/phi/CMakeLists.txt|
paddle/phi/backends/dynload/CMakeLists.txt|
paddle/phi/CMakeLists.txt|
paddle/phi/kernels/CMakeLists.txt|
paddle/phi/tests/core/CMakeLists.txt|
python/CMakeLists.txt|
python/paddle/fluid/contrib/slim/tests/CMakeLists.txt|
python/paddle/fluid/tests/unittests/autograd/CMakeLists.txt|
python/paddle/fluid/tests/unittests/distribution/CMakeLists.txt|
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Expand Up @@ -60,6 +60,7 @@ option(WITH_IPU "Compile PaddlePaddle with Graphcore IPU" OFF)
option(WITH_ASCEND_CL "Compile PaddlePaddle with ASCEND CL" ${WITH_ASCEND})
option(WITH_ASCEND_CXX11 "Compile PaddlePaddle with ASCEND and CXX11 ABI" OFF)
option(WITH_ONNXRUNTIME "Compile PaddlePaddle with ONNXRUNTIME" OFF)
option(WITH_CUSPARSELT "Compile PaddlePaddle with CUSPARSELT" OFF)
# Note(zhouwei): It use option above, so put here
include(init)
include(generic) # simplify cmake module
Expand Down
4 changes: 2 additions & 2 deletions cmake/ccache.cmake
Expand Up @@ -13,7 +13,7 @@ if(NOT WIN32)
${cache_directory})
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_PATH})
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_PATH})
endif(CCACHE_PATH)
endif()
elseif("${CMAKE_GENERATOR}" STREQUAL "Ninja")
# (Note:zhouwei25) Only Ninja Generator can support sccache now
find_program(SCCACHE_PATH sccache)
Expand All @@ -30,5 +30,5 @@ elseif("${CMAKE_GENERATOR}" STREQUAL "Ninja")
# (Note:zhouwei25) sccache for cuda compiler has bug so that it can't be hit
# refer to https://github.com/mozilla/sccache/issues/1017, so we fix it
set(CMAKE_CUDA_COMPILER_LAUNCHER ${SCCACHE_PATH})
endif(SCCACHE_PATH)
endif()
endif()
14 changes: 7 additions & 7 deletions cmake/coverallsGcovJsons.cmake
Expand Up @@ -141,9 +141,9 @@ file(GLOB_RECURSE ALL_GCOV_FILES "${COV_PATH}" "*.gcov")
# Get only the filenames to use for filtering.
#set(COVERAGE_SRCS_NAMES "")
#foreach (COVSRC ${COVERAGE_SRCS})
# get_filename_component(COVSRC_NAME ${COVSRC} NAME)
# message("${COVSRC} -> ${COVSRC_NAME}")
# list(APPEND COVERAGE_SRCS_NAMES "${COVSRC_NAME}")
# get_filename_component(COVSRC_NAME ${COVSRC} NAME)
# message("${COVSRC} -> ${COVSRC_NAME}")
# list(APPEND COVERAGE_SRCS_NAMES "${COVSRC_NAME}")
#endforeach()

#
Expand All @@ -155,15 +155,15 @@ file(GLOB_RECURSE ALL_GCOV_FILES "${COV_PATH}" "*.gcov")
#
# Example:
# COVERAGE_SRCS =
# /path/to/project/root/subdir/the_file.c
# /path/to/project/root/subdir/the_file.c
#
# ALL_GCOV_FILES =
# /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov
# /path/to/project/root/build/#path#to#project#root#subdir#other_file.c.gcov
# /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov
# /path/to/project/root/build/#path#to#project#root#subdir#other_file.c.gcov
#
# Result should be:
# GCOV_FILES =
# /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov
# /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov
#
set(GCOV_FILES "")
#message("Look in coverage sources: ${COVERAGE_SRCS}")
Expand Down
10 changes: 5 additions & 5 deletions cmake/cudnn.cmake
Expand Up @@ -4,11 +4,11 @@ endif()

if(WIN32)
set(CUDNN_ROOT ${CUDA_TOOLKIT_ROOT_DIR})
else(WIN32)
else()
set(CUDNN_ROOT
"/usr"
CACHE PATH "CUDNN ROOT")
endif(WIN32)
endif()

find_path(
CUDNN_INCLUDE_DIR cudnn.h
Expand Down Expand Up @@ -41,16 +41,16 @@ set(CUDNN_LIB_NAME "")

if(LINUX)
set(CUDNN_LIB_NAME "libcudnn.so")
endif(LINUX)
endif()

if(WIN32)
# only support cudnn7
set(CUDNN_LIB_NAME "cudnn.lib" "cudnn64_7.dll")
endif(WIN32)
endif()

if(APPLE)
set(CUDNN_LIB_NAME "libcudnn.dylib" "libcudnn.so")
endif(APPLE)
endif()

find_library(
CUDNN_LIBRARY
Expand Down
4 changes: 2 additions & 2 deletions cmake/external/cryptopp.cmake
Expand Up @@ -35,11 +35,11 @@ if(WIN32)
${CMAKE_COMMAND} -E copy_if_different
"${PADDLE_SOURCE_DIR}/patches/cryptopp/CMakeLists.txt" "<SOURCE_DIR>/")
endif()
else(WIN32)
else()
set(CRYPTOPP_LIBRARIES
"${CRYPTOPP_INSTALL_DIR}/lib/libcryptopp.a"
CACHE FILEPATH "cryptopp library." FORCE)
endif(WIN32)
endif()

if(APPLE AND WITH_ARM)
set(CMAKE_CXX_FLAGS "-DCRYPTOPP_ARM_CRC32_AVAILABLE=0")
Expand Down
61 changes: 61 additions & 0 deletions cmake/external/cusparselt.cmake
@@ -0,0 +1,61 @@
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

if(NOT (WITH_CUSPARSELT AND WITH_TENSORRT))
return()
endif()

if(WITH_ARM OR WIN32)
message(SEND_ERROR "The current sparselt support linux only")
return()
endif()

include(ExternalProject)

set(CUSPARSELT_PROJECT "extern_cusparselt")
set(CUSPARSELT_P "https://developer.download.nvidia.com/compute")
set(CUSPARSELT_F "libcusparse_lt-linux-x86_64-0.2.0.1.tar.gz")
set(CUSPARSELT_URL
"${CUSPARSELT_P}/libcusparse-lt/0.2.0/local_installers/${CUSPARSELT_F}"
CACHE STRING "" FORCE)
set(CUSPARSELT_PREFIX_DIR ${THIRD_PARTY_PATH}/cusparselt)
set(CUSPARSELT_INSTALL_DIR ${THIRD_PARTY_PATH}/install/cusparselt)
set(CUSPARSELT_INC_DIR
"${CUSPARSELT_INSTALL_DIR}/include"
CACHE PATH "sparselt include directory." FORCE)
set(CUSPARSELT_LIB_DIR
"${CUSPARSELT_INSTALL_DIR}/lib64"
CACHE PATH "sparselt lib directory." FORCE)
set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM 1)
include_directories(${CUSPARSELT_INC_DIR})

ExternalProject_Add(
${CUSPARSELT_PROJECT}
${EXTERNAL_PROJECT_LOG_ARGS}
URL ${CUSPARSELT_URL}
PREFIX ${CUSPARSELT_PREFIX_DIR}
DOWNLOAD_NO_PROGRESS 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND
${CMAKE_COMMAND} -E copy_directory
${CUSPARSELT_PREFIX_DIR}/src/extern_cusparselt/lib64 ${CUSPARSELT_LIB_DIR}
&& ${CMAKE_COMMAND} -E copy_directory
${CUSPARSELT_PREFIX_DIR}/src/extern_cusparselt/include ${CUSPARSELT_INC_DIR}
UPDATE_COMMAND "")

add_library(cusparselt INTERFACE)
add_dependencies(cusparselt ${CUSPARSELT_PROJECT})
set(CUSPARSELT_FOUND ON)
add_definitions(-DPADDLE_WITH_CUSPARSELT)
8 changes: 4 additions & 4 deletions cmake/external/gflags.cmake
Expand Up @@ -25,13 +25,13 @@ if(WIN32)
set(GFLAGS_LIBRARIES
"${GFLAGS_INSTALL_DIR}/lib/gflags_static.lib"
CACHE FILEPATH "GFLAGS_LIBRARIES" FORCE)
else(WIN32)
else()
set(GFLAGS_LIBRARIES
"${GFLAGS_INSTALL_DIR}/lib/libgflags.a"
CACHE FILEPATH "GFLAGS_LIBRARIES" FORCE)
set(BUILD_COMMAND $(MAKE) --silent)
set(INSTALL_COMMAND $(MAKE) install)
endif(WIN32)
endif()

include_directories(${GFLAGS_INCLUDE_DIR})

Expand Down Expand Up @@ -101,5 +101,5 @@ if(WIN32)
check_include_file_cxx("shlwapi.h" HAVE_SHLWAPI)
if(HAVE_SHLWAPI)
set_property(GLOBAL PROPERTY OS_DEPENDENCY_MODULES shlwapi.lib)
endif(HAVE_SHLWAPI)
endif(WIN32)
endif()
endif()
4 changes: 2 additions & 2 deletions cmake/external/gtest.cmake
Expand Up @@ -42,7 +42,7 @@ if(WIN32)
string(REPLACE "/w " "" GTEST_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE "/W0 " "" GTEST_CMAKE_C_FLAGS "${GTEST_CMAKE_C_FLAGS}")
string(REPLACE "/W0 " "" GTEST_CMAKE_CXX_FLAGS "${GTEST_CMAKE_CXX_FLAGS}")
else(WIN32)
else()
set(GTEST_LIBRARIES
"${GTEST_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/libgtest.a"
CACHE FILEPATH "gtest libraries." FORCE)
Expand All @@ -51,7 +51,7 @@ else(WIN32)
CACHE FILEPATH "gtest main libraries." FORCE)
set(GTEST_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
set(GTEST_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
endif(WIN32)
endif()

if(WITH_MKLML)
# wait for mklml downloading completed
Expand Down
6 changes: 3 additions & 3 deletions cmake/external/mkldnn.cmake
Expand Up @@ -59,7 +59,7 @@ else()
set(MKLDNN_LIB
"${MKLDNN_INSTALL_DIR}/bin/mkldnn.lib"
CACHE FILEPATH "mkldnn library." FORCE)
endif(NOT WIN32)
endif()

ExternalProject_Add(
${MKLDNN_PROJECT}
Expand Down Expand Up @@ -121,7 +121,7 @@ if(WIN32)
DEPENDS ${MKLDNN_PROJECT}
VERBATIM)
add_custom_target(mkldnn_cmd ALL DEPENDS ${MKLDNN_LIB})
else(WIN32)
else()
set(MKLDNN_SHARED_LIB ${MKLDNN_INSTALL_DIR}/libmkldnn.so.0)
set(MKLDNN_SHARED_LIB_1 ${MKLDNN_INSTALL_DIR}/libdnnl.so.1)
set(MKLDNN_SHARED_LIB_2 ${MKLDNN_INSTALL_DIR}/libdnnl.so.2)
Expand All @@ -132,7 +132,7 @@ else(WIN32)
COMMAND ${CMAKE_COMMAND} -E copy ${MKLDNN_LIB} ${MKLDNN_SHARED_LIB_2}
DEPENDS ${MKLDNN_PROJECT})
add_custom_target(mkldnn_cmd ALL DEPENDS ${MKLDNN_SHARED_LIB_2})
endif(WIN32)
endif()

# generate a static dummy target to track mkldnn dependencies
# for cc_library(xxx SRCS xxx.c DEPS mkldnn)
Expand Down
4 changes: 2 additions & 2 deletions cmake/external/utf8proc.cmake
Expand Up @@ -23,9 +23,9 @@ set(UTF8PROC_TAG v2.6.1)
if(WIN32)
set(UTF8PROC_LIBRARIES "${UTF8PROC_INSTALL_DIR}/lib/utf8proc_static.lib")
add_definitions(-DUTF8PROC_STATIC)
else(WIN32)
else()
set(UTF8PROC_LIBRARIES "${UTF8PROC_INSTALL_DIR}/lib/libutf8proc.a")
endif(WIN32)
endif()

include_directories(${UTF8PROC_INSTALL_DIR}/include)

Expand Down
4 changes: 2 additions & 2 deletions cmake/external/warpctc.cmake
Expand Up @@ -37,11 +37,11 @@ if(WIN32)
set(WARPCTC_LIBRARIES
"${WARPCTC_INSTALL_DIR}/bin/warpctc${CMAKE_SHARED_LIBRARY_SUFFIX}"
CACHE FILEPATH "Warp-ctc Library" FORCE)
else(WIN32)
else()
set(WARPCTC_LIBRARIES
"${WARPCTC_INSTALL_DIR}/lib/libwarpctc${CMAKE_SHARED_LIBRARY_SUFFIX}"
CACHE FILEPATH "Warp-ctc Library" FORCE)
endif(WIN32)
endif()

if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"
Expand Down
4 changes: 2 additions & 2 deletions cmake/external/zlib.cmake
Expand Up @@ -34,11 +34,11 @@ if(WIN32)
set(ZLIB_LIBRARIES
"${ZLIB_INSTALL_DIR}/lib/zlibstatic.lib"
CACHE FILEPATH "zlib library." FORCE)
else(WIN32)
else()
set(ZLIB_LIBRARIES
"${ZLIB_INSTALL_DIR}/lib/libz.a"
CACHE FILEPATH "zlib library." FORCE)
endif(WIN32)
endif()

ExternalProject_Add(
extern_zlib
Expand Down

0 comments on commit 187fa6d

Please sign in to comment.