未验证 提交 ffbf7135 编写于 作者: Z Zhou Wei 提交者: GitHub

modify custom op dependent from paddle_framework to paddle_custom_op (#31195)

上级 0f1fde51
...@@ -328,9 +328,10 @@ cc_test(custom_tensor_test SRCS custom_tensor_test.cc DEPS custom_tensor glog) ...@@ -328,9 +328,10 @@ cc_test(custom_tensor_test SRCS custom_tensor_test.cc DEPS custom_tensor glog)
set(FLUID_FRAMEWORK_MODULES proto_desc memory lod_tensor executor data_feed_proto layer dynamic_loader custom_operator) set(FLUID_FRAMEWORK_MODULES proto_desc memory lod_tensor executor data_feed_proto layer dynamic_loader custom_operator)
cc_library(paddle_framework DEPS ${FLUID_FRAMEWORK_MODULES}) cc_library(paddle_framework DEPS ${FLUID_FRAMEWORK_MODULES})
# Old custom op extension mechanism related, will be removed in 2.1.0
cc_library(paddle_framework_shared cc_library(paddle_framework_shared
SHARED SRCS executor.cc operator.cc custom_operator.cc ../extension/src/tensor.cc SHARED SRCS executor.cc operator.cc
../extension/src/op_meta_info.cc
${CMAKE_CURRENT_SOURCE_DIR}/c/c_api.cc ${CMAKE_CURRENT_SOURCE_DIR}/c/c_api.cc
${CMAKE_SOURCE_DIR}/paddle/fluid/imperative/layer.cc ${CMAKE_SOURCE_DIR}/paddle/fluid/imperative/layer.cc
DEPS ${FLUID_FRAMEWORK_MODULES}) DEPS ${FLUID_FRAMEWORK_MODULES})
...@@ -382,9 +383,9 @@ if (LINUX) ...@@ -382,9 +383,9 @@ if (LINUX)
endif() endif()
if (WIN32) if (WIN32)
set(PADDLE_CUSTOM_OP_SHARED_LIB set(PADDLE_CUSTOM_OP_IMPORT_LIB
${PADDLE_BINARY_DIR}/paddle/fluid/framework/${CMAKE_BUILD_TYPE}/paddle_custom_op.lib ${PADDLE_BINARY_DIR}/paddle/fluid/framework/${CMAKE_BUILD_TYPE}/paddle_custom_op.lib
CACHE INTERNAL "Paddle custom op lib") CACHE INTERNAL "Paddle custom op import lib")
set(PADDLE_CUSTOM_OP_SHARED_LIB set(PADDLE_CUSTOM_OP_SHARED_LIB
${PADDLE_BINARY_DIR}/paddle/fluid/framework/${CMAKE_BUILD_TYPE}/paddle_custom_op.dll ${PADDLE_BINARY_DIR}/paddle/fluid/framework/${CMAKE_BUILD_TYPE}/paddle_custom_op.dll
CACHE INTERNAL "Paddle custom op dll") CACHE INTERNAL "Paddle custom op dll")
......
...@@ -28,6 +28,7 @@ if not exist %cache_dir%\tools ( ...@@ -28,6 +28,7 @@ if not exist %cache_dir%\tools (
) )
taskkill /f /im op_function_generator.exe taskkill /f /im op_function_generator.exe
wmic process where name="op_function_generator.exe" call terminate wmic process where name="op_function_generator.exe" call terminate
taskkill /f /im python.exe 2>NUL
rem ------initialize common variable------ rem ------initialize common variable------
if not defined GENERATOR set GENERATOR="Visual Studio 14 2015 Win64" if not defined GENERATOR set GENERATOR="Visual Studio 14 2015 Win64"
...@@ -55,6 +56,7 @@ rem -------set cache build directory----------- ...@@ -55,6 +56,7 @@ rem -------set cache build directory-----------
rmdir build\python /s/q rmdir build\python /s/q
rmdir build\paddle_install_dir /s/q rmdir build\paddle_install_dir /s/q
rmdir build\paddle_inference_install_dir /s/q rmdir build\paddle_inference_install_dir /s/q
rmdir build\paddle_inference_c_install_dir /s/q
del build\CMakeCache.txt del build\CMakeCache.txt
: set CI_SKIP_CPP_TEST if only *.py changed : set CI_SKIP_CPP_TEST if only *.py changed
...@@ -77,7 +79,10 @@ setlocal enabledelayedexpansion ...@@ -77,7 +79,10 @@ setlocal enabledelayedexpansion
git show-ref --verify --quiet refs/heads/last_pr git show-ref --verify --quiet refs/heads/last_pr
if %ERRORLEVEL% EQU 0 ( if %ERRORLEVEL% EQU 0 (
git diff HEAD last_pr --stat --name-only git diff HEAD last_pr --stat --name-only
git diff HEAD last_pr --stat --name-only | findstr "cmake/[a-zA-Z]*\.cmake CMakeLists.txt" git diff HEAD last_pr --stat --name-only | findstr "setup.py.in"
if %ERRORLEVEL% EQU 0 (
rmdir build /s/q
)
git branch -D last_pr git branch -D last_pr
git branch last_pr git branch last_pr
) else ( ) else (
...@@ -246,11 +251,15 @@ set /p day_before=< %cache_dir%\day.txt ...@@ -246,11 +251,15 @@ set /p day_before=< %cache_dir%\day.txt
if %day_now% NEQ %day_before% ( if %day_now% NEQ %day_before% (
echo %day_now% > %cache_dir%\day.txt echo %day_now% > %cache_dir%\day.txt
type %cache_dir%\day.txt type %cache_dir%\day.txt
if %day_now% EQU 25 ( if %day_now% EQU 21 (
rmdir %cache_dir%\third_party_GPU/ /s/q rmdir %cache_dir%\third_party_GPU/ /s/q
rmdir %cache_dir%\third_party/ /s/q rmdir %cache_dir%\third_party/ /s/q
) )
if %day_now% EQU 10 ( if %day_now% EQU 11 (
rmdir %cache_dir%\third_party_GPU/ /s/q
rmdir %cache_dir%\third_party/ /s/q
)
if %day_now% EQU 01 (
rmdir %cache_dir%\third_party_GPU/ /s/q rmdir %cache_dir%\third_party_GPU/ /s/q
rmdir %cache_dir%\third_party/ /s/q rmdir %cache_dir%\third_party/ /s/q
) )
...@@ -604,8 +613,7 @@ python -c "import shutil;shutil.make_archive('paddle_inference', 'zip', root_dir ...@@ -604,8 +613,7 @@ python -c "import shutil;shutil.make_archive('paddle_inference', 'zip', root_dir
set /p libsize=< lib_size.txt set /p libsize=< lib_size.txt
for /F %%i in ("%libsize%") do ( for /F %%i in ("%libsize%") do (
set /a libsize_m=%%i/1024 set /a libsize_m=%%i/1024
echo "Windows Paddle_Inference Size: !libsize_m!M" echo "Windows Paddle_Inference ZIP Size: !libsize_m!M"
echo ipipe_log_param_Windows_Paddle_Inference_Size: !libsize_m!M
) )
goto:eof goto:eof
......
...@@ -44,7 +44,7 @@ MSVC_COMPILE_FLAGS = [ ...@@ -44,7 +44,7 @@ MSVC_COMPILE_FLAGS = [
'/DBOOST_HAS_STATIC_ASSERT', '/DNDEBUG', '/DPADDLE_USE_DSO' '/DBOOST_HAS_STATIC_ASSERT', '/DNDEBUG', '/DPADDLE_USE_DSO'
] ]
MSVC_LINK_FLAGS = ['/MACHINE:X64', 'paddle_framework.lib'] MSVC_LINK_FLAGS = ['/MACHINE:X64', 'paddle_custom_op.lib']
COMMON_NVCC_FLAGS = ['-DPADDLE_WITH_CUDA', '-DEIGEN_USE_GPU', '-O3'] COMMON_NVCC_FLAGS = ['-DPADDLE_WITH_CUDA', '-DEIGEN_USE_GPU', '-O3']
......
...@@ -335,21 +335,23 @@ if '${WITH_XPU_BKCL}' == 'ON': ...@@ -335,21 +335,23 @@ if '${WITH_XPU_BKCL}' == 'ON':
shutil.copy('${XPU_BKCL_LIB}', libs_path) shutil.copy('${XPU_BKCL_LIB}', libs_path)
package_data['paddle.libs']+=['${XPU_BKCL_LIB_NAME}'] package_data['paddle.libs']+=['${XPU_BKCL_LIB_NAME}']
### Old custom op extension mechanism related, will be removed in 2.1.0 ###
# copy libpaddle_framework.so to libs on linux # copy libpaddle_framework.so to libs on linux
if sys.platform.startswith('linux'): if sys.platform.startswith('linux'):
shutil.copy('${FLUID_FRAMEWORK_SHARED_LIB}', libs_path) shutil.copy('${FLUID_FRAMEWORK_SHARED_LIB}', libs_path)
package_data['paddle.libs'] += ['libpaddle_framework.so'] package_data['paddle.libs'] += ['libpaddle_framework.so']
### New custom op extension mechanism related ###
# copy libpaddle_custom_op.so to libs on linux # copy libpaddle_custom_op.so to libs on linux
if sys.platform.startswith('linux'): if sys.platform.startswith('linux'):
shutil.copy('${PADDLE_CUSTOM_OP_SHARED_LIB}', libs_path) shutil.copy('${PADDLE_CUSTOM_OP_SHARED_LIB}', libs_path)
package_data['paddle.libs'] += ['libpaddle_custom_op.so'] package_data['paddle.libs'] += ['libpaddle_custom_op.so']
# copy paddle_framework.lib/paddle_framework.dll to libs on windows # copy paddle_custom_op.lib/paddle_custom_op.dll to libs on Windows
if os.name == 'nt': if os.name == 'nt':
shutil.copy('${FLUID_FRAMEWORK_IMPORT_LIB}', libs_path) shutil.copy('${PADDLE_CUSTOM_OP_IMPORT_LIB}', libs_path)
shutil.copy('${FLUID_FRAMEWORK_SHARED_LIB}', libs_path) shutil.copy('${PADDLE_CUSTOM_OP_SHARED_LIB}', libs_path)
package_data['paddle.libs'] += ['paddle_framework.lib', 'paddle_framework.dll'] package_data['paddle.libs'] += ['paddle_custom_op.lib', 'paddle_custom_op.dll']
# remove unused paddle/libs/__init__.py # remove unused paddle/libs/__init__.py
if os.path.isfile(libs_path+'/__init__.py'): if os.path.isfile(libs_path+'/__init__.py'):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册