From b95fb26a2366d06449744a558a7871e28b00f876 Mon Sep 17 00:00:00 2001 From: Ray Andrew <4437323+rayandrew@users.noreply.github.com> Date: Wed, 16 Oct 2024 11:35:55 -0500 Subject: [PATCH] fix negative value of computation time when stdev exists (#233) Due to the nature of normal random equation, the value generated can be negative. Enforcing it to be positive using `abs` will fix the issue --- dlio_benchmark/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlio_benchmark/main.py b/dlio_benchmark/main.py index dd91fa0f..0580d7e4 100644 --- a/dlio_benchmark/main.py +++ b/dlio_benchmark/main.py @@ -229,7 +229,7 @@ def _eval(self, epoch): eval_time = 0.0 if self.eval_time > 0: if self.eval_time_stdev > 0: - eval_time = random.normal(self.eval_time, self.eval_time_stdev) + eval_time = abs(random.normal(self.eval_time, self.eval_time_stdev)) else: eval_time = self.eval_time self.framework.compute(batch, epoch, step, eval_time) @@ -265,7 +265,7 @@ def _train(self, epoch): if self.computation_time > 0: self.framework.trace_object("Train", overall_step, 1) if self.computation_time_stdev > 0: - computation_time = random.normal(self.computation_time, self.computation_time_stdev) + computation_time = abs(random.normal(self.computation_time, self.computation_time_stdev)) else: computation_time = self.computation_time self.framework.compute(batch, epoch, block_step, computation_time)