Skip to content

Commit ffbf713

Browse files
authored
modify custom op dependent from paddle_framework to paddle_custom_op (#31195)
1 parent 0f1fde5 commit ffbf713

File tree

4 files changed

+25
-14
lines changed

4 files changed

+25
-14
lines changed

paddle/fluid/framework/CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,10 @@ cc_test(custom_tensor_test SRCS custom_tensor_test.cc DEPS custom_tensor glog)
328328
set(FLUID_FRAMEWORK_MODULES proto_desc memory lod_tensor executor data_feed_proto layer dynamic_loader custom_operator)
329329

330330
cc_library(paddle_framework DEPS ${FLUID_FRAMEWORK_MODULES})
331+
332+
# Old custom op extension mechanism related, will be removed in 2.1.0
331333
cc_library(paddle_framework_shared
332-
SHARED SRCS executor.cc operator.cc custom_operator.cc ../extension/src/tensor.cc
333-
../extension/src/op_meta_info.cc
334+
SHARED SRCS executor.cc operator.cc
334335
${CMAKE_CURRENT_SOURCE_DIR}/c/c_api.cc
335336
${CMAKE_SOURCE_DIR}/paddle/fluid/imperative/layer.cc
336337
DEPS ${FLUID_FRAMEWORK_MODULES})
@@ -382,9 +383,9 @@ if (LINUX)
382383
endif()
383384

384385
if (WIN32)
385-
set(PADDLE_CUSTOM_OP_SHARED_LIB
386+
set(PADDLE_CUSTOM_OP_IMPORT_LIB
386387
${PADDLE_BINARY_DIR}/paddle/fluid/framework/${CMAKE_BUILD_TYPE}/paddle_custom_op.lib
387-
CACHE INTERNAL "Paddle custom op lib")
388+
CACHE INTERNAL "Paddle custom op import lib")
388389
set(PADDLE_CUSTOM_OP_SHARED_LIB
389390
${PADDLE_BINARY_DIR}/paddle/fluid/framework/${CMAKE_BUILD_TYPE}/paddle_custom_op.dll
390391
CACHE INTERNAL "Paddle custom op dll")

paddle/scripts/paddle_build.bat

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ if not exist %cache_dir%\tools (
2828
)
2929
taskkill /f /im op_function_generator.exe
3030
wmic process where name="op_function_generator.exe" call terminate
31+
taskkill /f /im python.exe 2>NUL
3132

3233
rem ------initialize common variable------
3334
if not defined GENERATOR set GENERATOR="Visual Studio 14 2015 Win64"
@@ -55,6 +56,7 @@ rem -------set cache build directory-----------
5556
rmdir build\python /s/q
5657
rmdir build\paddle_install_dir /s/q
5758
rmdir build\paddle_inference_install_dir /s/q
59+
rmdir build\paddle_inference_c_install_dir /s/q
5860
del build\CMakeCache.txt
5961

6062
: set CI_SKIP_CPP_TEST if only *.py changed
@@ -77,7 +79,10 @@ setlocal enabledelayedexpansion
7779
git show-ref --verify --quiet refs/heads/last_pr
7880
if %ERRORLEVEL% EQU 0 (
7981
git diff HEAD last_pr --stat --name-only
80-
git diff HEAD last_pr --stat --name-only | findstr "cmake/[a-zA-Z]*\.cmake CMakeLists.txt"
82+
git diff HEAD last_pr --stat --name-only | findstr "setup.py.in"
83+
if %ERRORLEVEL% EQU 0 (
84+
rmdir build /s/q
85+
)
8186
git branch -D last_pr
8287
git branch last_pr
8388
) else (
@@ -246,11 +251,15 @@ set /p day_before=< %cache_dir%\day.txt
246251
if %day_now% NEQ %day_before% (
247252
echo %day_now% > %cache_dir%\day.txt
248253
type %cache_dir%\day.txt
249-
if %day_now% EQU 25 (
254+
if %day_now% EQU 21 (
250255
rmdir %cache_dir%\third_party_GPU/ /s/q
251256
rmdir %cache_dir%\third_party/ /s/q
252257
)
253-
if %day_now% EQU 10 (
258+
if %day_now% EQU 11 (
259+
rmdir %cache_dir%\third_party_GPU/ /s/q
260+
rmdir %cache_dir%\third_party/ /s/q
261+
)
262+
if %day_now% EQU 01 (
254263
rmdir %cache_dir%\third_party_GPU/ /s/q
255264
rmdir %cache_dir%\third_party/ /s/q
256265
)
@@ -604,8 +613,7 @@ python -c "import shutil;shutil.make_archive('paddle_inference', 'zip', root_dir
604613
set /p libsize=< lib_size.txt
605614
for /F %%i in ("%libsize%") do (
606615
set /a libsize_m=%%i/1024
607-
echo "Windows Paddle_Inference Size: !libsize_m!M"
608-
echo ipipe_log_param_Windows_Paddle_Inference_Size: !libsize_m!M
616+
echo "Windows Paddle_Inference ZIP Size: !libsize_m!M"
609617
)
610618
goto:eof
611619

python/paddle/utils/cpp_extension/extension_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
'/DBOOST_HAS_STATIC_ASSERT', '/DNDEBUG', '/DPADDLE_USE_DSO'
4545
]
4646

47-
MSVC_LINK_FLAGS = ['/MACHINE:X64', 'paddle_framework.lib']
47+
MSVC_LINK_FLAGS = ['/MACHINE:X64', 'paddle_custom_op.lib']
4848

4949
COMMON_NVCC_FLAGS = ['-DPADDLE_WITH_CUDA', '-DEIGEN_USE_GPU', '-O3']
5050

python/setup.py.in

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,21 +335,23 @@ if '${WITH_XPU_BKCL}' == 'ON':
335335
shutil.copy('${XPU_BKCL_LIB}', libs_path)
336336
package_data['paddle.libs']+=['${XPU_BKCL_LIB_NAME}']
337337

338+
### Old custom op extension mechanism related, will be removed in 2.1.0 ###
338339
# copy libpaddle_framework.so to libs on linux
339340
if sys.platform.startswith('linux'):
340341
shutil.copy('${FLUID_FRAMEWORK_SHARED_LIB}', libs_path)
341342
package_data['paddle.libs'] += ['libpaddle_framework.so']
342343

344+
### New custom op extension mechanism related ###
343345
# copy libpaddle_custom_op.so to libs on linux
344346
if sys.platform.startswith('linux'):
345347
shutil.copy('${PADDLE_CUSTOM_OP_SHARED_LIB}', libs_path)
346348
package_data['paddle.libs'] += ['libpaddle_custom_op.so']
347349

348-
# copy paddle_framework.lib/paddle_framework.dll to libs on windows
350+
# copy paddle_custom_op.lib/paddle_custom_op.dll to libs on Windows
349351
if os.name == 'nt':
350-
shutil.copy('${FLUID_FRAMEWORK_IMPORT_LIB}', libs_path)
351-
shutil.copy('${FLUID_FRAMEWORK_SHARED_LIB}', libs_path)
352-
package_data['paddle.libs'] += ['paddle_framework.lib', 'paddle_framework.dll']
352+
shutil.copy('${PADDLE_CUSTOM_OP_IMPORT_LIB}', libs_path)
353+
shutil.copy('${PADDLE_CUSTOM_OP_SHARED_LIB}', libs_path)
354+
package_data['paddle.libs'] += ['paddle_custom_op.lib', 'paddle_custom_op.dll']
353355

354356
# remove unused paddle/libs/__init__.py
355357
if os.path.isfile(libs_path+'/__init__.py'):

0 commit comments

Comments
 (0)