diff --git a/CMakeLists.txt b/CMakeLists.txt index d62ae24020a122623f2d983ef125ea7e363fabe7..a2e933c838a29f9c1a76ae74efb6247fae1ee6b4 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,6 +62,7 @@ option(WITH_IPU "Compile PaddlePaddle with Graphcore IPU" OFF) option(WITH_ONNXRUNTIME "Compile PaddlePaddle with ONNXRUNTIME" OFF) option(WITH_CUSPARSELT "Compile PaddlePaddle with CUSPARSELT" OFF) option(WITH_SETUP_INSTALL "Compile PaddlePaddle with setup.py" OFF) +option(WITH_SHARED_PHI "Compile PaddlePaddle with SHARED LIB of PHI" OFF) # Note(zhouwei): It use option above, so put here include(init) include(generic) # simplify cmake module @@ -111,7 +112,7 @@ endif() if(WIN32) option(MSVC_STATIC_CRT "use static C Runtime library by default" ON) - + message("Build static library of PHI") set(CMAKE_SUPPRESS_REGENERATION ON) set(CMAKE_STATIC_LIBRARY_PREFIX lib) diff --git a/cmake/configure.cmake b/cmake/configure.cmake index f092607f9ad93398022be240947bc72d95a3ad75..dc661fce388fe182fdf60162814180ec8b5219c2 100644 --- a/cmake/configure.cmake +++ b/cmake/configure.cmake @@ -236,18 +236,6 @@ if(WITH_CUDNN_FRONTEND) add_definitions(-DPADDLE_WITH_CUDNN_FRONTEND) endif() -set(WITH_PHI_SHARED - ON - CACHE BOOL "" FORCE) -if(WIN32 - OR WITH_ROCM - OR WITH_XPU_KP - OR ON_INFER) - set(WITH_PHI_SHARED - OFF - CACHE BOOL "" FORCE) -endif() - -if(WITH_PHI_SHARED) +if(WITH_SHARED_PHI) add_definitions(-DPHI_SHARED) endif() diff --git a/cmake/inference_lib.cmake b/cmake/inference_lib.cmake index 0e6ba8c497efe1b79c47ea96ec5d6799ced6a12f..34d1fb7dd46fc4ca66ddffeba04ce82089c92c52 100755 --- a/cmake/inference_lib.cmake +++ b/cmake/inference_lib.cmake @@ -269,7 +269,7 @@ else() SRCS ${src_dir}/inference/api/paddle_*.h ${paddle_inference_lib} DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/lib) - if(WITH_PHI_SHARED) + if(WITH_SHARED_PHI) set(paddle_phi_lib ${PADDLE_BINARY_DIR}/paddle/phi/libphi.*) copy( inference_lib_dist diff --git a/paddle/fluid/eager/auto_code_generator/CMakeLists.txt b/paddle/fluid/eager/auto_code_generator/CMakeLists.txt index d187b1abb11ccfba59da63ca6906b2bd5ee3801c..51ab946f4f0f2eb1f9cd96c3e3d7e7a1784c9627 100644 --- a/paddle/fluid/eager/auto_code_generator/CMakeLists.txt +++ b/paddle/fluid/eager/auto_code_generator/CMakeLists.txt @@ -52,7 +52,7 @@ if(WIN32) set(eager_generator_path "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}") endif() - if(WITH_PHI_SHARED) + if(WITH_SHARED_PHI) message("Copied phi.dll for Eager AutoCodeGen") add_custom_command( OUTPUT ${eager_generator_path}/phi.dll diff --git a/paddle/fluid/pybind/CMakeLists.txt b/paddle/fluid/pybind/CMakeLists.txt index e25a0a7a85ecff20c0e72dc9a38d0af3051cddba..7bce2ba2144b9ab427390a217ee916675d55e9dc 100755 --- a/paddle/fluid/pybind/CMakeLists.txt +++ b/paddle/fluid/pybind/CMakeLists.txt @@ -330,7 +330,7 @@ if(WITH_PYTHON) ")\n" "exit /b 0") - if(WITH_PHI_SHARED) + if(WITH_SHARED_PHI) add_custom_command( OUTPUT ${op_impl_path}/phi.dll COMMAND ${CMAKE_COMMAND} -E copy ${PHI_LIB} ${op_impl_path} diff --git a/paddle/phi/CMakeLists.txt b/paddle/phi/CMakeLists.txt index bd9702f73d3e01a4ceb3a8f3cdbdc7dae712faa3..40e44bae076cc236a392aff631335a1223351e4a 100644 --- a/paddle/phi/CMakeLists.txt +++ b/paddle/phi/CMakeLists.txt @@ -97,7 +97,7 @@ set(PHI_SRCS ${infermeta_srcs} ${capi_srcs}) -if(WITH_PHI_SHARED) +if(WITH_SHARED_PHI) set(PHI_BUILD_TYPE SHARED CACHE INTERNAL "" FORCE) @@ -136,7 +136,7 @@ if(WIN32) endif() if(WIN32) - if(WITH_PHI_SHARED) + if(WITH_SHARED_PHI) set_property(TARGET phi PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS ON) set(PHI_NAME phi.dll @@ -147,7 +147,7 @@ if(WIN32) CACHE INTERNAL "" FORCE) endif() elseif(APPLE) - if(WITH_PHI_SHARED) + if(WITH_SHARED_PHI) set(PHI_NAME libphi.dylib CACHE INTERNAL "" FORCE) @@ -157,7 +157,7 @@ elseif(APPLE) CACHE INTERNAL "" FORCE) endif() else() - if(WITH_PHI_SHARED) + if(WITH_SHARED_PHI) set(PHI_NAME libphi.so CACHE INTERNAL "" FORCE) @@ -187,7 +187,7 @@ if(WITH_FLASHATTN) endif() # for inference static library -if(NOT WITH_PHI_SHARED) +if(NOT WITH_SHARED_PHI) get_property(phi_modules GLOBAL PROPERTY PHI_MODULES) set(phi_modules ${phi_modules} ${INFERENCE_DEPS} phi) set_property(GLOBAL PROPERTY PHI_MODULES "${phi_modules}") diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index 7c3b1d1f1c2ce0799248a5c45d362e5b922c3f17..928b6850e3d93bbd7f32d31b5cc1c11ab7f59762 100644 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -2958,17 +2958,17 @@ EOF startTime_s=`date +%s` set +e export MAX_JOBS=${parallel_number} - export WITH_DISTRIBUTE=OFF ON_INFER=ON WITH_TENSORRT=ON CUDA_ARCH_NAME=${CUDA_ARCH_NAME:-Auto} WITH_PYTHON=${WITH_PYTHON:-ON} WITH_ONNXRUNTIME=${WITH_ONNXRUNTIME:-OFF} + export WITH_DISTRIBUTE=OFF ON_INFER=ON WITH_TENSORRT=ON CUDA_ARCH_NAME=${CUDA_ARCH_NAME:-Auto} WITH_PYTHON=${WITH_PYTHON:-ON} WITH_ONNXRUNTIME=${WITH_ONNXRUNTIME:-OFF} WITH_SHARED_PHI=${WITH_SHARED_PHI:-OFF} echo "if you use setup.py to compile,please export envs as following in /paddle ..." cat << EOF ======================================== - export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release} WITH_GPU=${WITH_GPU:-OFF} WITH_CUDNN_DSO=${WITH_CUDNN_DSO:-OFF} WITH_TENSORRT=${WITH_TENSORRT:-ON} WITH_ROCM=${WITH_ROCM:-OFF} WITH_CINN=${WITH_CINN:-OFF} WITH_DISTRIBUTE=${distibuted_flag} WITH_MKL=${WITH_MKL:-ON} WITH_AVX=${WITH_AVX:-OFF} CUDA_ARCH_NAME=${CUDA_ARCH_NAME:-All} NEW_RELEASE_PYPI=${NEW_RELEASE_PYPI:-OFF} NEW_RELEASE_ALL=${NEW_RELEASE_ALL:-OFF} NEW_RELEASE_JIT=${NEW_RELEASE_JIT:-OFF} WITH_PYTHON=${WITH_PYTHON:-ON} CUDNN_ROOT=/usr/ WITH_TESTING=${WITH_TESTING:-ON} WITH_COVERAGE=${WITH_COVERAGE:-OFF} WITH_INCREMENTAL_COVERAGE=${WITH_INCREMENTAL_COVERAGE:-OFF} CMAKE_MODULE_PATH=/opt/rocm/hip/cmake CMAKE_EXPORT_COMPILE_COMMANDS=ON WITH_INFERENCE_API_TEST=${WITH_INFERENCE_API_TEST:-ON} INFERENCE_DEMO_INSTALL_DIR=${INFERENCE_DEMO_INSTALL_DIR} PY_VERSION=${PY_VERSION:-3.7} CMAKE_INSTALL_PREFIX=${INSTALL_PREFIX:-/paddle/build} WITH_PSCORE=${pscore_flag} WITH_PSLIB=${pslib_flag} WITH_GLOO=${gloo_flag} LITE_GIT_TAG=release/v2.10 WITH_XPU=${WITH_XPU:-OFF} WITH_IPU=${WITH_IPU:-OFF} XPU_SDK_ROOT=${XPU_SDK_ROOT:-""} WITH_LITE=${WITH_LITE:-OFF} WITH_XPU_BKCL=${WITH_XPU_BKCL:-OFF} WITH_ARM=${WITH_ARM:-OFF} WITH_STRIP=${WITH_STRIP:-ON} ON_INFER=${ON_INFER:-OFF} WITH_HETERPS=${WITH_HETERPS:-OFF} WITH_GPU_GRAPH=${WITH_GPU_GRAPH:-OFF} CUDA_ARCH_BIN=${CUDA_ARCH_BIN} WITH_RECORD_BUILDTIME=${WITH_RECORD_BUILDTIME:-OFF} WITH_UNITY_BUILD=${WITH_UNITY_BUILD:-OFF} WITH_ONNXRUNTIME=${WITH_ONNXRUNTIME:-OFF} WITH_CUDNN_FRONTEND=${WITH_CUDNN_FRONTEND:-OFF} + export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release} WITH_GPU=${WITH_GPU:-OFF} WITH_SHARED_PHI=${WITH_SHARED_PHI:-OFF} WITH_CUDNN_DSO=${WITH_CUDNN_DSO:-OFF} WITH_TENSORRT=${WITH_TENSORRT:-ON} WITH_ROCM=${WITH_ROCM:-OFF} WITH_CINN=${WITH_CINN:-OFF} WITH_DISTRIBUTE=${distibuted_flag} WITH_MKL=${WITH_MKL:-ON} WITH_AVX=${WITH_AVX:-OFF} CUDA_ARCH_NAME=${CUDA_ARCH_NAME:-All} NEW_RELEASE_PYPI=${NEW_RELEASE_PYPI:-OFF} NEW_RELEASE_ALL=${NEW_RELEASE_ALL:-OFF} NEW_RELEASE_JIT=${NEW_RELEASE_JIT:-OFF} WITH_PYTHON=${WITH_PYTHON:-ON} CUDNN_ROOT=/usr/ WITH_TESTING=${WITH_TESTING:-ON} WITH_COVERAGE=${WITH_COVERAGE:-OFF} WITH_INCREMENTAL_COVERAGE=${WITH_INCREMENTAL_COVERAGE:-OFF} CMAKE_MODULE_PATH=/opt/rocm/hip/cmake CMAKE_EXPORT_COMPILE_COMMANDS=ON WITH_INFERENCE_API_TEST=${WITH_INFERENCE_API_TEST:-ON} INFERENCE_DEMO_INSTALL_DIR=${INFERENCE_DEMO_INSTALL_DIR} PY_VERSION=${PY_VERSION:-3.7} CMAKE_INSTALL_PREFIX=${INSTALL_PREFIX:-/paddle/build} WITH_PSCORE=${pscore_flag} WITH_PSLIB=${pslib_flag} WITH_GLOO=${gloo_flag} LITE_GIT_TAG=release/v2.10 WITH_XPU=${WITH_XPU:-OFF} WITH_IPU=${WITH_IPU:-OFF} XPU_SDK_ROOT=${XPU_SDK_ROOT:-""} WITH_LITE=${WITH_LITE:-OFF} WITH_XPU_BKCL=${WITH_XPU_BKCL:-OFF} WITH_ARM=${WITH_ARM:-OFF} WITH_STRIP=${WITH_STRIP:-ON} ON_INFER=${ON_INFER:-OFF} WITH_HETERPS=${WITH_HETERPS:-OFF} WITH_GPU_GRAPH=${WITH_GPU_GRAPH:-OFF} CUDA_ARCH_BIN=${CUDA_ARCH_BIN} WITH_RECORD_BUILDTIME=${WITH_RECORD_BUILDTIME:-OFF} WITH_UNITY_BUILD=${WITH_UNITY_BUILD:-OFF} WITH_ONNXRUNTIME=${WITH_ONNXRUNTIME:-OFF} WITH_CUDNN_FRONTEND=${WITH_CUDNN_FRONTEND:-OFF} ======================================== EOF echo "if you use cmake to compile,please Configuring cmake in /paddle/build ..." cat <