提交 66520f8b 编写于 作者: X xuwei06

Fix --job=test

When the define_py_data_sources2 has both train_list and test_list,
for job=test, the trainer will create both dataProvider_ and testDataProvider_.
But dataProvider_ is not used. This causes SIGSEGV at finishAsync() because asyncLoader_ is not created.

Change-Id: If579f715f80a70ebc795094792c3436bfa0f5746
上级 257819d3
...@@ -271,7 +271,9 @@ public: ...@@ -271,7 +271,9 @@ public:
void finishAsyncLoad() { void finishAsyncLoad() {
stopping_ = true; stopping_ = true;
taskReadySem_.post(); taskReadySem_.post();
asyncLoader_->join(); if (asyncLoader_) {
asyncLoader_->join();
}
} }
void setPending(bool pending) { pending_ = pending; } void setPending(bool pending) { pending_ = pending; }
......
...@@ -205,7 +205,7 @@ void Trainer::init(const std::shared_ptr<TrainerConfigHelper>& config, ...@@ -205,7 +205,7 @@ void Trainer::init(const std::shared_ptr<TrainerConfigHelper>& config,
(!IGradientMachineMode::dataMustInCpu(mode_, FLAGS_trainer_count)); (!IGradientMachineMode::dataMustInCpu(mode_, FLAGS_trainer_count));
dataProvider_ = dataProvider; dataProvider_ = dataProvider;
if (!dataProvider_ && config_->hasDataConfig()) { if (!dataProvider_ && config_->hasDataConfig() && !testing_) {
dataProvider_.reset(DataProvider::create(*config_, *config_, gpuData)); dataProvider_.reset(DataProvider::create(*config_, *config_, gpuData));
} }
if (!testDataProvider_) { if (!testDataProvider_) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册