From 6e1a74f9e9e61a7b88adeaf969565024e6311604 Mon Sep 17 00:00:00 2001 From: Daniel Barry Date: Wed, 21 Aug 2024 19:53:56 +0000 Subject: [PATCH] rocm: add reason for disabled component Previously, in the absence of a ROCm device, the rocm component did not set the string containing the reason that the component was disabled. These changes have been tested with ROCm 6.3.1 on Frontier. --- src/components/rocm/roc_common.c | 4 ++++ src/components/rocm/rocm.c | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/rocm/roc_common.c b/src/components/rocm/roc_common.c index 311c255a6..ff1861a53 100644 --- a/src/components/rocm/roc_common.c +++ b/src/components/rocm/roc_common.c @@ -35,6 +35,10 @@ rocc_init(void) hsa_status_t status = hsa_init_p(); if (status != HSA_STATUS_SUCCESS) { + int errMsgLen = snprintf(error_string, PAPI_MAX_STR_LEN, "%s", "Call to hsa_init() failed."); + if( errMsgLen < 0 || errMsgLen >= PAPI_MAX_STR_LEN ) { + SUBDBG("error_string was truncated.\n"); + } papi_errno = PAPI_EMISC; goto fn_fail; } diff --git a/src/components/rocm/rocm.c b/src/components/rocm/rocm.c index 74d2656e2..f83910a6f 100644 --- a/src/components/rocm/rocm.c +++ b/src/components/rocm/rocm.c @@ -225,7 +225,6 @@ rocm_init_private(void) fn_exit: _rocm_vector.cmp_info.initialized = 1; _rocm_vector.cmp_info.disabled = papi_errno; - strcpy(_rocm_vector.cmp_info.disabled_reason, ""); SUBDBG("EXIT: %s\n", PAPI_strerror(papi_errno)); _papi_hwi_unlock(COMPONENT_LOCK); return papi_errno;