From 8bd72673e8a8cd617e62fec65400127dbdf8e8ec Mon Sep 17 00:00:00 2001 From: Nicholas Curtis Date: Thu, 9 May 2024 14:59:57 -0400 Subject: [PATCH] Add fix for case where we pass a single 'nan' value to to_avg This is triggered by doing e.g., analyze -p -k -n per_kernel -b 17 18 Manifests as e.g.: ``` ERROR [analysis] 'float' object has no attribute 'empty' ``` because of: https://github.com/ROCm/omniperf/blob/f3a0360a5640e4539fac534f73876f51ddd268d0/src/utils/parser.py#L135 Instead, we first check whether numpy thinks the whole array is nan's, and bail early if so Signed-off-by: Nicholas Curtis [ROCm/rocprofiler-compute commit: 047d7771f352870aa412a03ec9b1ac72cef44e07] --- projects/rocprofiler-compute/src/utils/parser.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/rocprofiler-compute/src/utils/parser.py b/projects/rocprofiler-compute/src/utils/parser.py index 5ca591eaae..654057b400 100644 --- a/projects/rocprofiler-compute/src/utils/parser.py +++ b/projects/rocprofiler-compute/src/utils/parser.py @@ -132,6 +132,8 @@ def to_max(*args): def to_avg(a): if str(type(a)) == "": return np.nan + elif np.isnan(a).all(): + return np.nan elif a.empty: return np.nan elif isinstance(a, pd.core.series.Series):