From eb54817c15ef4d8976eb43839b7d31356a1eee7b Mon Sep 17 00:00:00 2001 From: yefeng Date: Thu, 3 Mar 2022 18:50:10 +0800 Subject: [PATCH] check param for parallel predict --- .../lite/tools/benchmark/benchmark_unified_api.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mindspore/lite/tools/benchmark/benchmark_unified_api.cc b/mindspore/lite/tools/benchmark/benchmark_unified_api.cc index ab423420cf9..54e49e61040 100644 --- a/mindspore/lite/tools/benchmark/benchmark_unified_api.cc +++ b/mindspore/lite/tools/benchmark/benchmark_unified_api.cc @@ -51,7 +51,9 @@ constexpr int kFrequencyDefault = 3; constexpr int kPercentageDivisor = 100; constexpr int kDumpInputsAndOutputs = 0; constexpr int kDumpOutputs = 2; - +#ifdef SERVER_INFERENCE +constexpr int kMaxRequestNum = 200; +#endif namespace lite { #ifdef ENABLE_OPENGL_TEXTURE int BenchmarkUnifiedApi::GenerateGLTexture(std::map *input_gl_texture) { @@ -948,6 +950,12 @@ int BenchmarkUnifiedApi::PrintInputData() { } #ifdef SERVER_INFERENCE int BenchmarkUnifiedApi::RunModelPool(std::shared_ptr context) { + if (flags_->warm_up_loop_count_ > kMaxRequestNum) { + MS_LOG(WARNING) << "in parallel predict warm up loop count should less than" << kMaxRequestNum; + } + if (flags_->parallel_request_num_ > kMaxRequestNum) { + MS_LOG(WARNING) << "parallel request num should less than" << kMaxRequestNum; + } if (flags_->resize_dims_.empty()) { MS_LOG(ERROR) << "use parallel predict, inputShapes can not use empty."; return RET_ERROR;