Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
3cdad373
S
Serving
项目概览
PaddlePaddle
/
Serving
大约 1 年 前同步成功
通知
186
Star
833
Fork
253
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
105
列表
看板
标记
里程碑
合并请求
10
Wiki
2
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Serving
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
105
Issue
105
列表
看板
标记
里程碑
合并请求
10
合并请求
10
Pages
分析
分析
仓库分析
DevOps
Wiki
2
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3cdad373
编写于
8月 11, 2020
作者:
M
MRXLT
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add trt
上级
460c43b8
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
27 addition
and
17 deletion
+27
-17
CMakeLists.txt
CMakeLists.txt
+1
-0
cmake/paddlepaddle.cmake
cmake/paddlepaddle.cmake
+4
-1
core/configure/proto/server_configure.proto
core/configure/proto/server_configure.proto
+1
-0
paddle_inference/inferencer-fluid-gpu/include/fluid_gpu_engine.h
...inference/inferencer-fluid-gpu/include/fluid_gpu_engine.h
+12
-16
python/paddle_serving_server_gpu/__init__.py
python/paddle_serving_server_gpu/__init__.py
+7
-0
python/paddle_serving_server_gpu/serve.py
python/paddle_serving_server_gpu/serve.py
+2
-0
未找到文件。
CMakeLists.txt
浏览文件 @
3cdad373
...
@@ -54,6 +54,7 @@ option(SERVER "Compile Paddle Serving Server" OFF)
...
@@ -54,6 +54,7 @@ option(SERVER "Compile Paddle Serving Server" OFF)
option
(
APP
"Compile Paddle Serving App package"
OFF
)
option
(
APP
"Compile Paddle Serving App package"
OFF
)
option
(
WITH_ELASTIC_CTR
"Compile ELASITC-CTR solution"
OFF
)
option
(
WITH_ELASTIC_CTR
"Compile ELASITC-CTR solution"
OFF
)
option
(
PACK
"Compile for whl"
OFF
)
option
(
PACK
"Compile for whl"
OFF
)
option
(
WITH_TRT
"Compile Paddle Serving with TRT"
OFF
)
set
(
WITH_MKLML
${
WITH_MKL
}
)
set
(
WITH_MKLML
${
WITH_MKL
}
)
if
(
NOT DEFINED WITH_MKLDNN
)
if
(
NOT DEFINED WITH_MKLDNN
)
...
...
cmake/paddlepaddle.cmake
浏览文件 @
3cdad373
...
@@ -34,6 +34,9 @@ message( "WITH_GPU = ${WITH_GPU}")
...
@@ -34,6 +34,9 @@ message( "WITH_GPU = ${WITH_GPU}")
SET
(
PADDLE_VERSION
"1.8.1"
)
SET
(
PADDLE_VERSION
"1.8.1"
)
if
(
WITH_GPU
)
if
(
WITH_GPU
)
if
(
WITH_TRT
)
SET
(
PADDLE_LIB_VERSION
"
${
PADDLE_VERSION
}
-gpu-cuda10.1-cudnn7.6-avx-mkl-trt6"
)
else
()
SET
(
PADDLE_LIB_VERSION
"
${
PADDLE_VERSION
}
-gpu-cuda10-cudnn7-avx-mkl"
)
SET
(
PADDLE_LIB_VERSION
"
${
PADDLE_VERSION
}
-gpu-cuda10-cudnn7-avx-mkl"
)
else
()
else
()
if
(
WITH_AVX
)
if
(
WITH_AVX
)
...
...
core/configure/proto/server_configure.proto
浏览文件 @
3cdad373
...
@@ -44,6 +44,7 @@ message EngineDesc {
...
@@ -44,6 +44,7 @@ message EngineDesc {
optional
bool
static_optimization
=
14
;
optional
bool
static_optimization
=
14
;
optional
bool
force_update_static_cache
=
15
;
optional
bool
force_update_static_cache
=
15
;
optional
bool
enable_ir_optimization
=
16
;
optional
bool
enable_ir_optimization
=
16
;
optional
bool
use_trt
=
17
;
};
};
// model_toolkit conf
// model_toolkit conf
...
...
paddle_inference/inferencer-fluid-gpu/include/fluid_gpu_engine.h
浏览文件 @
3cdad373
...
@@ -178,7 +178,7 @@ class FluidGpuNativeCore : public FluidFamilyCore {
...
@@ -178,7 +178,7 @@ class FluidGpuNativeCore : public FluidFamilyCore {
}
}
};
};
class
Fluid
Gpu
AnalysisDirCore
:
public
FluidFamilyCore
{
class
Fluid
TRT
AnalysisDirCore
:
public
FluidFamilyCore
{
public:
public:
int
create
(
const
predictor
::
InferEngineCreationParams
&
params
)
{
int
create
(
const
predictor
::
InferEngineCreationParams
&
params
)
{
std
::
string
data_path
=
params
.
get_path
();
std
::
string
data_path
=
params
.
get_path
();
...
@@ -198,13 +198,7 @@ class FluidGpuAnalysisDirCore : public FluidFamilyCore {
...
@@ -198,13 +198,7 @@ class FluidGpuAnalysisDirCore : public FluidFamilyCore {
analysis_config
.
EnableMemoryOptim
();
analysis_config
.
EnableMemoryOptim
();
}
}
/*
#if 0
if (params.enable_ir_optimization()) {
analysis_config.SwitchIrOptim(true);
} else {
analysis_config.SwitchIrOptim(false);
}
*/
int min_seq_len = 1;
int min_seq_len = 1;
int max_seq_len = 512;
int max_seq_len = 512;
...
@@ -241,16 +235,18 @@ class FluidGpuAnalysisDirCore : public FluidFamilyCore {
...
@@ -241,16 +235,18 @@ class FluidGpuAnalysisDirCore : public FluidFamilyCore {
{input4_name, {batch, head_number, opt_seq_len, opt_seq_len}},
{input4_name, {batch, head_number, opt_seq_len, opt_seq_len}},
};
};
analysis_config.SetTRTDynamicShapeInfo(
min_input_shape, max_input_shape, opt_input_shape);
#endif
if
(
params
.
use_trt
())
{
analysis_config
.
EnableTensorRtEngine
(
analysis_config
.
EnableTensorRtEngine
(
1
<<
30
,
1
<<
30
,
batch
,
batch
,
5
,
5
,
paddle
::
AnalysisConfig
::
Precision
::
kHalf
,
paddle
::
AnalysisConfig
::
Precision
::
kFloat32
,
true
,
true
,
true
);
true
);
analysis_config
.
SetTRTDynamicShapeInfo
(
}
min_input_shape
,
max_input_shape
,
opt_input_shape
);
AutoLock
lock
(
GlobalPaddleCreateMutex
::
instance
());
AutoLock
lock
(
GlobalPaddleCreateMutex
::
instance
());
_core
=
_core
=
paddle
::
CreatePaddlePredictor
<
paddle
::
AnalysisConfig
>
(
analysis_config
);
paddle
::
CreatePaddlePredictor
<
paddle
::
AnalysisConfig
>
(
analysis_config
);
...
...
python/paddle_serving_server_gpu/__init__.py
浏览文件 @
3cdad373
...
@@ -73,6 +73,8 @@ def serve_args():
...
@@ -73,6 +73,8 @@ def serve_args():
default
=
False
,
default
=
False
,
action
=
"store_true"
,
action
=
"store_true"
,
help
=
"Use Multi-language-service"
)
help
=
"Use Multi-language-service"
)
parser
.
add_argument
(
"--use_trt"
,
default
=
False
,
action
=
"store_true"
,
help
=
"Use TensorRT"
)
return
parser
.
parse_args
()
return
parser
.
parse_args
()
...
@@ -195,6 +197,7 @@ class Server(object):
...
@@ -195,6 +197,7 @@ class Server(object):
self
.
cur_path
=
os
.
getcwd
()
self
.
cur_path
=
os
.
getcwd
()
self
.
use_local_bin
=
False
self
.
use_local_bin
=
False
self
.
gpuid
=
0
self
.
gpuid
=
0
self
.
use_trt
=
False
self
.
model_config_paths
=
None
# for multi-model in a workflow
self
.
model_config_paths
=
None
# for multi-model in a workflow
def
set_max_concurrency
(
self
,
concurrency
):
def
set_max_concurrency
(
self
,
concurrency
):
...
@@ -245,6 +248,9 @@ class Server(object):
...
@@ -245,6 +248,9 @@ class Server(object):
def
set_gpuid
(
self
,
gpuid
=
0
):
def
set_gpuid
(
self
,
gpuid
=
0
):
self
.
gpuid
=
gpuid
self
.
gpuid
=
gpuid
def
use_trt
(
self
):
self
.
use_trt
=
True
def
_prepare_engine
(
self
,
model_config_paths
,
device
):
def
_prepare_engine
(
self
,
model_config_paths
,
device
):
if
self
.
model_toolkit_conf
==
None
:
if
self
.
model_toolkit_conf
==
None
:
self
.
model_toolkit_conf
=
server_sdk
.
ModelToolkitConf
()
self
.
model_toolkit_conf
=
server_sdk
.
ModelToolkitConf
()
...
@@ -264,6 +270,7 @@ class Server(object):
...
@@ -264,6 +270,7 @@ class Server(object):
engine
.
enable_ir_optimization
=
self
.
ir_optimization
engine
.
enable_ir_optimization
=
self
.
ir_optimization
engine
.
static_optimization
=
False
engine
.
static_optimization
=
False
engine
.
force_update_static_cache
=
False
engine
.
force_update_static_cache
=
False
engine
.
use_trt
=
self
.
use_trt
if
device
==
"cpu"
:
if
device
==
"cpu"
:
engine
.
type
=
"FLUID_CPU_ANALYSIS_DIR"
engine
.
type
=
"FLUID_CPU_ANALYSIS_DIR"
...
...
python/paddle_serving_server_gpu/serve.py
浏览文件 @
3cdad373
...
@@ -64,6 +64,8 @@ def start_gpu_card_model(index, gpuid, args): # pylint: disable=doc-string-miss
...
@@ -64,6 +64,8 @@ def start_gpu_card_model(index, gpuid, args): # pylint: disable=doc-string-miss
server
.
set_memory_optimize
(
mem_optim
)
server
.
set_memory_optimize
(
mem_optim
)
server
.
set_ir_optimize
(
ir_optim
)
server
.
set_ir_optimize
(
ir_optim
)
server
.
set_max_body_size
(
max_body_size
)
server
.
set_max_body_size
(
max_body_size
)
if
args
.
use_trt
:
server
.
use_trt
()
server
.
load_model_config
(
model
)
server
.
load_model_config
(
model
)
server
.
prepare_server
(
workdir
=
workdir
,
port
=
port
,
device
=
device
)
server
.
prepare_server
(
workdir
=
workdir
,
port
=
port
,
device
=
device
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录