Browse Source

!4710 Fix tfreader multi-thread issue

Merge pull request !4710 from xiefangqi/xfq_fix_tfreader_issue
tags/v0.7.0-beta
mindspore-ci-bot Gitee 5 years ago
parent
commit
0fa0cd7bfe
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      mindspore/ccsrc/minddata/dataset/engine/datasetops/source/tf_reader_op.cc

+ 3
- 2
mindspore/ccsrc/minddata/dataset/engine/datasetops/source/tf_reader_op.cc View File

@@ -238,6 +238,9 @@ Status TFReaderOp::CalculateNumRowsPerShard() {
Status TFReaderOp::operator()() {
RETURN_IF_NOT_OK(CalculateNumRowsPerShard());

// Put here to avoid register failed when Worker_Entry thread exits unexpected
RETURN_IF_NOT_OK(io_block_queue_wait_post_.Register(tree_->AllTasks()));

// launch one thread, responsible for filling mIOBlockQueue
RETURN_IF_NOT_OK(tree_->LaunchWorkers(1, std::bind(&TFReaderOp::WaitToFillIOBlockQueue, this)));

@@ -250,8 +253,6 @@ Status TFReaderOp::operator()() {
// so workers have to be kept alive until the end of the program
TaskManager::FindMe()->Post();

RETURN_IF_NOT_OK(io_block_queue_wait_post_.Register(tree_->AllTasks()));

NotifyToFillIOBlockQueue();
while (!finished_reading_dataset_) {
int64_t buffer_id = 0;


Loading…
Cancel
Save