Skip to content

Fix compile error on mac caused by std move#11034

Merged
jacquesqiao merged 8 commits intoPaddlePaddle:developfrom
jacquesqiao:fix-compile-by-std-move
May 31, 2018
Merged

Fix compile error on mac caused by std move#11034
jacquesqiao merged 8 commits intoPaddlePaddle:developfrom
jacquesqiao:fix-compile-by-std-move

Conversation

@jacquesqiao
Copy link
Member

@jacquesqiao jacquesqiao commented May 30, 2018

fix: #11032

it's strange why CreatePaddlePredictorImpl do not have the same problem on manylinux

std::unique_ptr<PaddlePredictorImpl> CreatePaddlePredictorImpl(
const VisConfig &config) {
VLOG(3) << "create PaddlePredictorImpl";
// 1. GPU memeroy
std::vector<std::string> flags;
if (config.fraction_of_gpu_memory >= 0.0f ||
config.fraction_of_gpu_memory <= 0.95f) {
flags.push_back("dummpy");
std::string flag = "--fraction_of_gpu_memory_to_use=" +
num2str<float>(config.fraction_of_gpu_memory);
flags.push_back(flag);
VLOG(3) << "set flag: " << flag;
framework::InitGflags(flags);
}
std::unique_ptr<PaddlePredictorImpl> predictor(
new PaddlePredictorImpl(config));
if (!predictor->Init()) {
return nullptr;
}
return predictor;
}

@jacquesqiao jacquesqiao changed the title Fix compile by std move May 30, 2018
@jacquesqiao jacquesqiao requested a review from Superjomn May 30, 2018 06:39

std::unique_ptr<PaddlePredictor> PaddlePredictorImpl::Clone() {
VLOG(3) << "Predictor::clone";
std::unique_ptr<PaddlePredictor> cls(new PaddlePredictorImpl(config_));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will make mac success but make manylinux fail.

try return pointer, that mac works and might make manylinux success.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are many codes in fluid return a unique_ptr without the problem. Not sure why this place face problem on manylinux build.

Superjomn
Superjomn previously approved these changes May 30, 2018
Copy link
Contributor

@Superjomn Superjomn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@luotao1 luotao1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jacquesqiao jacquesqiao merged commit 05f7d30 into PaddlePaddle:develop May 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants