Skip to content

Commit

Permalink
Qualification tool: qualification tool can error out from a divide by…
Browse files Browse the repository at this point in the history
… zero
  • Loading branch information
kuhushukla committed Oct 27, 2023
1 parent 0163eb8 commit 383b9fd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions user_tools/src/spark_rapids_pytools/rapids/qualification.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,9 @@ def __calc_apps_cost(self,
def get_costs_for_single_app(df_row, estimator: SavingsEstimator) -> pd.Series:
raw_cpu_cost, raw_gpu_cost, _ = estimator.get_costs_and_savings(df_row['App Duration'],
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)
cpu_cost = (100 - self.ctxt.get_ctxt('cpu_discount')) / 100 * raw_cpu_cost if raw_cpu_cost > 0 else 0
gpu_cost = (100 - self.ctxt.get_ctxt('gpu_discount')) / 100 * raw_gpu_cost if raw_gpu_cost > 0 else 0
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'
Expand Down

0 comments on commit 383b9fd

Please sign in to comment.