From 863c75168c3ce4df492474771f48138fd26bcd9c Mon Sep 17 00:00:00 2001 From: chengduo Date: Mon, 3 Jun 2019 19:16:32 +0800 Subject: [PATCH] polish error doc (#17772) test=develop --- paddle/fluid/framework/parallel_executor.cc | 20 ++++++++++++++----- .../fluid/platform/dynload/dynamic_loader.cc | 3 ++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/paddle/fluid/framework/parallel_executor.cc b/paddle/fluid/framework/parallel_executor.cc index d6acaba6e2..d700d76513 100644 --- a/paddle/fluid/framework/parallel_executor.cc +++ b/paddle/fluid/framework/parallel_executor.cc @@ -615,11 +615,21 @@ void ParallelExecutor::FeedAndSplitTensorIntoLocalScopes( const std::unordered_map &tensors) { for (auto pair : tensors) { auto lod_tensors = pair.second.SplitLoDTensor(member_->places_); - PADDLE_ENFORCE_EQ( - member_->places_.size(), lod_tensors.size(), - "The number of samples of current batch is less than the count of " - "devices, currently, it is not allowed. (%d vs %d)", - member_->places_.size(), lod_tensors.size()); + if (member_->places_.size() != lod_tensors.size()) { + bool is_cpu_place = platform::is_cpu_place(member_->places_.front()); + auto error_info = string::Sprintf( + "The number(%d) of samples of " + "current batch is less than the count(%d) of " + "devices(%s), currently, it is not allowed. ", + member_->places_.size(), lod_tensors.size(), + (is_cpu_place ? "CPU" : "GPU")); + if (is_cpu_place) { + error_info += + "You should set the environment variable CPU_NUM in the system " + "to determine the number of devices you need."; + } + PADDLE_THROW(error_info); + } for (size_t j = 0; j < member_->places_.size(); ++j) { // TODO(panxy0718): Do I need to delete this var? auto t = diff --git a/paddle/fluid/platform/dynload/dynamic_loader.cc b/paddle/fluid/platform/dynload/dynamic_loader.cc index 62f623b175..9aafc180b9 100644 --- a/paddle/fluid/platform/dynload/dynamic_loader.cc +++ b/paddle/fluid/platform/dynload/dynamic_loader.cc @@ -107,7 +107,8 @@ static inline void* GetDsoHandleFromDefaultPath(const std::string& dso_path, if (nullptr == dso_handle) { LOG(WARNING) << "Can not find library: " << dso_path - << ". Please try to add the lib path to LD_LIBRARY_PATH."; + << ". The process maybe hang. Please try to add the lib path " + "to LD_LIBRARY_PATH."; } return dso_handle; } -- GitLab