!30808 [MS][LITE][parallel predict][master] check param for parallel predict

Merge pull request !30808 from yefeng/247-check_param_for_parallel_predict-master
This commit is contained in:
i-robot 2022-03-04 03:01:02 +00:00 committed by Gitee
commit 55c7fc6d3d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 9 additions and 1 deletions

View File

@ -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<std::string, GLuint> *input_gl_texture) {
@ -948,6 +950,12 @@ int BenchmarkUnifiedApi::PrintInputData() {
}
#ifdef SERVER_INFERENCE
int BenchmarkUnifiedApi::RunModelPool(std::shared_ptr<mindspore::Context> 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;