From 2e9082250da881da876670afa9cacccc91ba63c2 Mon Sep 17 00:00:00 2001 From: Chen Weihang Date: Wed, 1 Jan 2020 09:28:36 +0800 Subject: [PATCH] polish default error msg & cublas error hint, test=develop (#22032) --- paddle/fluid/platform/enforce.h | 18 +++++++++--------- paddle/fluid/platform/errors.h | 11 ++++++++--- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/paddle/fluid/platform/enforce.h b/paddle/fluid/platform/enforce.h index be25f2d014f..c08ec4fe413 100644 --- a/paddle/fluid/platform/enforce.h +++ b/paddle/fluid/platform/enforce.h @@ -433,23 +433,23 @@ inline std::string build_ex_string(cublasStatus_t stat, const std::string& msg) { std::string err; if (stat == CUBLAS_STATUS_NOT_INITIALIZED) { - err = "CUBLAS: not initialized."; + err = "CUBLAS_STATUS_NOT_INITIALIZED"; } else if (stat == CUBLAS_STATUS_ALLOC_FAILED) { - err = "CUBLAS: alloc failed."; + err = "CUBLAS_STATUS_ALLOC_FAILED"; } else if (stat == CUBLAS_STATUS_INVALID_VALUE) { - err = "CUBLAS: invalid value."; + err = "CUBLAS_STATUS_INVALID_VALUE"; } else if (stat == CUBLAS_STATUS_ARCH_MISMATCH) { - err = "CUBLAS: arch mismatch."; + err = "CUBLAS_STATUS_ARCH_MISMATCH"; } else if (stat == CUBLAS_STATUS_MAPPING_ERROR) { - err = "CUBLAS: mapping error."; + err = "CUBLAS_STATUS_MAPPING_ERROR"; } else if (stat == CUBLAS_STATUS_EXECUTION_FAILED) { - err = "CUBLAS: execution failed."; + err = "CUBLAS_STATUS_EXECUTION_FAILED"; } else if (stat == CUBLAS_STATUS_INTERNAL_ERROR) { - err = "CUBLAS: internal error."; + err = "CUBLAS_STATUS_INTERNAL_ERROR"; } else if (stat == CUBLAS_STATUS_NOT_SUPPORTED) { - err = "CUBLAS: not supported, "; + err = "CUBLAS_STATUS_NOT_SUPPORTED"; } else if (stat == CUBLAS_STATUS_LICENSE_ERROR) { - err = "CUBLAS: license error."; + err = "CUBLAS_STATUS_LICENSE_ERROR"; } return msg + "\n [Hint: " + err + "]"; } diff --git a/paddle/fluid/platform/errors.h b/paddle/fluid/platform/errors.h index c4184df9eff..5c145845fa6 100644 --- a/paddle/fluid/platform/errors.h +++ b/paddle/fluid/platform/errors.h @@ -36,9 +36,14 @@ class ErrorSummary { ErrorSummary() { code_ = paddle::platform::error::LEGACY; msg_ = - "Paddle internal Check failed. (Please help us create a new issue, " - "here we need to find the developer to add a user friendly error " - "message)"; + "An error occurred here. There is no accurate error hint for this " + "error yet. We are continuously in the process of increasing hint for " + "this kind of error check. It would be helpful if you could inform us " + "of how this conversion went by opening a github issue. And we will " + "resolve it with high priority.\n" + " - New issue link: " + "https://github.com/PaddlePaddle/Paddle/issues/new\n" + " - Recommended issue content: all error stack information"; } // Note(chenweihang): Final deprecated constructor -- GitLab