diff --git a/paddle/fluid/framework/parallel_executor.cc b/paddle/fluid/framework/parallel_executor.cc index d6acaba6e2df33cbf5c7147747de6adf4f0ee96f..d700d76513ef9158a2681068b4f4899244862493 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 62f623b175e78ba7fc94ed9ab9a96b38f3d3e271..9aafc180b90c522ba8ee7508686279957ea97319 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; }