Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
99c5c27d
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
99c5c27d
编写于
6月 28, 2022
作者:
S
Sing_chan
提交者:
GitHub
6月 28, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Revert "make inference_api_test compile with dynamic linking library (#41944)" (#43882)"
This reverts commit
e6d81ddf
.
上级
6cb24967
变更
11
显示空白变更内容
内联
并排
Showing
11 changed file
with
75 addition
and
39 deletion
+75
-39
paddle/fluid/inference/CMakeLists.txt
paddle/fluid/inference/CMakeLists.txt
+2
-0
paddle/fluid/inference/analysis/CMakeLists.txt
paddle/fluid/inference/analysis/CMakeLists.txt
+4
-4
paddle/fluid/inference/capi/CMakeLists.txt
paddle/fluid/inference/capi/CMakeLists.txt
+0
-4
paddle/fluid/inference/capi_exp/CMakeLists.txt
paddle/fluid/inference/capi_exp/CMakeLists.txt
+0
-4
paddle/fluid/inference/tests/api/CMakeLists.txt
paddle/fluid/inference/tests/api/CMakeLists.txt
+45
-18
paddle/fluid/inference/tests/api/analyzer_image_classification_tester.cc
...ference/tests/api/analyzer_image_classification_tester.cc
+5
-5
paddle/fluid/inference/tests/api/trt_fc_prelu_test.cc
paddle/fluid/inference/tests/api/trt_fc_prelu_test.cc
+5
-0
paddle/fluid/inference/tests/api/trt_mobilenet_test.cc
paddle/fluid/inference/tests/api/trt_mobilenet_test.cc
+5
-0
paddle/fluid/inference/tests/api/trt_resnext_test.cc
paddle/fluid/inference/tests/api/trt_resnext_test.cc
+5
-0
paddle/phi/common/place.h
paddle/phi/common/place.h
+2
-3
paddle/scripts/paddle_build.bat
paddle/scripts/paddle_build.bat
+2
-1
未找到文件。
paddle/fluid/inference/CMakeLists.txt
浏览文件 @
99c5c27d
...
@@ -119,6 +119,8 @@ cc_library(
...
@@ -119,6 +119,8 @@ cc_library(
get_property
(
os_dependency_modules GLOBAL PROPERTY OS_DEPENDENCY_MODULES
)
get_property
(
os_dependency_modules GLOBAL PROPERTY OS_DEPENDENCY_MODULES
)
target_link_libraries
(
paddle_inference_shared
${
os_dependency_modules
}
)
target_link_libraries
(
paddle_inference_shared
${
os_dependency_modules
}
)
if
(
WIN32
)
if
(
WIN32
)
set_property
(
TARGET paddle_inference_shared
PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS ON
)
target_link_libraries
(
paddle_inference_shared gflags
)
target_link_libraries
(
paddle_inference_shared gflags
)
endif
()
endif
()
...
...
paddle/fluid/inference/analysis/CMakeLists.txt
浏览文件 @
99c5c27d
...
@@ -49,10 +49,10 @@ function(inference_analysis_test_build TARGET)
...
@@ -49,10 +49,10 @@ function(inference_analysis_test_build TARGET)
SRCS
SRCS
${
analysis_test_SRCS
}
${
analysis_test_SRCS
}
DEPS
DEPS
${
analysis_test_EXTRA_DEPS
}
analysis
analysis
pass
pass
${
GLOB_PASS_LIB
}
${
GLOB_PASS_LIB
}
)
${
analysis_test_EXTRA_DEPS
}
)
endif
()
endif
()
endfunction
()
endfunction
()
...
@@ -80,10 +80,10 @@ function(inference_analysis_test TARGET)
...
@@ -80,10 +80,10 @@ function(inference_analysis_test TARGET)
SRCS
SRCS
${
analysis_test_SRCS
}
${
analysis_test_SRCS
}
DEPS
DEPS
${
analysis_test_EXTRA_DEPS
}
analysis
analysis
pass
pass
${
GLOB_PASS_LIB
}
${
GLOB_PASS_LIB
}
)
${
analysis_test_EXTRA_DEPS
}
)
inference_base_test_run
(
${
TARGET
}
COMMAND
${
TARGET
}
ARGS
inference_base_test_run
(
${
TARGET
}
COMMAND
${
TARGET
}
ARGS
${
analysis_test_ARGS
}
)
${
analysis_test_ARGS
}
)
endif
()
endif
()
...
...
paddle/fluid/inference/capi/CMakeLists.txt
浏览文件 @
99c5c27d
...
@@ -20,10 +20,6 @@ cc_library(
...
@@ -20,10 +20,6 @@ cc_library(
SRCS
${
C_API_SRCS
}
SRCS
${
C_API_SRCS
}
DEPS paddle_inference
)
DEPS paddle_inference
)
if
(
NOT ON_INFER
)
return
()
endif
()
# Create inference capi shared library
# Create inference capi shared library
cc_library
(
cc_library
(
paddle_inference_c_shared SHARED
paddle_inference_c_shared SHARED
...
...
paddle/fluid/inference/capi_exp/CMakeLists.txt
浏览文件 @
99c5c27d
...
@@ -20,10 +20,6 @@ cc_library(
...
@@ -20,10 +20,6 @@ cc_library(
SRCS
${
C_API_SRCS
}
SRCS
${
C_API_SRCS
}
DEPS paddle_inference
)
DEPS paddle_inference
)
if
(
NOT ON_INFER
)
return
()
endif
()
# Create inference capi shared library
# Create inference capi shared library
cc_library
(
cc_library
(
paddle_inference_c_shared SHARED
paddle_inference_c_shared SHARED
...
...
paddle/fluid/inference/tests/api/CMakeLists.txt
浏览文件 @
99c5c27d
if
(
NOT APPLE AND NOT WIN32
)
set
(
INFERENCE_EXTRA_DEPS paddle_inference_shared
)
set
(
INFERENCE_EXTRA_DEPS paddle_inference_shared
)
else
()
set
(
INFERENCE_EXTRA_DEPS paddle_inference_api paddle_inference_io
ir_pass_manager analysis_predictor benchmark
)
endif
()
if
(
WITH_GPU AND TENSORRT_FOUND
)
set
(
INFERENCE_EXTRA_DEPS
${
INFERENCE_EXTRA_DEPS
}
analysis
${
analysis_deps
}
)
endif
()
function
(
download_data install_dir data_file check_sum
)
function
(
download_data install_dir data_file check_sum
)
string
(
REGEX MATCH
"[^/
\\
]+$"
file_name
${
data_file
}
)
string
(
REGEX MATCH
"[^/
\\
]+$"
file_name
${
data_file
}
)
...
@@ -948,18 +939,26 @@ if(WITH_GPU AND TENSORRT_FOUND)
...
@@ -948,18 +939,26 @@ if(WITH_GPU AND TENSORRT_FOUND)
analyzer_capi_exp_gpu_tester.cc
analyzer_capi_exp_gpu_tester.cc
EXTRA_DEPS
EXTRA_DEPS
${
INFERENCE_EXTRA_DEPS
}
${
INFERENCE_EXTRA_DEPS
}
paddle_inference_c
ARGS
ARGS
--infer_model=
${
TRT_MODEL_INSTALL_DIR
}
/trt_inference_test_models
)
--infer_model=
${
TRT_MODEL_INSTALL_DIR
}
/trt_inference_test_models
)
if
(
WIN32
)
target_link_libraries
(
test_analyzer_capi_exp_gpu paddle_inference_c_shared
)
else
()
target_link_libraries
(
test_analyzer_capi_exp_gpu paddle_inference_c
)
endif
()
inference_analysis_test
(
inference_analysis_test
(
test_analyzer_capi_exp_xpu
test_analyzer_capi_exp_xpu
SRCS
SRCS
analyzer_capi_exp_xpu_tester.cc
analyzer_capi_exp_xpu_tester.cc
EXTRA_DEPS
EXTRA_DEPS
${
INFERENCE_EXTRA_DEPS
}
${
INFERENCE_EXTRA_DEPS
}
paddle_inference_c
ARGS
ARGS
--infer_model=
${
TRT_MODEL_INSTALL_DIR
}
/trt_inference_test_models
)
--infer_model=
${
TRT_MODEL_INSTALL_DIR
}
/trt_inference_test_models
)
if
(
WIN32
)
target_link_libraries
(
test_analyzer_capi_exp_xpu paddle_inference_c_shared
)
else
()
target_link_libraries
(
test_analyzer_capi_exp_xpu paddle_inference_c
)
endif
()
set
(
TRT_MODEL_QUANT_RESNET_DIR
set
(
TRT_MODEL_QUANT_RESNET_DIR
"
${
INFERENCE_DEMO_INSTALL_DIR
}
/small_quant_model"
)
"
${
INFERENCE_DEMO_INSTALL_DIR
}
/small_quant_model"
)
...
@@ -1107,9 +1106,13 @@ inference_analysis_test(
...
@@ -1107,9 +1106,13 @@ inference_analysis_test(
analyzer_capi_exp_tester.cc
analyzer_capi_exp_tester.cc
EXTRA_DEPS
EXTRA_DEPS
${
INFERENCE_EXTRA_DEPS
}
${
INFERENCE_EXTRA_DEPS
}
paddle_inference_c
ARGS
ARGS
--infer_model=
${
RESNET50_MODEL_DIR
}
/model
)
--infer_model=
${
RESNET50_MODEL_DIR
}
/model
)
if
(
WIN32
)
target_link_libraries
(
test_analyzer_capi_exp paddle_inference_c_shared
)
else
()
target_link_libraries
(
test_analyzer_capi_exp paddle_inference_c
)
endif
()
inference_analysis_test
(
inference_analysis_test
(
test_analyzer_capi_exp_pd_config
test_analyzer_capi_exp_pd_config
...
@@ -1117,9 +1120,14 @@ inference_analysis_test(
...
@@ -1117,9 +1120,14 @@ inference_analysis_test(
analyzer_capi_exp_pd_config_tester.cc
analyzer_capi_exp_pd_config_tester.cc
EXTRA_DEPS
EXTRA_DEPS
${
INFERENCE_EXTRA_DEPS
}
${
INFERENCE_EXTRA_DEPS
}
paddle_inference_c
ARGS
ARGS
--infer_model=
${
MOBILENET_INSTALL_DIR
}
/model
)
--infer_model=
${
MOBILENET_INSTALL_DIR
}
/model
)
if
(
WIN32
)
target_link_libraries
(
test_analyzer_capi_exp_pd_config
paddle_inference_c_shared
)
else
()
target_link_libraries
(
test_analyzer_capi_exp_pd_config paddle_inference_c
)
endif
()
inference_analysis_test
(
inference_analysis_test
(
test_analyzer_capi_exp_pd_tensor
test_analyzer_capi_exp_pd_tensor
...
@@ -1127,9 +1135,14 @@ inference_analysis_test(
...
@@ -1127,9 +1135,14 @@ inference_analysis_test(
analyzer_capi_exp_pd_tensor_tester.cc
analyzer_capi_exp_pd_tensor_tester.cc
EXTRA_DEPS
EXTRA_DEPS
${
INFERENCE_EXTRA_DEPS
}
${
INFERENCE_EXTRA_DEPS
}
paddle_inference_c
ARGS
ARGS
--infer_model=
${
MOBILENET_INSTALL_DIR
}
/model
)
--infer_model=
${
MOBILENET_INSTALL_DIR
}
/model
)
if
(
WIN32
)
target_link_libraries
(
test_analyzer_capi_exp_pd_tensor
paddle_inference_c_shared
)
else
()
target_link_libraries
(
test_analyzer_capi_exp_pd_tensor paddle_inference_c
)
endif
()
if
(
NOT APPLE AND NOT WIN32
)
if
(
NOT APPLE AND NOT WIN32
)
inference_analysis_test
(
inference_analysis_test
(
...
@@ -1138,10 +1151,16 @@ if(NOT APPLE AND NOT WIN32)
...
@@ -1138,10 +1151,16 @@ if(NOT APPLE AND NOT WIN32)
analyzer_capi_exp_pd_threads_tester.cc
analyzer_capi_exp_pd_threads_tester.cc
EXTRA_DEPS
EXTRA_DEPS
${
INFERENCE_EXTRA_DEPS
}
${
INFERENCE_EXTRA_DEPS
}
paddle_inference_c
ARGS
ARGS
--infer_model=
${
MOBILENET_INSTALL_DIR
}
/model
)
--infer_model=
${
MOBILENET_INSTALL_DIR
}
/model
)
if
(
WIN32
)
target_link_libraries
(
test_analyzer_capi_exp_pd_threads
paddle_inference_c_shared
)
else
()
target_link_libraries
(
test_analyzer_capi_exp_pd_threads paddle_inference_c
)
endif
()
endif
()
endif
()
inference_analysis_test
(
inference_analysis_test
(
test_analyzer_zerocopytensor_tensor
test_analyzer_zerocopytensor_tensor
SRCS
SRCS
...
@@ -1182,9 +1201,13 @@ if(WITH_MKLDNN)
...
@@ -1182,9 +1201,13 @@ if(WITH_MKLDNN)
analyzer_capi_exp_int_tester.cc
analyzer_capi_exp_int_tester.cc
EXTRA_DEPS
EXTRA_DEPS
${
INFERENCE_EXTRA_DEPS
}
${
INFERENCE_EXTRA_DEPS
}
paddle_inference_c
ARGS
ARGS
--infer_model=
${
INT8_DATA_DIR
}
/resnet50/model
)
--infer_model=
${
INT8_DATA_DIR
}
/resnet50/model
)
if
(
WIN32
)
target_link_libraries
(
test_analyzer_capi_exp_int paddle_inference_c_shared
)
else
()
target_link_libraries
(
test_analyzer_capi_exp_int paddle_inference_c
)
endif
()
endif
()
endif
()
inference_analysis_test
(
inference_analysis_test
(
...
@@ -1193,9 +1216,13 @@ inference_analysis_test(
...
@@ -1193,9 +1216,13 @@ inference_analysis_test(
analyzer_capi_exp_ner_tester.cc
analyzer_capi_exp_ner_tester.cc
EXTRA_DEPS
EXTRA_DEPS
${
INFERENCE_EXTRA_DEPS
}
${
INFERENCE_EXTRA_DEPS
}
paddle_inference_c
ARGS
ARGS
--infer_model=
${
CHINESE_NER_INSTALL_DIR
}
/model
)
--infer_model=
${
CHINESE_NER_INSTALL_DIR
}
/model
)
if
(
WIN32
)
target_link_libraries
(
test_analyzer_capi_exp_ner paddle_inference_c_shared
)
else
()
target_link_libraries
(
test_analyzer_capi_exp_ner paddle_inference_c
)
endif
()
if
(
WITH_GPU
)
if
(
WITH_GPU
)
inference_analysis_test
(
inference_analysis_test
(
...
...
paddle/fluid/inference/tests/api/analyzer_image_classification_tester.cc
浏览文件 @
99c5c27d
...
@@ -66,11 +66,6 @@ void profile(bool use_mkldnn = false) {
...
@@ -66,11 +66,6 @@ void profile(bool use_mkldnn = false) {
FLAGS_num_threads
);
FLAGS_num_threads
);
}
}
TEST
(
Analyzer_resnet50
,
profile
)
{
profile
();
}
#ifdef PADDLE_WITH_MKLDNN
TEST
(
Analyzer_resnet50
,
profile_mkldnn
)
{
profile
(
true
/* use_mkldnn */
);
}
#endif
// Check the fuse status
// Check the fuse status
TEST
(
Analyzer_resnet50
,
fuse_statis
)
{
TEST
(
Analyzer_resnet50
,
fuse_statis
)
{
AnalysisConfig
cfg
;
AnalysisConfig
cfg
;
...
@@ -82,6 +77,11 @@ TEST(Analyzer_resnet50, fuse_statis) {
...
@@ -82,6 +77,11 @@ TEST(Analyzer_resnet50, fuse_statis) {
LOG
(
INFO
)
<<
"num_ops: "
<<
num_ops
;
LOG
(
INFO
)
<<
"num_ops: "
<<
num_ops
;
}
}
TEST
(
Analyzer_resnet50
,
profile
)
{
profile
();
}
#ifdef PADDLE_WITH_MKLDNN
TEST
(
Analyzer_resnet50
,
profile_mkldnn
)
{
profile
(
true
/* use_mkldnn */
);
}
#endif
// Compare result of NativeConfig and AnalysisConfig
// Compare result of NativeConfig and AnalysisConfig
void
compare
(
bool
use_mkldnn
=
false
)
{
void
compare
(
bool
use_mkldnn
=
false
)
{
AnalysisConfig
cfg
;
AnalysisConfig
cfg
;
...
...
paddle/fluid/inference/tests/api/trt_fc_prelu_test.cc
浏览文件 @
99c5c27d
...
@@ -23,6 +23,11 @@ namespace inference {
...
@@ -23,6 +23,11 @@ namespace inference {
TEST
(
TensorRT_fc
,
compare
)
{
TEST
(
TensorRT_fc
,
compare
)
{
std
::
string
model_dir
=
FLAGS_infer_model
+
"/fc_uint8"
;
std
::
string
model_dir
=
FLAGS_infer_model
+
"/fc_uint8"
;
AnalysisConfig
config
;
config
.
EnableUseGpu
(
100
,
0
);
config
.
SetModel
(
model_dir
);
config
.
DisableGlogInfo
();
auto
predictor
=
CreatePaddlePredictor
(
config
);
compare
(
model_dir
,
/* use_tensorrt */
true
);
compare
(
model_dir
,
/* use_tensorrt */
true
);
// Open it when need.
// Open it when need.
// profile(model_dir, /* use_analysis */ true, FLAGS_use_tensorrt);
// profile(model_dir, /* use_analysis */ true, FLAGS_use_tensorrt);
...
...
paddle/fluid/inference/tests/api/trt_mobilenet_test.cc
浏览文件 @
99c5c27d
...
@@ -23,6 +23,11 @@ namespace inference {
...
@@ -23,6 +23,11 @@ namespace inference {
TEST
(
TensorRT_mobilenet
,
compare
)
{
TEST
(
TensorRT_mobilenet
,
compare
)
{
std
::
string
model_dir
=
FLAGS_infer_model
+
"/mobilenet"
;
std
::
string
model_dir
=
FLAGS_infer_model
+
"/mobilenet"
;
AnalysisConfig
config
;
config
.
EnableUseGpu
(
100
,
0
);
config
.
SetModel
(
model_dir
);
config
.
DisableGlogInfo
();
auto
predictor
=
CreatePaddlePredictor
(
config
);
compare
(
model_dir
,
/* use_tensorrt */
true
);
compare
(
model_dir
,
/* use_tensorrt */
true
);
// Open it when need.
// Open it when need.
// profile(model_dir, /* use_analysis */ true, FLAGS_use_tensorrt);
// profile(model_dir, /* use_analysis */ true, FLAGS_use_tensorrt);
...
...
paddle/fluid/inference/tests/api/trt_resnext_test.cc
浏览文件 @
99c5c27d
...
@@ -23,6 +23,11 @@ namespace inference {
...
@@ -23,6 +23,11 @@ namespace inference {
TEST
(
TensorRT_resnext50
,
compare
)
{
TEST
(
TensorRT_resnext50
,
compare
)
{
std
::
string
model_dir
=
FLAGS_infer_model
+
"/resnext50"
;
std
::
string
model_dir
=
FLAGS_infer_model
+
"/resnext50"
;
AnalysisConfig
config
;
config
.
EnableUseGpu
(
100
,
0
);
config
.
SetModel
(
model_dir
);
config
.
DisableGlogInfo
();
auto
predictor
=
CreatePaddlePredictor
(
config
);
compare
(
model_dir
,
/* use_tensorrt */
true
);
compare
(
model_dir
,
/* use_tensorrt */
true
);
}
}
...
...
paddle/phi/common/place.h
浏览文件 @
99c5c27d
...
@@ -39,10 +39,9 @@ enum class AllocationType : int8_t {
...
@@ -39,10 +39,9 @@ enum class AllocationType : int8_t {
const
char
*
AllocationTypeStr
(
AllocationType
type
);
const
char
*
AllocationTypeStr
(
AllocationType
type
);
PADDLE_API
size_t
size_t
GetOrRegisterGlobalDeviceTypeId
(
const
std
::
string
&
device_type
);
GetOrRegisterGlobalDeviceTypeId
(
const
std
::
string
&
device_type
);
PADDLE_API
std
::
string
GetGlobalDeviceType
(
size_t
device_type_id_
);
std
::
string
GetGlobalDeviceType
(
size_t
device_type_id_
);
/// \brief The place is used to specify where the data is stored.
/// \brief The place is used to specify where the data is stored.
class
PADDLE_API
Place
{
class
PADDLE_API
Place
{
...
...
paddle/scripts/paddle_build.bat
浏览文件 @
99c5c27d
...
@@ -685,7 +685,8 @@ set PATH=%THIRD_PARTY_PATH:/=\%\install\openblas\lib;%THIRD_PARTY_PATH:/=\%\inst
...
@@ -685,7 +685,8 @@ set PATH=%THIRD_PARTY_PATH:/=\%\install\openblas\lib;%THIRD_PARTY_PATH:/=\%\inst
%THIRD
_PARTY_PATH:/
=
\
%
\install\zlib\bin
;
%THIRD
_PARTY_PATH:/
=
\
%
\install\mklml\lib
;
^
%THIRD
_PARTY_PATH:/
=
\
%
\install\zlib\bin
;
%THIRD
_PARTY_PATH:/
=
\
%
\install\mklml\lib
;
^
%THIRD
_PARTY_PATH:/
=
\
%
\install\mkldnn\bin
;
%THIRD
_PARTY_PATH:/
=
\
%
\install\warpctc\bin
;
^
%THIRD
_PARTY_PATH:/
=
\
%
\install\mkldnn\bin
;
%THIRD
_PARTY_PATH:/
=
\
%
\install\warpctc\bin
;
^
%THIRD
_PARTY_PATH:/
=
\
%
\install\onnxruntime\lib
;
%THIRD
_PARTY_PATH:/
=
\
%
\install\paddle2onnx\lib
;
^
%THIRD
_PARTY_PATH:/
=
\
%
\install\onnxruntime\lib
;
%THIRD
_PARTY_PATH:/
=
\
%
\install\paddle2onnx\lib
;
^
%work_dir%
\
%BUILD_DIR%
\paddle\fluid\inference
;
%PATH%
%work_dir%
\
%BUILD_DIR%
\paddle\fluid\inference
;
%work_dir%
\
%BUILD_DIR%
\paddle\fluid\inference\capi_exp
;
^
%PATH%
REM TODO: make ut find .dll in install\onnxruntime\lib
REM TODO: make ut find .dll in install\onnxruntime\lib
xcopy
%THIRD
_PARTY_PATH:/
=
\
%
\install\onnxruntime\lib\onnxruntime.dll
%work_dir%
\
%BUILD_DIR%
\paddle\fluid\inference\tests\api\
/Y
xcopy
%THIRD
_PARTY_PATH:/
=
\
%
\install\onnxruntime\lib\onnxruntime.dll
%work_dir%
\
%BUILD_DIR%
\paddle\fluid\inference\tests\api\
/Y
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录