Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
c4f30c51
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看板
未验证
提交
c4f30c51
编写于
12月 16, 2022
作者:
Y
Yuanle Liu
提交者:
GitHub
12月 16, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add PADDLE_WITH_TENSORRT to EnableTensorRtEngine (#49091)
上级
a0576250
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
11 addition
and
8 deletion
+11
-8
paddle/fluid/inference/api/analysis_config.cc
paddle/fluid/inference/api/analysis_config.cc
+9
-8
paddle/fluid/inference/api/api_tester.cc
paddle/fluid/inference/api/api_tester.cc
+2
-0
未找到文件。
paddle/fluid/inference/api/analysis_config.cc
浏览文件 @
c4f30c51
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include "paddle/fluid/inference/utils/table_printer.h"
#include "paddle/fluid/inference/utils/table_printer.h"
#include "paddle/fluid/platform/device/gpu/gpu_info.h"
#include "paddle/fluid/platform/device/gpu/gpu_info.h"
#include "paddle/fluid/platform/enforce.h"
#include "paddle/fluid/platform/enforce.h"
#include "paddle/fluid/platform/errors.h"
#include "paddle/phi/backends/cpu/cpu_info.h"
#include "paddle/phi/backends/cpu/cpu_info.h"
#include "paddle/utils/string/split.h"
#include "paddle/utils/string/split.h"
...
@@ -101,10 +102,10 @@ void AnalysisConfig::EnableUseGpu(uint64_t memory_pool_init_size_mb,
...
@@ -101,10 +102,10 @@ void AnalysisConfig::EnableUseGpu(uint64_t memory_pool_init_size_mb,
precision_mode
==
Precision
::
kBf16
)
{
precision_mode
==
Precision
::
kBf16
)
{
enable_gpu_mixed_
=
true
;
enable_gpu_mixed_
=
true
;
}
else
{
}
else
{
LOG
(
ERROR
)
PADDLE_THROW
(
platform
::
errors
::
InvalidArgument
(
<<
"The Paddle-GPU inference currently only supports "
"The Paddle-GPU inference currently only supports "
"float32/float16/bfloat16 precision. Please check the parameters "
"float32/float16/bfloat16 precision. Please check the parameters "
"you specified in EnableUseGpu or enable_use_gpu function."
;
"you specified in EnableUseGpu or enable_use_gpu function."
))
;
}
}
#else
#else
LOG
(
ERROR
)
<<
"Please use PaddlePaddle with GPU version."
;
LOG
(
ERROR
)
<<
"Please use PaddlePaddle with GPU version."
;
...
@@ -696,7 +697,7 @@ void AnalysisConfig::EnableTensorRtEngine(
...
@@ -696,7 +697,7 @@ void AnalysisConfig::EnableTensorRtEngine(
AnalysisConfig
::
Precision
precision_mode
,
AnalysisConfig
::
Precision
precision_mode
,
bool
use_static
,
bool
use_static
,
bool
use_calib_mode
)
{
bool
use_calib_mode
)
{
#if
defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
#if
def PADDLE_WITH_TENSORRT
if
(
!
use_gpu
())
{
if
(
!
use_gpu
())
{
LOG
(
ERROR
)
<<
"To use TensorRT engine, please call EnableUseGpu() first"
;
LOG
(
ERROR
)
<<
"To use TensorRT engine, please call EnableUseGpu() first"
;
return
;
return
;
...
@@ -712,8 +713,8 @@ void AnalysisConfig::EnableTensorRtEngine(
...
@@ -712,8 +713,8 @@ void AnalysisConfig::EnableTensorRtEngine(
Update
();
Update
();
#else
#else
LOG
(
ERROR
)
PADDLE_THROW
(
platform
::
errors
::
PreconditionNotMet
(
<<
"To use TensorRT engine, please compile inference lib with GPU first."
;
"To use Paddle-TensorRT, please compile with TENSORRT first."
))
;
#endif
#endif
}
}
...
@@ -1249,7 +1250,7 @@ std::string AnalysisConfig::Summary() {
...
@@ -1249,7 +1250,7 @@ std::string AnalysisConfig::Summary() {
os
.
InsertRow
({
"use_gpu"
,
use_gpu_
?
"true"
:
"false"
});
os
.
InsertRow
({
"use_gpu"
,
use_gpu_
?
"true"
:
"false"
});
if
(
use_gpu_
)
{
if
(
use_gpu_
)
{
os
.
InsertRow
({
"gpu_device_id"
,
std
::
to_string
(
gpu_device_id_
)});
os
.
InsertRow
({
"gpu_device_id"
,
std
::
to_string
(
gpu_device_id_
)});
os
.
InsertRow
({
"enable_gpu_mixed
_
"
,
std
::
to_string
(
enable_gpu_mixed_
)});
os
.
InsertRow
({
"enable_gpu_mixed"
,
std
::
to_string
(
enable_gpu_mixed_
)});
os
.
InsertRow
({
"memory_pool_init_size"
,
os
.
InsertRow
({
"memory_pool_init_size"
,
std
::
to_string
(
memory_pool_init_size_mb_
)
+
"MB"
});
std
::
to_string
(
memory_pool_init_size_mb_
)
+
"MB"
});
os
.
InsertRow
(
os
.
InsertRow
(
...
...
paddle/fluid/inference/api/api_tester.cc
浏览文件 @
c4f30c51
...
@@ -87,7 +87,9 @@ TEST(paddle_inference_api, UpdateDllFlag) {
...
@@ -87,7 +87,9 @@ TEST(paddle_inference_api, UpdateDllFlag) {
TEST
(
paddle_inference_api
,
AnalysisConfigCopyCtor
)
{
TEST
(
paddle_inference_api
,
AnalysisConfigCopyCtor
)
{
AnalysisConfig
cfg1
;
AnalysisConfig
cfg1
;
cfg1
.
EnableUseGpu
(
10
);
cfg1
.
EnableUseGpu
(
10
);
#ifdef PADDLE_WITH_TENSORRT
cfg1
.
EnableTensorRtEngine
();
cfg1
.
EnableTensorRtEngine
();
#endif
std
::
string
delete_pass
(
"skip_layernorm_fuse_pass"
);
std
::
string
delete_pass
(
"skip_layernorm_fuse_pass"
);
cfg1
.
pass_builder
()
->
DeletePass
(
delete_pass
);
cfg1
.
pass_builder
()
->
DeletePass
(
delete_pass
);
AnalysisConfig
cfg2
(
cfg1
);
AnalysisConfig
cfg2
(
cfg1
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录