From 29d2718a91cfde6d24c29eee49b8a3b07a617c3e Mon Sep 17 00:00:00 2001 From: "Gregory R. Lee" Date: Fri, 27 Sep 2024 09:10:12 -0400 Subject: [PATCH 1/3] explicitly cast DLDeviceType enum to int when logging it Signed-off-by: Gregory R. Lee --- .../multiai_endoscopy/cpp/post-proc-cpu/multi_ai.cpp | 5 +++-- .../multiai_endoscopy/cpp/post-proc-matx-cpu/multi_ai.cpp | 5 +++-- .../multiai_endoscopy/cpp/post-proc-matx-gpu/multi_ai.cu | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/applications/multiai_endoscopy/cpp/post-proc-cpu/multi_ai.cpp b/applications/multiai_endoscopy/cpp/post-proc-cpu/multi_ai.cpp index 61dd617fe..6a7ed0a2a 100644 --- a/applications/multiai_endoscopy/cpp/post-proc-cpu/multi_ai.cpp +++ b/applications/multiai_endoscopy/cpp/post-proc-cpu/multi_ai.cpp @@ -81,8 +81,9 @@ void print_tensor(const std::shared_ptr& tensor, auto ndim = tensor->ndim(); auto itemsize = tensor->itemsize(); - HOLOSCAN_LOG_INFO( - "device.device_type={}, device.device_id={}", device.device_type, device.device_id); + HOLOSCAN_LOG_INFO("device.device_type={}, device.device_id={}", + static_cast(device.device_type), + device.device_id); HOLOSCAN_LOG_INFO( "dtype.code={}, dtype.bits={}, dtype.lanes={}", dtype.code, dtype.bits, dtype.lanes); for (int i = 0; i < shape.size(); ++i) { HOLOSCAN_LOG_INFO("shape[{}]={}", i, shape[i]); } diff --git a/applications/multiai_endoscopy/cpp/post-proc-matx-cpu/multi_ai.cpp b/applications/multiai_endoscopy/cpp/post-proc-matx-cpu/multi_ai.cpp index 28d09dddf..a2a687fd3 100644 --- a/applications/multiai_endoscopy/cpp/post-proc-matx-cpu/multi_ai.cpp +++ b/applications/multiai_endoscopy/cpp/post-proc-matx-cpu/multi_ai.cpp @@ -53,8 +53,9 @@ void print_tensor(const std::shared_ptr& tensor, size_t n_prin auto ndim = tensor->ndim(); auto itemsize = tensor->itemsize(); - HOLOSCAN_LOG_INFO( - "device.device_type={}, device.device_id={}", device.device_type, device.device_id); + HOLOSCAN_LOG_INFO("device.device_type={}, device.device_id={}", + static_cast(device.device_type), + device.device_id); HOLOSCAN_LOG_INFO( "dtype.code={}, dtype.bits={}, dtype.lanes={}", dtype.code, dtype.bits, dtype.lanes); for (int i = 0; i < shape.size(); ++i) { HOLOSCAN_LOG_INFO("shape[{}]={}", i, shape[i]); } diff --git a/applications/multiai_endoscopy/cpp/post-proc-matx-gpu/multi_ai.cu b/applications/multiai_endoscopy/cpp/post-proc-matx-gpu/multi_ai.cu index a87fd349b..6f0d5753b 100644 --- a/applications/multiai_endoscopy/cpp/post-proc-matx-gpu/multi_ai.cu +++ b/applications/multiai_endoscopy/cpp/post-proc-matx-gpu/multi_ai.cu @@ -54,8 +54,9 @@ void print_tensor(const std::shared_ptr& tensor, size_t n_prin auto ndim = tensor->ndim(); auto itemsize = tensor->itemsize(); - HOLOSCAN_LOG_INFO( - "device.device_type={}, device.device_id={}", device.device_type, device.device_id); + HOLOSCAN_LOG_INFO("device.device_type={}, device.device_id={}", + static_cast(device.device_type), + device.device_id); HOLOSCAN_LOG_INFO( "dtype.code={}, dtype.bits={}, dtype.lanes={}", dtype.code, dtype.bits, dtype.lanes); for (int i = 0; i < shape.size(); ++i) { HOLOSCAN_LOG_INFO("shape[{}]={}", i, shape[i]); } From 40184bb2b6c2c135b47561de809367cb6b2b2200 Mon Sep 17 00:00:00 2001 From: "Gregory R. Lee" Date: Fri, 27 Sep 2024 09:14:33 -0400 Subject: [PATCH 2/3] update CUDA_TRY macros to explicitly cast cudaError_t to int when logging Signed-off-by: Gregory R. Lee --- applications/multiai_endoscopy/cpp/post-proc-cpu/multi_ai.cpp | 2 +- .../multiai_endoscopy/cpp/post-proc-matx-cpu/multi_ai.cpp | 2 +- .../multiai_endoscopy/cpp/post-proc-matx-gpu/multi_ai.cu | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/applications/multiai_endoscopy/cpp/post-proc-cpu/multi_ai.cpp b/applications/multiai_endoscopy/cpp/post-proc-cpu/multi_ai.cpp index 6a7ed0a2a..5702b23bb 100644 --- a/applications/multiai_endoscopy/cpp/post-proc-cpu/multi_ai.cpp +++ b/applications/multiai_endoscopy/cpp/post-proc-cpu/multi_ai.cpp @@ -42,7 +42,7 @@ __LINE__, \ __FILE__, \ cudaGetErrorString(cuda_status), \ - cuda_status); \ + static_cast(cuda_status)); \ throw std::runtime_error("Unable to copy device to host"); \ } \ } diff --git a/applications/multiai_endoscopy/cpp/post-proc-matx-cpu/multi_ai.cpp b/applications/multiai_endoscopy/cpp/post-proc-matx-cpu/multi_ai.cpp index a2a687fd3..ea1ba63d4 100644 --- a/applications/multiai_endoscopy/cpp/post-proc-matx-cpu/multi_ai.cpp +++ b/applications/multiai_endoscopy/cpp/post-proc-matx-cpu/multi_ai.cpp @@ -36,7 +36,7 @@ __LINE__, \ __FILE__, \ cudaGetErrorString(cuda_status), \ - cuda_status); \ + static_cast(cuda_status)); \ throw std::runtime_error("Unable to copy device to host"); \ } \ } diff --git a/applications/multiai_endoscopy/cpp/post-proc-matx-gpu/multi_ai.cu b/applications/multiai_endoscopy/cpp/post-proc-matx-gpu/multi_ai.cu index 6f0d5753b..6ea84baa9 100644 --- a/applications/multiai_endoscopy/cpp/post-proc-matx-gpu/multi_ai.cu +++ b/applications/multiai_endoscopy/cpp/post-proc-matx-gpu/multi_ai.cu @@ -37,7 +37,7 @@ __LINE__, \ __FILE__, \ cudaGetErrorString(cuda_status), \ - cuda_status); \ + static_cast(cuda_status)); \ throw std::runtime_error("Unable to copy device to host"); \ } \ } From c29fe5c00225cd6747ea0b46cbe5c0a3d74e4943 Mon Sep 17 00:00:00 2001 From: "Gregory R. Lee" Date: Fri, 27 Sep 2024 09:20:35 -0400 Subject: [PATCH 3/3] Explicitly cast NppStatus enum to int when logging Signed-off-by: Gregory R. Lee --- operators/npp_filter/npp_filter.cpp | 3 ++- .../orsi_format_converter/format_converter.cpp | 16 ++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/operators/npp_filter/npp_filter.cpp b/operators/npp_filter/npp_filter.cpp index 2479382f8..11eec982a 100644 --- a/operators/npp_filter/npp_filter.cpp +++ b/operators/npp_filter/npp_filter.cpp @@ -282,7 +282,8 @@ void NppFilterOp::compute(InputContext& op_input, OutputContext& op_output, throw std::runtime_error(fmt::format("Unknown filter {}.", filter_.get())); } if (status != NPP_SUCCESS) { - throw std::runtime_error(fmt::format("Filter {} failed with error {}", filter_.get(), status)); + throw std::runtime_error( + fmt::format("Filter {} failed with error {}", filter_.get(), static_cast(status))); } // pass the CUDA stream to the output message diff --git a/operators/orsi/orsi_format_converter/format_converter.cpp b/operators/orsi/orsi_format_converter/format_converter.cpp index 32afb91b8..7d130188b 100644 --- a/operators/orsi/orsi_format_converter/format_converter.cpp +++ b/operators/orsi/orsi_format_converter/format_converter.cpp @@ -713,8 +713,8 @@ void FormatConverterOp::convertTensorFormat(const void* in_tensor_data, void* ou scale_max_, npp_stream_ctx_); } else { - throw std::runtime_error( - fmt::format("Failed to convert channel order (NPP error code: {})", status)); + throw std::runtime_error(fmt::format("Failed to convert channel order (NPP error code: {})", + static_cast(status))); } break; } @@ -737,7 +737,8 @@ void FormatConverterOp::convertTensorFormat(const void* in_tensor_data, void* ou status = nppiRGBToYUV420_8u_C3P3R(in_tensor_ptr, src_step, out_yuv_ptrs, out_yuv_steps, roi); if (status != NPP_SUCCESS) { throw std::runtime_error( - fmt::format("rgb888 to yuv420 conversion failed (NPP error code: {})", status)); + fmt::format("rgb888 to yuv420 conversion failed (NPP error code: {})", + static_cast(status))); } break; } @@ -759,7 +760,8 @@ void FormatConverterOp::convertTensorFormat(const void* in_tensor_data, void* ou status = nppiYUV420ToRGB_8u_P3AC4R(in_yuv_ptrs, in_yuv_steps, out_tensor_ptr, dst_step, roi); if (status != NPP_SUCCESS) { throw std::runtime_error( - fmt::format("yuv420 to rgba8888 conversion failed (NPP error code: {})", status)); + fmt::format("yuv420 to rgba8888 conversion failed (NPP error code: {})", + static_cast(status))); } break; } @@ -781,7 +783,8 @@ void FormatConverterOp::convertTensorFormat(const void* in_tensor_data, void* ou status = nppiYUV420ToRGB_8u_P3C3R(in_yuv_ptrs, in_yuv_steps, out_tensor_ptr, dst_step, roi); if (status != NPP_SUCCESS) { throw std::runtime_error( - fmt::format("yuv420 to rgb888 conversion failed (NPP error code: {})", status)); + fmt::format("yuv420 to rgb888 conversion failed (NPP error code: {})", + static_cast(status))); } break; } @@ -800,7 +803,8 @@ void FormatConverterOp::convertTensorFormat(const void* in_tensor_data, void* ou nppiNV12ToRGB_709HDTV_8u_P2C3R(in_y_uv_ptrs, in_y_uv_step, out_tensor_ptr, dst_step, roi); if (status != NPP_SUCCESS) { throw std::runtime_error( - fmt::format("NV12 to rgb888 conversion failed (NPP error code: {})", status)); + fmt::format("NV12 to rgb888 conversion failed (NPP error code: {})", + static_cast(status))); } break; }