Skip to content

Commit 66520f8

Browse files
author
xuwei06
committed
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
1 parent 257819d commit 66520f8

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

paddle/gserver/dataproviders/DataProvider.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,9 @@ class DoubleBuffer {
271271
void finishAsyncLoad() {
272272
stopping_ = true;
273273
taskReadySem_.post();
274-
asyncLoader_->join();
274+
if (asyncLoader_) {
275+
asyncLoader_->join();
276+
}
275277
}
276278

277279
void setPending(bool pending) { pending_ = pending; }

paddle/trainer/Trainer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ void Trainer::init(const std::shared_ptr<TrainerConfigHelper>& config,
205205
(!IGradientMachineMode::dataMustInCpu(mode_, FLAGS_trainer_count));
206206

207207
dataProvider_ = dataProvider;
208-
if (!dataProvider_ && config_->hasDataConfig()) {
208+
if (!dataProvider_ && config_->hasDataConfig() && !testing_) {
209209
dataProvider_.reset(DataProvider::create(*config_, *config_, gpuData));
210210
}
211211
if (!testDataProvider_) {

0 commit comments

Comments
 (0)