From edf69ae0320a991eb8ddfc3a8013f03c5eab708b Mon Sep 17 00:00:00 2001 From: Ruibiao Chen Date: Mon, 13 Jun 2022 10:31:36 +0800 Subject: [PATCH] Fix cmakelint errors for some files (#43428) --- .pre-commit-config.yaml | 47 +------------------ cmake/ccache.cmake | 4 +- cmake/coverallsGcovJsons.cmake | 14 +++--- cmake/cudnn.cmake | 10 ++-- cmake/external/cryptopp.cmake | 4 +- cmake/external/gflags.cmake | 8 ++-- cmake/external/gtest.cmake | 4 +- cmake/external/mkldnn.cmake | 6 +-- cmake/external/utf8proc.cmake | 4 +- cmake/external/warpctc.cmake | 4 +- cmake/external/zlib.cmake | 4 +- cmake/generic.cmake | 12 +++-- cmake/system.cmake | 14 +++--- cmake/third_party.cmake | 24 +++++----- cmake/unity_build.cmake | 6 +-- paddle/fluid/distributed/CMakeLists.txt | 4 +- .../eager/auto_code_generator/CMakeLists.txt | 2 +- paddle/fluid/framework/CMakeLists.txt | 14 +++--- paddle/fluid/framework/io/CMakeLists.txt | 2 +- paddle/fluid/framework/ir/CMakeLists.txt | 2 +- paddle/fluid/imperative/CMakeLists.txt | 2 +- paddle/fluid/imperative/tests/CMakeLists.txt | 2 +- paddle/fluid/operators/ipu/CMakeLists.txt | 2 +- paddle/fluid/platform/CMakeLists.txt | 6 +-- paddle/fluid/platform/dynload/CMakeLists.txt | 2 +- paddle/fluid/pybind/CMakeLists.txt | 24 +++++----- paddle/phi/backends/dynload/CMakeLists.txt | 2 +- paddle/phi/tests/core/CMakeLists.txt | 2 +- python/CMakeLists.txt | 2 +- .../fluid/tests/unittests/mlu/CMakeLists.txt | 8 ++-- 30 files changed, 100 insertions(+), 141 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 930e0f7dcd..dfe1e3848e 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -84,63 +84,33 @@ repos: exclude: | (?x)^( 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| @@ -153,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| diff --git a/cmake/ccache.cmake b/cmake/ccache.cmake index 85bc0e987a..08b6720416 100644 --- a/cmake/ccache.cmake +++ b/cmake/ccache.cmake @@ -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) @@ -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() diff --git a/cmake/coverallsGcovJsons.cmake b/cmake/coverallsGcovJsons.cmake index 6c1186f69f..c31b2457c1 100644 --- a/cmake/coverallsGcovJsons.cmake +++ b/cmake/coverallsGcovJsons.cmake @@ -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() # @@ -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}") diff --git a/cmake/cudnn.cmake b/cmake/cudnn.cmake index 2e5131d217..34cc9c8199 100644 --- a/cmake/cudnn.cmake +++ b/cmake/cudnn.cmake @@ -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 @@ -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 diff --git a/cmake/external/cryptopp.cmake b/cmake/external/cryptopp.cmake index ff4d3b5c9e..9daa4be746 100644 --- a/cmake/external/cryptopp.cmake +++ b/cmake/external/cryptopp.cmake @@ -35,11 +35,11 @@ if(WIN32) ${CMAKE_COMMAND} -E copy_if_different "${PADDLE_SOURCE_DIR}/patches/cryptopp/CMakeLists.txt" "/") 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") diff --git a/cmake/external/gflags.cmake b/cmake/external/gflags.cmake index 783e1c0d44..68255b4d60 100755 --- a/cmake/external/gflags.cmake +++ b/cmake/external/gflags.cmake @@ -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}) @@ -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() diff --git a/cmake/external/gtest.cmake b/cmake/external/gtest.cmake index 00527ceecd..3833a6ca86 100644 --- a/cmake/external/gtest.cmake +++ b/cmake/external/gtest.cmake @@ -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) @@ -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 diff --git a/cmake/external/mkldnn.cmake b/cmake/external/mkldnn.cmake index dfa20dd631..909d223060 100644 --- a/cmake/external/mkldnn.cmake +++ b/cmake/external/mkldnn.cmake @@ -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} @@ -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) @@ -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) diff --git a/cmake/external/utf8proc.cmake b/cmake/external/utf8proc.cmake index 13107c03cf..753c22fe26 100644 --- a/cmake/external/utf8proc.cmake +++ b/cmake/external/utf8proc.cmake @@ -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) diff --git a/cmake/external/warpctc.cmake b/cmake/external/warpctc.cmake index d38636c9c2..c7a4e1d99b 100644 --- a/cmake/external/warpctc.cmake +++ b/cmake/external/warpctc.cmake @@ -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" diff --git a/cmake/external/zlib.cmake b/cmake/external/zlib.cmake index 2cef053e32..c6ad1506bb 100644 --- a/cmake/external/zlib.cmake +++ b/cmake/external/zlib.cmake @@ -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 diff --git a/cmake/generic.cmake b/cmake/generic.cmake index 017d863913..838fbd71c2 100644 --- a/cmake/generic.cmake +++ b/cmake/generic.cmake @@ -305,8 +305,8 @@ endfunction() function(check_coverage_opt TARGET_NAME SRCS) if(WITH_COVERAGE AND WITH_INCREMENTAL_COVERAGE) # if pybind.cc add '-g -O0 -fprofile-arcs -ftest-coverage' only, some testcase will fail. - if((NOT ("$ENV{PADDLE_GIT_DIFF_CC_FILE}" MATCHES "pybind.cc")) - AND "$ENV{PADDLE_GIT_DIFF_H_FILE}" STREQUAL "") + if("$ENV{PADDLE_GIT_DIFF_H_FILE}" STREQUAL "" + AND (NOT ("$ENV{PADDLE_GIT_DIFF_CC_FILE}" MATCHES "pybind.cc"))) if(NOT ("$ENV{PADDLE_GIT_DIFF_CC_FILE}" STREQUAL "")) string(REPLACE "," ";" CC_FILE_LIST $ENV{PADDLE_GIT_DIFF_CC_FILE}) set(use_coverage_opt FALSE) @@ -779,8 +779,12 @@ function(hip_test TARGET_NAME) FLAGS_init_allocated_mem=true) set_property(TEST ${TARGET_NAME} PROPERTY ENVIRONMENT FLAGS_cudnn_deterministic=true) - set_property(TEST ${TARGET_NAME} PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=\ - ${CMAKE_BINARY_DIR}/python/paddle/libs:$LD_LIBRARY_PATH") + set_property( + TEST ${TARGET_NAME} + PROPERTY + ENVIRONMENT + "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/python/paddle/libs:$LD_LIBRARY_PATH" + ) endif() endfunction() diff --git a/cmake/system.cmake b/cmake/system.cmake index 0562077eae..7df5f8a4b6 100644 --- a/cmake/system.cmake +++ b/cmake/system.cmake @@ -23,11 +23,11 @@ if(UNIX AND NOT APPLE) # except apple from nix*Os family set(LINUX TRUE) -endif(UNIX AND NOT APPLE) +endif() if(WIN32) set(HOST_SYSTEM "win32") -else(WIN32) +else() if(APPLE) set(HOST_SYSTEM "macosx") exec_program( @@ -45,7 +45,7 @@ else(WIN32) ) endif() set(CMAKE_EXE_LINKER_FLAGS "-framework CoreFoundation -framework Security") - else(APPLE) + else() if(EXISTS "/etc/issue") file(READ "/etc/issue" LINUX_ISSUE) @@ -63,21 +63,21 @@ else(WIN32) string(REGEX MATCH "(([0-9]+)\\.)+([0-9]+)" HOST_SYSTEM_VERSION "${LINUX_ISSUE}") - endif(EXISTS "/etc/issue") + endif() if(EXISTS "/etc/redhat-release") file(READ "/etc/redhat-release" LINUX_ISSUE) if(LINUX_ISSUE MATCHES "CentOS") set(HOST_SYSTEM "centos") endif() - endif(EXISTS "/etc/redhat-release") + endif() if(NOT HOST_SYSTEM) set(HOST_SYSTEM ${CMAKE_SYSTEM_NAME}) endif() - endif(APPLE) -endif(WIN32) + endif() +endif() # query number of logical cores cmake_host_system_information(RESULT CPU_CORES QUERY NUMBER_OF_LOGICAL_CORES) diff --git a/cmake/third_party.cmake b/cmake/third_party.cmake index 96132f4af5..af76f3ffbe 100755 --- a/cmake/third_party.cmake +++ b/cmake/third_party.cmake @@ -356,17 +356,17 @@ if(WITH_GPU) COMMAND ${CMAKE_COMMAND} -E copy_directory ${SRC_DIR} ${DST_DIR2} COMMENT "copy_directory from ${SRC_DIR} to ${DST_DIR}") endif() -endif(WITH_GPU) +endif() if(WITH_XPU) include(external/xpu) # download, build, install xpu list(APPEND third_party_deps extern_xpu) -endif(WITH_XPU) +endif() if(WITH_MLU) include(external/concurrentqueue) # download, build, install concurrentqueue list(APPEND third_party_deps extern_concurrentqueue) -endif(WITH_MLU) +endif() if(WITH_PSLIB) include(external/pslib) # download, build, install pslib @@ -389,7 +389,7 @@ if(WITH_PSLIB) list(APPEND third_party_deps extern_brpc) endif() endif() -endif(WITH_PSLIB) +endif() if(NOT WIN32 AND NOT APPLE) include(external/gloo) @@ -399,7 +399,7 @@ endif() if(WITH_BOX_PS) include(external/box_ps) list(APPEND third_party_deps extern_box_ps) -endif(WITH_BOX_PS) +endif() if(WITH_ASCEND OR WITH_ASCEND_CL) include(external/ascend) @@ -453,7 +453,7 @@ endif() if(WITH_LITE) message(STATUS "Compile Paddle with Lite Engine.") include(external/lite) -endif(WITH_LITE) +endif() if(WITH_CINN) message(STATUS "Compile Paddle with CINN.") @@ -462,29 +462,29 @@ if(WITH_CINN) if(WITH_GPU) add_definitions(-DCINN_WITH_CUDA) add_definitions(-DCINN_WITH_CUDNN) - endif(WITH_GPU) + endif() if(WITH_MKL) add_definitions(-DCINN_WITH_MKL_CBLAS) add_definitions(-DCINN_WITH_MKLDNN) - endif(WITH_MKL) -endif(WITH_CINN) + endif() +endif() if(WITH_CRYPTO) include(external/cryptopp) # download, build, install cryptopp list(APPEND third_party_deps extern_cryptopp) add_definitions(-DPADDLE_WITH_CRYPTO) -endif(WITH_CRYPTO) +endif() if(WITH_POCKETFFT) include(external/pocketfft) list(APPEND third_party_deps extern_pocketfft) add_definitions(-DPADDLE_WITH_POCKETFFT) -endif(WITH_POCKETFFT) +endif() if(WIN32) include(external/dirent) list(APPEND third_party_deps extern_dirent) -endif(WIN32) +endif() if(WITH_INFRT) include(external/llvm) diff --git a/cmake/unity_build.cmake b/cmake/unity_build.cmake index e18b2ef1ee..d1b97cf08f 100644 --- a/cmake/unity_build.cmake +++ b/cmake/unity_build.cmake @@ -67,7 +67,7 @@ function(register_unity_group TYPE) math(EXPR unity_group_index "${unity_group_index} + 1") set_property(GLOBAL PROPERTY ${UNITY_TARGET}_${TYPE}_group_index ${unity_group_index}) -endfunction(register_unity_group) +endfunction() # Combine the original source files used by `TARGET`, then use # `unity_target_${TYPE}_sources` to get the combined source files. @@ -145,7 +145,7 @@ function(compose_unity_target_sources TARGET TYPE) set(unity_target_${TYPE}_sources ${unity_target_sources} PARENT_SCOPE) -endfunction(compose_unity_target_sources) +endfunction() # Write the unity files used by `UNITY_TARGET`. # Write dependent on whether the contents of the unity file have changed, which @@ -179,4 +179,4 @@ function(finish_unity_target TYPE) endif() endforeach() endif() -endfunction(finish_unity_target) +endfunction() diff --git a/paddle/fluid/distributed/CMakeLists.txt b/paddle/fluid/distributed/CMakeLists.txt index 304a764f5b..0b5f608122 100755 --- a/paddle/fluid/distributed/CMakeLists.txt +++ b/paddle/fluid/distributed/CMakeLists.txt @@ -13,7 +13,7 @@ if(WITH_PYTHON) POST_BUILD COMMAND mv the_one_ps_pb2.py ${PADDLE_BINARY_DIR}/python/paddle/distributed/fleet/proto/) - else(NOT WIN32) + else() string( REPLACE "/" "\\" fleet_proto_dstpath "${PADDLE_BINARY_DIR}/python/paddle/distributed/fleet/proto/") @@ -24,7 +24,7 @@ if(WITH_PYTHON) COMMENT "Copy generated python the_one_ps_pb2 into directory ${fleet_proto_dstpath}." ) - endif(NOT WIN32) + endif() endif() if(NOT WITH_PSCORE) diff --git a/paddle/fluid/eager/auto_code_generator/CMakeLists.txt b/paddle/fluid/eager/auto_code_generator/CMakeLists.txt index aff7f057f4..ecfb40e947 100644 --- a/paddle/fluid/eager/auto_code_generator/CMakeLists.txt +++ b/paddle/fluid/eager/auto_code_generator/CMakeLists.txt @@ -73,7 +73,7 @@ if(WIN32) ${eager_generator_path} DEPENDS mklml) list(APPEND EAGER_CODEGEN_DEPS ${eager_generator_path}/libiomp5md.dll) - else(${CBLAS_PROVIDER} STREQUAL EXTERN_OPENBLAS) + else() message("Copied openblas.dll for Eager AutoCodeGen") add_custom_command( OUTPUT ${eager_generator_path}/openblas.dll diff --git a/paddle/fluid/framework/CMakeLists.txt b/paddle/fluid/framework/CMakeLists.txt index 5402beb49e..9fef2394c0 100755 --- a/paddle/fluid/framework/CMakeLists.txt +++ b/paddle/fluid/framework/CMakeLists.txt @@ -57,7 +57,7 @@ foreach(OP_DEF_FILE ${OP_DEF_FILES}) get_filename_component(OP_NAME ${OP_DEF_FILE} NAME_WE) file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/op_def.pbtxt "{\"${OP_NAME}\",R\"(${OP_DEF_CONTENT})\"},\n") -endforeach(OP_DEF_FILE) +endforeach() file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/op_def.pbtxt "{\"\",\"\"}};\n}") proto_library(heter_service_proto SRCS heter_service.proto) @@ -91,7 +91,7 @@ if(WITH_GPU) tensor SRCS tensor.cc tensor_util.cu DEPS place memory data_type device_context profiler dense_tensor) - endif(WIN32) + endif() elseif(WITH_ROCM) hip_library( tensor @@ -284,7 +284,7 @@ if(WITH_GPU) data_type_transform SRCS data_type_transform.cu DEPS tensor) - endif(WIN32) + endif() nv_test( data_type_transform_test SRCS data_type_transform_test.cc data_type_transform_test.cu @@ -575,7 +575,7 @@ if(WITH_PYTHON) COMMENT "Copy generated python proto into directory paddle/distributed/fleet/proto." ) - else(NOT WIN32) + else() string(REPLACE "/" "\\" proto_dstpath "${PADDLE_BINARY_DIR}/python/paddle/fluid/proto/") string( @@ -592,7 +592,7 @@ if(WITH_PYTHON) COMMENT "Copy generated python proto into directory paddle/distributed/fleet/proto." WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - endif(NOT WIN32) + endif() endif() if(WITH_PSCORE) @@ -606,7 +606,7 @@ if(WITH_PSCORE) COMMENT "Copy generated python proto into directory paddle/distributed/fleet/proto." ) -endif(WITH_PSCORE) +endif() cc_library( lod_rank_table @@ -651,7 +651,7 @@ else() feed_fetch_method graph_to_program_pass variable_helper) -endif(TENSORRT_FOUND) +endif() cc_library( executor_gc_helper diff --git a/paddle/fluid/framework/io/CMakeLists.txt b/paddle/fluid/framework/io/CMakeLists.txt index 0033e82517..4d21c6a892 100644 --- a/paddle/fluid/framework/io/CMakeLists.txt +++ b/paddle/fluid/framework/io/CMakeLists.txt @@ -13,4 +13,4 @@ cc_test( DEPS fs shell) if(WITH_CRYPTO) add_subdirectory(crypto) -endif(WITH_CRYPTO) +endif() diff --git a/paddle/fluid/framework/ir/CMakeLists.txt b/paddle/fluid/framework/ir/CMakeLists.txt index daafc4d1c0..ce52291709 100755 --- a/paddle/fluid/framework/ir/CMakeLists.txt +++ b/paddle/fluid/framework/ir/CMakeLists.txt @@ -84,7 +84,7 @@ cc_library( set(GRAPH_PATTERN_DETECTOR_DEPS graph graph_helper graph_traits) if(WITH_TESTING) set(GRAPH_PATTERN_DETECTOR_DEPS ${GRAPH_PATTERN_DETECTOR_DEPS} gtest) -endif(WITH_TESTING) +endif() cc_library( graph_pattern_detector SRCS graph_pattern_detector.cc diff --git a/paddle/fluid/imperative/CMakeLists.txt b/paddle/fluid/imperative/CMakeLists.txt index eaf0a09541..1c28744940 100644 --- a/paddle/fluid/imperative/CMakeLists.txt +++ b/paddle/fluid/imperative/CMakeLists.txt @@ -156,7 +156,7 @@ if(NOT WIN32) data_loader SRCS data_loader.cc DEPS enforce) -endif(NOT WIN32) +endif() if(WITH_GLOO) cc_library( imperative_gloo_context diff --git a/paddle/fluid/imperative/tests/CMakeLists.txt b/paddle/fluid/imperative/tests/CMakeLists.txt index 5084363b9c..5bb32674df 100644 --- a/paddle/fluid/imperative/tests/CMakeLists.txt +++ b/paddle/fluid/imperative/tests/CMakeLists.txt @@ -34,7 +34,7 @@ else() SRCS cncl_context_test.cc DEPS cncl_context) endif() -endif(WIN32) +endif() cc_test( test_gradient_accmulator diff --git a/paddle/fluid/operators/ipu/CMakeLists.txt b/paddle/fluid/operators/ipu/CMakeLists.txt index 66373d4b5f..3e330ea10d 100644 --- a/paddle/fluid/operators/ipu/CMakeLists.txt +++ b/paddle/fluid/operators/ipu/CMakeLists.txt @@ -1,3 +1,3 @@ if(WITH_IPU) op_library(ipu_runtime_op DEPS ipu_backend) -endif(WITH_IPU) +endif() diff --git a/paddle/fluid/platform/CMakeLists.txt b/paddle/fluid/platform/CMakeLists.txt index 247ff43b8a..e01e2eb599 100644 --- a/paddle/fluid/platform/CMakeLists.txt +++ b/paddle/fluid/platform/CMakeLists.txt @@ -2,7 +2,7 @@ proto_library(profiler_proto SRCS profiler.proto DEPS framework_proto simple_threadpool) if(WITH_GPU) proto_library(external_error_proto SRCS external_error.proto) -endif(WITH_GPU) +endif() if(WITH_PYTHON) py_proto_compile(profiler_py_proto SRCS profiler.proto) add_custom_target(profiler_py_proto_init ALL COMMAND ${CMAKE_COMMAND} -E @@ -19,7 +19,7 @@ if(WITH_PYTHON) COMMENT "Copy generated python proto into directory paddle/fluid/proto/profiler." WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - else(NOT WIN32) + else() string(REPLACE "/" "\\" proto_dstpath "${PADDLE_BINARY_DIR}/python/paddle/fluid/proto/profiler/") add_custom_command( @@ -31,7 +31,7 @@ if(WITH_PYTHON) COMMENT "Copy generated python proto into directory paddle/fluid/proto/profiler." WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - endif(NOT WIN32) + endif() endif() cc_library( diff --git a/paddle/fluid/platform/dynload/CMakeLists.txt b/paddle/fluid/platform/dynload/CMakeLists.txt index fa67961f02..fbccfe5265 100644 --- a/paddle/fluid/platform/dynload/CMakeLists.txt +++ b/paddle/fluid/platform/dynload/CMakeLists.txt @@ -49,7 +49,7 @@ endif() configure_file(cupti_lib_path.h.in ${CMAKE_CURRENT_BINARY_DIR}/cupti_lib_path.h) if(CUPTI_FOUND) list(APPEND CUDA_SRCS cupti.cc) -endif(CUPTI_FOUND) +endif() if(WITH_ROCM) hip_library( dynload_cuda diff --git a/paddle/fluid/pybind/CMakeLists.txt b/paddle/fluid/pybind/CMakeLists.txt index a99dded4d5..20460c78d2 100755 --- a/paddle/fluid/pybind/CMakeLists.txt +++ b/paddle/fluid/pybind/CMakeLists.txt @@ -91,7 +91,7 @@ if(NOT WIN32) set(PYBIND_DEPS ${PYBIND_DEPS} nccl_context) set(PYBIND_DEPS ${PYBIND_DEPS} heter_ccl_context) endif() -endif(NOT WIN32) +endif() if(WITH_PYTHON) list(APPEND PYBIND_DEPS py_func_op) @@ -153,12 +153,12 @@ if(WITH_GLOO) set(PYBIND_SRCS ${PYBIND_SRCS} gloo_context_py.cc) set(PYBIND_DEPS ${PYBIND_DEPS} imperative_gloo_context) set(PYBIND_DEPS ${PYBIND_DEPS} reducer) -endif(WITH_GLOO) +endif() if(WITH_CRYPTO) set(PYBIND_DEPS ${PYBIND_DEPS} paddle_crypto) set(PYBIND_SRCS ${PYBIND_SRCS} crypto.cc) -endif(WITH_CRYPTO) +endif() if(WITH_PSLIB) set(DISTRIBUTE_COMPILE_FLAGS @@ -169,7 +169,7 @@ if(WITH_PSLIB) endif() set_source_files_properties( heter_wrapper_py.cc PROPERTIES COMPILE_FLAGS ${DISTRIBUTE_COMPILE_FLAGS}) -endif(WITH_PSLIB) +endif() if(WITH_PSCORE) if(WITH_ARM_BRPC) set(DISTRIBUTE_COMPILE_FLAGS @@ -223,15 +223,15 @@ if(WITH_PYTHON) if(WITH_XPU_BKCL) list(APPEND OP_FUNCTION_GENERETOR_DEPS bkcl_context) - endif(WITH_XPU_BKCL) + endif() if(WITH_ASCEND_CL) list(APPEND OP_FUNCTION_GENERETOR_DEPS hccl_context) - endif(WITH_ASCEND_CL) + endif() if(WITH_CNCL) list(APPEND OP_FUNCTION_GENERETOR_DEPS cncl_context) - endif(WITH_CNCL) + endif() add_executable(op_function_generator op_function_generator.cc) target_link_libraries(op_function_generator ${OP_FUNCTION_GENERETOR_DEPS}) @@ -316,7 +316,7 @@ if(WITH_PYTHON) DEPENDS mklml) list(APPEND OP_IMPL_DEPS ${op_impl_path}/libiomp5md.dll) list(APPEND EAGER_OP_IMPL_DEPS ${op_impl_path}/libiomp5md.dll) - else(${CBLAS_PROVIDER} STREQUAL EXTERN_OPENBLAS) + else() add_custom_command( OUTPUT ${op_impl_path}/openblas.dll COMMAND ${CMAKE_COMMAND} -E copy ${OPENBLAS_SHARED_LIB} ${op_impl_path} @@ -370,7 +370,7 @@ if(WITH_PYTHON) COMMENT "copy_if_different ${tmp_eager_impl_file} to ${eager_impl_file}" DEPENDS ${EAGER_OP_IMPL_DEPS}) endif() - else(WIN32) + else() # If there are no *.so in /usr/lib or LD_LIBRARY_PATH, # copy these *.so to current directory and append current directory to # LD_LIBRARY_PATH. This is different with Windows platformm, which search @@ -446,7 +446,7 @@ if(WITH_PYTHON) DEPENDS ${EAGER_OP_IMPL_DEPS} VERBATIM) endif() - endif(WIN32) + endif() add_custom_target(op_function_generator_cmd ALL DEPENDS ${impl_file}) if(NOT ((NOT WITH_PYTHON) AND ON_INFER)) add_custom_target(eager_op_function_generator_cmd ALL @@ -495,7 +495,7 @@ if(WITH_PYTHON) if(NOT APPLE AND NOT WIN32) target_link_libraries(paddle_pybind rt) - endif(NOT APPLE AND NOT WIN32) + endif() if(WITH_ROCM) target_link_libraries(paddle_pybind ${ROCM_HIPRTC_LIB}) @@ -504,4 +504,4 @@ if(WITH_PYTHON) get_property(os_dependency_modules GLOBAL PROPERTY OS_DEPENDENCY_MODULES) target_link_libraries(paddle_pybind ${os_dependency_modules}) add_dependencies(paddle_pybind op_function_generator_cmd) -endif(WITH_PYTHON) +endif() diff --git a/paddle/phi/backends/dynload/CMakeLists.txt b/paddle/phi/backends/dynload/CMakeLists.txt index 408d524dca..5e5a9d4833 100644 --- a/paddle/phi/backends/dynload/CMakeLists.txt +++ b/paddle/phi/backends/dynload/CMakeLists.txt @@ -49,7 +49,7 @@ endif() configure_file(cupti_lib_path.h.in ${CMAKE_CURRENT_BINARY_DIR}/cupti_lib_path.h) if(CUPTI_FOUND) list(APPEND CUDA_SRCS cupti.cc) -endif(CUPTI_FOUND) +endif() if(WITH_ROCM) hip_library( phi_dynload_cuda diff --git a/paddle/phi/tests/core/CMakeLists.txt b/paddle/phi/tests/core/CMakeLists.txt index aeda9be3d2..c299559da5 100644 --- a/paddle/phi/tests/core/CMakeLists.txt +++ b/paddle/phi/tests/core/CMakeLists.txt @@ -58,7 +58,7 @@ if(WITH_TESTING AND TEST selected_rows_test) endif() if(NOT WIN32) cc_test(test_rw_lock SRCS test_rw_lock.cc) -endif(NOT WIN32) +endif() cc_test( test_string_tensor SRCS test_string_tensor.cc diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 0c1089b1fd..e33af8b1bd 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -109,7 +109,7 @@ if(WIN32) COMMENT "Packing whl packages------>>>" DEPENDS copy_paddle_pybind ${FLUID_CORE} framework_py_proto profiler_py_proto pass_desc_py_proto ${PY_FILES}) -else(WIN32) +else() add_custom_command( OUTPUT ${PADDLE_PYTHON_BUILD_DIR}/.timestamp COMMAND touch stub.cc diff --git a/python/paddle/fluid/tests/unittests/mlu/CMakeLists.txt b/python/paddle/fluid/tests/unittests/mlu/CMakeLists.txt index 5c680c564f..cac8e95521 100644 --- a/python/paddle/fluid/tests/unittests/mlu/CMakeLists.txt +++ b/python/paddle/fluid/tests/unittests/mlu/CMakeLists.txt @@ -12,18 +12,18 @@ string(REPLACE ".py" "" TEST_DIST_OPS "${TEST_DIST_OPS}") if(WITH_MLU) foreach(TEST_OP ${TEST_DIST_OPS}) list(REMOVE_ITEM TEST_OPS ${TEST_OP}) - endforeach(TEST_OP) + endforeach() list(REMOVE_ITEM TEST_OPS "test_spawn_mlu") foreach(TEST_OP ${TEST_OPS}) py_test_modules(${TEST_OP} MODULES ${TEST_OP}) - endforeach(TEST_OP) + endforeach() if(WITH_CNCL) list(APPEND TEST_DIST_OPS "test_spawn_mlu") foreach(TEST_OP ${TEST_DIST_OPS}) py_test_modules(${TEST_OP} MODULES ${TEST_OP}) - endforeach(TEST_OP) + endforeach() bash_test_modules(test_launch_async_mlu START_BASH test_launch_async_mlu.sh ENVS PADDLE_BINARY_DIR=${PADDLE_BINARY_DIR}) bash_test_modules(test_launch_cloud_mlu START_BASH test_launch_cloud_mlu.sh @@ -50,5 +50,5 @@ if(WITH_MLU) set_tests_properties(test_collective_allgather_api_mlu PROPERTIES TIMEOUT 120) set_tests_properties(test_c_comm_init_op_mlu PROPERTIES TIMEOUT 120) - endif(WITH_CNCL) + endif() endif() -- GitLab