Browse Source

!26838 [dataset] 修复mindspore使用per_batch_map时内存过高直接退出没有任何提示的问题

Merge pull request !26838 from xiefangqi/md_fix_batch_oom_problem
tags/v1.6.0
i-robot Gitee 4 years ago
parent
commit
ed0f0d4453
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.cc
  2. +1
    -1
      mindspore/ccsrc/minddata/dataset/util/status.h

+ 1
- 1
mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.cc View File

@@ -132,7 +132,7 @@ Status BatchOp::operator()() {

#if !defined(_WIN32) && !defined(_WIN64) && !defined(__APPLE__) && ENABLE_PYTHON
if ((num_workers_ > 1 || batch_map_func_) && GetMemoryUsage() > MAX_MEMORY_USAGE_THRESHOLD) {
MS_LOG(WARNING) << "Memory consumption is more than " << MAX_MEMORY_USAGE_THRESHOLD * 100 << "%, "
MS_LOG(WARNING) << "Memory consumption is more than " << (GetMemoryUsage() * 100) << "%, "
<< "which may cause oom error. Please reduce num_parallel_workers size / "
<< "optimize per_batch_map function / other python data preprocess function to "
<< "reduce memory usage.";


+ 1
- 1
mindspore/ccsrc/minddata/dataset/util/status.h View File

@@ -91,7 +91,7 @@ namespace dataset {
} while (false)

#if !defined(_WIN32) && !defined(_WIN64) && !defined(__APPLE__)
const float MAX_MEMORY_USAGE_THRESHOLD = 0.95;
const float MAX_MEMORY_USAGE_THRESHOLD = 0.8;
float GetMemoryUsage();
#endif
} // namespace dataset


Loading…
Cancel
Save