File tree Expand file tree Collapse file tree 11 files changed +32
-39
lines changed
eager/auto_code_generator Expand file tree Collapse file tree 11 files changed +32
-39
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ option(WITH_IPU "Compile PaddlePaddle with Graphcore IPU" OFF)
62
62
option (WITH_ONNXRUNTIME "Compile PaddlePaddle with ONNXRUNTIME" OFF )
63
63
option (WITH_CUSPARSELT "Compile PaddlePaddle with CUSPARSELT" OFF )
64
64
option (WITH_SETUP_INSTALL "Compile PaddlePaddle with setup.py" OFF )
65
+ option (WITH_SHARED_PHI "Compile PaddlePaddle with SHARED LIB of PHI" OFF )
65
66
# Note(zhouwei): It use option above, so put here
66
67
include (init )
67
68
include (generic ) # simplify cmake module
@@ -111,7 +112,7 @@ endif()
111
112
112
113
if (WIN32 )
113
114
option (MSVC_STATIC_CRT "use static C Runtime library by default" ON )
114
-
115
+ message ( "Build static library of PHI" )
115
116
set (CMAKE_SUPPRESS_REGENERATION ON )
116
117
set (CMAKE_STATIC_LIBRARY_PREFIX lib )
117
118
Original file line number Diff line number Diff line change @@ -236,18 +236,6 @@ if(WITH_CUDNN_FRONTEND)
236
236
add_definitions (-DPADDLE_WITH_CUDNN_FRONTEND )
237
237
endif ()
238
238
239
- set (WITH_PHI_SHARED
240
- ON
241
- CACHE BOOL "" FORCE )
242
- if (WIN32
243
- OR WITH_ROCM
244
- OR WITH_XPU_KP
245
- OR ON_INFER )
246
- set (WITH_PHI_SHARED
247
- OFF
248
- CACHE BOOL "" FORCE )
249
- endif ()
250
-
251
- if (WITH_PHI_SHARED )
239
+ if (WITH_SHARED_PHI )
252
240
add_definitions (-DPHI_SHARED )
253
241
endif ()
Original file line number Diff line number Diff line change @@ -269,7 +269,7 @@ else()
269
269
SRCS ${src_dir} /inference/api/paddle_*.h ${paddle_inference_lib}
270
270
DSTS ${PADDLE_INFERENCE_INSTALL_DIR} /paddle/include
271
271
${PADDLE_INFERENCE_INSTALL_DIR} /paddle/lib )
272
- if (WITH_PHI_SHARED )
272
+ if (WITH_SHARED_PHI )
273
273
set (paddle_phi_lib ${PADDLE_BINARY_DIR} /paddle/phi/libphi.* )
274
274
copy (
275
275
inference_lib_dist
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ if(WIN32)
52
52
set (eager_generator_path "${CMAKE_CURRENT_BINARY_DIR} /${CMAKE_BUILD_TYPE} " )
53
53
endif ()
54
54
55
- if (WITH_PHI_SHARED )
55
+ if (WITH_SHARED_PHI )
56
56
message ("Copied phi.dll for Eager AutoCodeGen" )
57
57
add_custom_command (
58
58
OUTPUT ${eager_generator_path} /phi.dll
Original file line number Diff line number Diff line change @@ -330,7 +330,7 @@ if(WITH_PYTHON)
330
330
")\n "
331
331
"exit /b 0" )
332
332
333
- if (WITH_PHI_SHARED )
333
+ if (WITH_SHARED_PHI )
334
334
add_custom_command (
335
335
OUTPUT ${op_impl_path} /phi.dll
336
336
COMMAND ${CMAKE_COMMAND} -E copy ${PHI_LIB} ${op_impl_path}
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ set(PHI_SRCS
97
97
${infermeta_srcs}
98
98
${capi_srcs} )
99
99
100
- if (WITH_PHI_SHARED )
100
+ if (WITH_SHARED_PHI )
101
101
set (PHI_BUILD_TYPE
102
102
SHARED
103
103
CACHE INTERNAL "" FORCE )
@@ -136,7 +136,7 @@ if(WIN32)
136
136
endif ()
137
137
138
138
if (WIN32 )
139
- if (WITH_PHI_SHARED )
139
+ if (WITH_SHARED_PHI )
140
140
set_property (TARGET phi PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS ON )
141
141
set (PHI_NAME
142
142
phi.dll
@@ -147,7 +147,7 @@ if(WIN32)
147
147
CACHE INTERNAL "" FORCE )
148
148
endif ()
149
149
elseif (APPLE )
150
- if (WITH_PHI_SHARED )
150
+ if (WITH_SHARED_PHI )
151
151
set (PHI_NAME
152
152
libphi.dylib
153
153
CACHE INTERNAL "" FORCE )
@@ -157,7 +157,7 @@ elseif(APPLE)
157
157
CACHE INTERNAL "" FORCE )
158
158
endif ()
159
159
else ()
160
- if (WITH_PHI_SHARED )
160
+ if (WITH_SHARED_PHI )
161
161
set (PHI_NAME
162
162
libphi.so
163
163
CACHE INTERNAL "" FORCE )
@@ -187,7 +187,7 @@ if(WITH_FLASHATTN)
187
187
endif ()
188
188
189
189
# for inference static library
190
- if (NOT WITH_PHI_SHARED )
190
+ if (NOT WITH_SHARED_PHI )
191
191
get_property (phi_modules GLOBAL PROPERTY PHI_MODULES )
192
192
set (phi_modules ${phi_modules} ${INFERENCE_DEPS} phi )
193
193
set_property (GLOBAL PROPERTY PHI_MODULES "${phi_modules} " )
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ env_dict={
12
12
'FLUID_CORE_NAME':'@FLUID_CORE_NAME@',
13
13
'PHI_LIB':'@PHI_LIB@',
14
14
'PHI_NAME':'@PHI_NAME@',
15
- 'WITH_PHI_SHARED ':'@WITH_PHI_SHARED @',
15
+ 'WITH_SHARED_PHI ':'@WITH_SHARED_PHI @',
16
16
'WARPCTC_LIBRARIES':'@WARPCTC_LIBRARIES@',
17
17
'WARPRNNT_LIBRARIES':'@WARPRNNT_LIBRARIES@',
18
18
'FLASHATTN_LIBRARIES':'@FLASHATTN_LIBRARIES@',
Original file line number Diff line number Diff line change @@ -563,7 +563,7 @@ package_dir={
563
563
libs_path='${PADDLE_BINARY_DIR}/python/paddle/libs'
564
564
565
565
package_data['paddle.libs']= []
566
- if('${WITH_PHI_SHARED }' == 'ON'):
566
+ if('${WITH_SHARED_PHI }' == 'ON'):
567
567
package_data['paddle.libs'] = [('libphi' if os.name != 'nt' else 'phi') + ext_name]
568
568
shutil.copy('${PHI_LIB}', libs_path)
569
569
@@ -728,12 +728,12 @@ if '${CMAKE_BUILD_TYPE}' == 'Release':
728
728
if "@APPLE@" == "1":
729
729
commands = ["install_name_tool -id '@loader_path/../libs/' ${PADDLE_BINARY_DIR}/python/paddle/fluid/${FLUID_CORE_NAME}" + '.so']
730
730
commands.append("install_name_tool -add_rpath '@loader_path/../libs/' ${PADDLE_BINARY_DIR}/python/paddle/fluid/${FLUID_CORE_NAME}" + '.so')
731
- if('${WITH_PHI_SHARED }' == 'ON'):
731
+ if('${WITH_SHARED_PHI }' == 'ON'):
732
732
# change rpath of phi.ext for loading 3rd party libb
733
733
commands.append("install_name_tool -add_rpath '@loader_path' ${PADDLE_BINARY_DIR}/python/paddle/libs/${PHI_NAME}")
734
734
else:
735
735
commands = ["patchelf --set-rpath '$ORIGIN/../libs/' ${PADDLE_BINARY_DIR}/python/paddle/fluid/${FLUID_CORE_NAME}" + '.so']
736
- if('${WITH_PHI_SHARED }' == 'ON'):
736
+ if('${WITH_SHARED_PHI }' == 'ON'):
737
737
# change rpath of phi.ext for loading 3rd party lib
738
738
commands.append("patchelf --set-rpath '$ORIGIN' ${PADDLE_BINARY_DIR}/python/paddle/libs/${PHI_NAME}")
739
739
# The sw_64 not suppot patchelf, so we just disable that.
Original file line number Diff line number Diff line change @@ -967,7 +967,7 @@ def get_package_data_and_package_dir():
967
967
libs_path = paddle_binary_dir + '/python/paddle/libs'
968
968
package_data ['paddle.libs' ] = []
969
969
970
- if env_dict .get ("WITH_PHI_SHARED " ) == "ON" :
970
+ if env_dict .get ("WITH_SHARED_PHI " ) == "ON" :
971
971
package_data ['paddle.libs' ] = [
972
972
('libphi' if os .name != 'nt' else 'phi' ) + ext_suffix
973
973
]
@@ -1211,7 +1211,7 @@ def get_package_data_and_package_dir():
1211
1211
+ env_dict .get ("FLUID_CORE_NAME" )
1212
1212
+ '.so'
1213
1213
)
1214
- if env_dict .get ("WITH_PHI_SHARED " ) == "ON" :
1214
+ if env_dict .get ("WITH_SHARED_PHI " ) == "ON" :
1215
1215
commands .append (
1216
1216
"install_name_tool -add_rpath '@loader_path' "
1217
1217
+ env_dict .get ("PADDLE_BINARY_DIR" )
@@ -1226,7 +1226,7 @@ def get_package_data_and_package_dir():
1226
1226
+ env_dict .get ("FLUID_CORE_NAME" )
1227
1227
+ '.so'
1228
1228
]
1229
- if env_dict .get ("WITH_PHI_SHARED " ) == "ON" :
1229
+ if env_dict .get ("WITH_SHARED_PHI " ) == "ON" :
1230
1230
commands .append (
1231
1231
"patchelf --set-rpath '$ORIGIN' "
1232
1232
+ env_dict .get ("PADDLE_BINARY_DIR" )
You can’t perform that action at this time.
0 commit comments