From 0bcacf99006728afd837e882057be890c25fd344 Mon Sep 17 00:00:00 2001 From: Kuhu Shukla Date: Fri, 27 Oct 2023 14:23:58 -0500 Subject: [PATCH] Qualification tool: qualification tool can error out from a divide by zero Signed-off-by: Kuhu Shukla --- user_tools/src/spark_rapids_pytools/rapids/qualification.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_tools/src/spark_rapids_pytools/rapids/qualification.py b/user_tools/src/spark_rapids_pytools/rapids/qualification.py index 7b5ed96b1..a9d78bea5 100644 --- a/user_tools/src/spark_rapids_pytools/rapids/qualification.py +++ b/user_tools/src/spark_rapids_pytools/rapids/qualification.py @@ -574,7 +574,7 @@ def get_costs_for_single_app(df_row, estimator: SavingsEstimator) -> pd.Series: df_row['Estimated GPU Duration']) cpu_cost = (100 - self.ctxt.get_ctxt('cpu_discount')) / 100 * raw_cpu_cost gpu_cost = (100 - self.ctxt.get_ctxt('gpu_discount')) / 100 * raw_gpu_cost - est_savings = 100.0 - ((100.0 * gpu_cost) / cpu_cost) + est_savings = 100.0 - ((100.0 * gpu_cost) / cpu_cost) if cpu_cost > 0 else 0 # We do not want to mistakenly mark a Not-applicable app as Recommended in the savings column if df_row[speedup_rec_col] == 'Not Applicable': savings_recommendations = 'Not Applicable'