From 426d4c3c225a41a72c01b7999ede44c4cf1438a5 Mon Sep 17 00:00:00 2001 From: barrierye Date: Wed, 21 Nov 2018 19:17:33 +0800 Subject: [PATCH] remove redundant code, and make executor exit when set a illegal queue size --- paddle/fluid/framework/async_executor.cc | 3 +-- paddle/fluid/framework/data_feed.cc | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/framework/async_executor.cc b/paddle/fluid/framework/async_executor.cc index 31335fa7231..2af42a009a9 100755 --- a/paddle/fluid/framework/async_executor.cc +++ b/paddle/fluid/framework/async_executor.cc @@ -143,8 +143,7 @@ void PrepareReaders(std::vector >& readers, readers.resize(thread_num); for (size_t i = 0; i < readers.size(); ++i) { readers[i] = DataFeedFactory::CreateDataFeed(data_feed_desc.name()); - readers[i]->Init(data_feed_desc); // set batch size here - //readers[i]->SetQueueSize(32); // default is 32 + readers[i]->Init(data_feed_desc); // set batch_size and queue_size here } readers[0]->SetFileList(filelist); } diff --git a/paddle/fluid/framework/data_feed.cc b/paddle/fluid/framework/data_feed.cc index be983e614ef..afcae6cdcdc 100755 --- a/paddle/fluid/framework/data_feed.cc +++ b/paddle/fluid/framework/data_feed.cc @@ -60,7 +60,7 @@ bool DataFeed::SetFileList(const std::vector& files) { CheckInit(); if (files.size() == 0) { LOG(ERROR) << "error: you have set an empty filelist"; - return false; + exit(-1); } filelist_.assign(files.begin(), files.end()); file_idx_ = 0; @@ -100,7 +100,7 @@ template void PrivateQueueDataFeed::SetQueueSize(int queue_size) { if (queue_size <= 0) { LOG(ERROR) << "error: illegal queue size: " << queue_size; - return; + exit(-1); } queue_size_ = queue_size; queue_.ReCap(queue_size_); -- GitLab