Skip to content

Commit

Permalink
Added FATAL log message when an error is encountered when running the…
Browse files Browse the repository at this point in the history
… sim (#2041)
  • Loading branch information
Charlie-Zheng committed Mar 11, 2024
1 parent 9a38abd commit 0b93919
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 8 additions & 2 deletions pkg/optimization/details.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ func (stats *SubstatOptimizerDetails) calculateSubstatGradientsForChar(

seed := time.Now().UnixNano()
init := optstats.NewDamageAggBuffer(stats.simcfg)
optstats.RunWithConfigCustomStats(context.TODO(), stats.cfg, stats.simcfg, stats.gcsl, stats.simopt, seed, optstats.OptimizerDmgStat, init.Add)
_, err := optstats.RunWithConfigCustomStats(context.TODO(), stats.cfg, stats.simcfg, stats.gcsl, stats.simopt, seed, optstats.OptimizerDmgStat, init.Add)
if err != nil {
stats.optimizer.logger.Fatal(err.Error())
}
init.Flush()
// TODO: Test if median or mean gives better results
initialMean := mean(init.ExpectedDps)
Expand All @@ -99,7 +102,10 @@ func (stats *SubstatOptimizerDetails) calculateSubstatGradientsForChar(
stats.simcfg.Characters = stats.charProfilesCopy

a := optstats.NewDamageAggBuffer(stats.simcfg)
optstats.RunWithConfigCustomStats(context.TODO(), stats.cfg, stats.simcfg, stats.gcsl, stats.simopt, seed, optstats.OptimizerDmgStat, a.Add)
_, err := optstats.RunWithConfigCustomStats(context.TODO(), stats.cfg, stats.simcfg, stats.gcsl, stats.simopt, seed, optstats.OptimizerDmgStat, a.Add)
if err != nil {
stats.optimizer.logger.Fatal(err.Error())
}
a.Flush()

substatGradients[idxSubstat] = mean(a.ExpectedDps) - initialMean
Expand Down
5 changes: 4 additions & 1 deletion pkg/optimization/opt_energy.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ func (stats *SubstatOptimizerDetails) findOptimalERforChars() {

seed := time.Now().UnixNano()
a := optstats.NewEnergyAggBuffer(stats.simcfg)
optstats.RunWithConfigCustomStats(context.TODO(), stats.cfg, stats.simcfg, stats.gcsl, stats.simopt, seed, optstats.OptimizerERStat, a.Add)
_, err := optstats.RunWithConfigCustomStats(context.TODO(), stats.cfg, stats.simcfg, stats.gcsl, stats.simopt, seed, optstats.OptimizerERStat, a.Add)
if err != nil {
stats.optimizer.logger.Fatal(err.Error())
}
a.Flush()
for idxChar := range stats.charProfilesERBaseline {
// erDiff is the amount of ER we need
Expand Down

0 comments on commit 0b93919

Please sign in to comment.