diff --git a/onnxruntime/core/platform/linux/device_discovery.cc b/onnxruntime/core/platform/linux/device_discovery.cc index db6ac73996863..3076d3a1e33b6 100644 --- a/onnxruntime/core/platform/linux/device_discovery.cc +++ b/onnxruntime/core/platform/linux/device_discovery.cc @@ -8,6 +8,7 @@ #include #include #include +#include #include #include "core/common/common.h" @@ -21,14 +22,17 @@ namespace onnxruntime { namespace { -Status ErrorCodeToStatus(const std::error_code& ec) { +Status ErrorCodeToStatus(const std::error_code& ec, const fs::path& path, std::string_view context) { if (!ec) { return Status::OK(); } return Status{common::StatusCategory::ONNXRUNTIME, common::StatusCode::FAIL, MakeString("Error: std::error_code with category name: ", ec.category().name(), - ", value: ", ec.value(), ", message: ", ec.message())}; + ", value: ", ec.value(), + ", message: ", ec.message(), + ", filesystem path: ", path, + ", context: ", context)}; } struct GpuSysfsPathInfo { @@ -40,7 +44,7 @@ Status DetectGpuSysfsPaths(std::vector& gpu_sysfs_paths_out) { std::error_code error_code{}; const fs::path sysfs_class_drm_path = "/sys/class/drm"; const bool sysfs_class_drm_path_exists = fs::exists(sysfs_class_drm_path, error_code); - ORT_RETURN_IF_ERROR(ErrorCodeToStatus(error_code)); + ORT_RETURN_IF_ERROR(ErrorCodeToStatus(error_code, sysfs_class_drm_path, "Checking existance of DRM sysfs path")); if (!sysfs_class_drm_path_exists) { gpu_sysfs_paths_out = std::vector{}; @@ -69,7 +73,7 @@ Status DetectGpuSysfsPaths(std::vector& gpu_sysfs_paths_out) { std::vector gpu_sysfs_paths{}; auto dir_iterator = fs::directory_iterator{sysfs_class_drm_path, error_code}; - ORT_RETURN_IF_ERROR(ErrorCodeToStatus(error_code)); + ORT_RETURN_IF_ERROR(ErrorCodeToStatus(error_code, sysfs_class_drm_path, "Iterating over DRM sysfs devices")); for (const auto& dir_item : dir_iterator) { const auto& dir_item_path = dir_item.path(); @@ -121,7 +125,7 @@ Status GetPciBusId(const std::filesystem::path& sysfs_path, std::optional