提交 d1a6e112 编写于 作者: Z Zhaolong Xing 提交者: 石晓伟

fix C++ multicard inference bug. (#20955)

test=develop
上级 47a82e38
...@@ -123,7 +123,7 @@ bool AnalysisPredictor::PrepareScope( ...@@ -123,7 +123,7 @@ bool AnalysisPredictor::PrepareScope(
status_is_cloned_ = true; status_is_cloned_ = true;
} else { } else {
if (config_.use_gpu_) { if (config_.use_gpu_) {
paddle::framework::InitDevices(false, {config_.device_id_}); paddle::framework::InitDevices(false);
} else { } else {
paddle::framework::InitDevices(false, {}); paddle::framework::InitDevices(false, {});
} }
...@@ -501,8 +501,6 @@ std::unique_ptr<PaddlePredictor> CreatePaddlePredictor< ...@@ -501,8 +501,6 @@ std::unique_ptr<PaddlePredictor> CreatePaddlePredictor<
std::string flag = "--fraction_of_gpu_memory_to_use=" + std::string flag = "--fraction_of_gpu_memory_to_use=" +
std::to_string(fraction_of_gpu_memory); std::to_string(fraction_of_gpu_memory);
flags.push_back(flag); flags.push_back(flag);
flags.push_back("--selected_gpus=" +
std::to_string(config.gpu_device_id()));
VLOG(3) << "set flag: " << flag; VLOG(3) << "set flag: " << flag;
framework::InitGflags(flags); framework::InitGflags(flags);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册