Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
3c074de4
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
3c074de4
编写于
7月 18, 2022
作者:
W
Wilber
提交者:
GitHub
7月 18, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enable inference multi stream ci test (#44275)
* test * update
上级
39e5dd2e
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
64 addition
and
62 deletion
+64
-62
paddle/fluid/inference/tests/infer_ut/test_LeViT.cc
paddle/fluid/inference/tests/infer_ut/test_LeViT.cc
+63
-61
paddle/phi/kernels/funcs/concat_and_split_functor.cu
paddle/phi/kernels/funcs/concat_and_split_functor.cu
+1
-1
未找到文件。
paddle/fluid/inference/tests/infer_ut/test_LeViT.cc
浏览文件 @
3c074de4
...
...
@@ -179,67 +179,69 @@ TEST(tensorrt_tester_LeViT, multi_thread4_trt_fp32_bz2) {
}
#ifdef PADDLE_WITH_GPU
// TEST(tensorrt_tester_LeViT, multi_stream_thread4_trt_fp32_bz2) {
// int thread_num = 4;
// // init stream
// std::vector<cudaStream_t> streams(thread_num);
// for (size_t i = 0; i < thread_num; ++i) {
// cudaStreamCreate(&streams[i]);
// }
// // init input data
// std::map<std::string, paddle::test::Record> my_input_data_map;
// my_input_data_map["x"] = PrepareInput(2);
// // init output data
// std::map<std::string, paddle::test::Record> infer_output_data,
// truth_output_data;
// // prepare groudtruth config
// paddle_infer::Config config, config_no_ir;
// config_no_ir.SetModel(FLAGS_modeldir + "/inference.pdmodel",
// FLAGS_modeldir + "/inference.pdiparams");
// config_no_ir.SwitchIrOptim(false);
// // prepare inference config
// config.SetModel(FLAGS_modeldir + "/inference.pdmodel",
// FLAGS_modeldir + "/inference.pdiparams");
// config.EnableUseGpu(100, 0);
// config.EnableTensorRtEngine(
// 1 << 20, 2, 50, paddle_infer::PrecisionType::kFloat32, false, false);
// // get groudtruth by disbale ir
// paddle_infer::services::PredictorPool pred_pool_no_ir(config_no_ir, 1);
// SingleThreadPrediction(pred_pool_no_ir.Retrive(0), &my_input_data_map,
// &truth_output_data, 1);
// // get infer results from multi threads
// std::vector<std::thread> threads;
// config.SetExecStream(streams[0]);
// config.pass_builder()->DeletePass("add_support_int8_pass");
// auto main_predictor = CreatePredictor(config);
// std::vector<decltype(main_predictor)> predictors;
// for (size_t i = 0; i < thread_num - 1; ++i) {
// predictors.push_back(std::move(main_predictor->Clone(streams[i + 1])));
// LOG(INFO) << "predictors[" << i << "] stream is "
// << predictors[i]->GetExecStream();
// }
// predictors.push_back(std::move(main_predictor));
// LOG(INFO) << "predictors[" << thread_num - 1 << "] stream is "
// << predictors[thread_num - 1]->GetExecStream();
// for (int i = 0; i < thread_num; ++i) {
// threads.emplace_back(paddle::test::SingleThreadPrediction,
// predictors[i].get(), &my_input_data_map,
// &infer_output_data, 10);
// }
// // thread join & check outputs
// for (int i = 0; i < thread_num; ++i) {
// LOG(INFO) << "join tid : " << i;
// threads[i].join();
// CompareRecord(&truth_output_data, &infer_output_data);
// }
// std::cout << "finish multi-thread test" << std::endl;
// }
TEST
(
tensorrt_tester_LeViT
,
multi_stream_thread4_trt_fp32_bz2
)
{
int
thread_num
=
4
;
// init stream
std
::
vector
<
cudaStream_t
>
streams
(
thread_num
);
for
(
size_t
i
=
0
;
i
<
thread_num
;
++
i
)
{
cudaStreamCreate
(
&
streams
[
i
]);
}
// init input data
std
::
map
<
std
::
string
,
paddle
::
test
::
Record
>
my_input_data_map
;
my_input_data_map
[
"x"
]
=
PrepareInput
(
2
);
// init output data
std
::
map
<
std
::
string
,
paddle
::
test
::
Record
>
infer_output_data
,
truth_output_data
;
// prepare groudtruth config
paddle_infer
::
Config
config
,
config_no_ir
;
config_no_ir
.
SetModel
(
FLAGS_modeldir
+
"/inference.pdmodel"
,
FLAGS_modeldir
+
"/inference.pdiparams"
);
config_no_ir
.
SwitchIrOptim
(
false
);
// prepare inference config
config
.
SetModel
(
FLAGS_modeldir
+
"/inference.pdmodel"
,
FLAGS_modeldir
+
"/inference.pdiparams"
);
config
.
EnableUseGpu
(
100
,
0
);
config
.
EnableTensorRtEngine
(
1
<<
20
,
2
,
50
,
paddle_infer
::
PrecisionType
::
kFloat32
,
false
,
false
);
// get groudtruth by disbale ir
paddle_infer
::
services
::
PredictorPool
pred_pool_no_ir
(
config_no_ir
,
1
);
SingleThreadPrediction
(
pred_pool_no_ir
.
Retrive
(
0
),
&
my_input_data_map
,
&
truth_output_data
,
1
);
// get infer results from multi threads
std
::
vector
<
std
::
thread
>
threads
;
config
.
SetExecStream
(
streams
[
0
]);
config
.
pass_builder
()
->
DeletePass
(
"add_support_int8_pass"
);
auto
main_predictor
=
CreatePredictor
(
config
);
std
::
vector
<
decltype
(
main_predictor
)
>
predictors
;
for
(
size_t
i
=
0
;
i
<
thread_num
-
1
;
++
i
)
{
predictors
.
push_back
(
std
::
move
(
main_predictor
->
Clone
(
streams
[
i
+
1
])));
LOG
(
INFO
)
<<
"predictors["
<<
i
<<
"] stream is "
<<
predictors
[
i
]
->
GetExecStream
();
}
predictors
.
push_back
(
std
::
move
(
main_predictor
));
LOG
(
INFO
)
<<
"predictors["
<<
thread_num
-
1
<<
"] stream is "
<<
predictors
[
thread_num
-
1
]
->
GetExecStream
();
for
(
int
i
=
0
;
i
<
thread_num
;
++
i
)
{
threads
.
emplace_back
(
paddle
::
test
::
SingleThreadPrediction
,
predictors
[
i
].
get
(),
&
my_input_data_map
,
&
infer_output_data
,
10
);
}
// thread join & check outputs
for
(
int
i
=
0
;
i
<
thread_num
;
++
i
)
{
LOG
(
INFO
)
<<
"join tid : "
<<
i
;
threads
[
i
].
join
();
CompareRecord
(
&
truth_output_data
,
&
infer_output_data
);
}
std
::
cout
<<
"finish multi-thread test"
<<
std
::
endl
;
}
#endif
}
// namespace paddle_infer
...
...
paddle/phi/kernels/funcs/concat_and_split_functor.cu
浏览文件 @
3c074de4
...
...
@@ -12,9 +12,9 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#include "paddle/phi/kernels/funcs/concat_and_split_functor.h"
#include "paddle/fluid/memory/malloc.h"
#include "paddle/fluid/platform/cuda_graph_with_memory_pool.h"
#include "paddle/phi/kernels/funcs/concat_and_split_functor.h"
namespace
phi
{
namespace
funcs
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录