Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed benchmarks for change of jacobian keys in OpenMDAO 3.31 #48

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions benchmark/benchmark_derivs_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@

import unittest

from packaging.version import Version

import numpy as np

from openmdao import __version__ as om_version
from openmdao.api import Problem, LinearBlockGS
from openmdao.utils.assert_utils import assert_near_equal

Expand Down Expand Up @@ -69,7 +72,16 @@ def benchmark_cadre_mdp_derivs_full(self):
# ----------------------------------------
J = prob.compute_totals()

assert_near_equal(J['obj.val', 'bp.antAngle'][0][0],
67.15777407, 1e-4)
assert_near_equal(J['obj.val', 'parallel.pt1.design.CP_gamma'][-1][-1],
-0.62410223816776056, 1e-4)
if Version(om_version) <= Version("3.30"):
assert_near_equal(J['obj.val', 'bp.antAngle'][0][0],
67.15777407, 1e-4)
assert_near_equal(J['obj.val', 'parallel.pt1.design.CP_gamma'][-1][-1],
-0.62410223816776056, 1e-4)
else:
# as of OpenMDAO 3.31.0, the keys in the jac are the 'user facing' names
# given to the design vars and responses, rather than the absolute names
# that were used previously
assert_near_equal(J['obj.val', 'bp.antAngle'][0][0],
67.15777407, 1e-4)
assert_near_equal(J['obj.val', 'pt1.CP_gamma'][-1][-1],
-0.62410223816776056, 1e-4)
20 changes: 16 additions & 4 deletions benchmark/benchmark_derivs_full_par.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@

import unittest

from packaging.version import Version

import numpy as np

from openmdao import __version__ as om_version
from openmdao.api import Problem, LinearBlockGS
from openmdao.utils.assert_utils import assert_near_equal

Expand Down Expand Up @@ -71,7 +74,16 @@ def benchmark_cadre_mdp_derivs_full_par(self):
# ----------------------------------------
J = prob.compute_totals()

assert_near_equal(J['obj.val', 'bp.antAngle'][0][0],
67.15777407, 1e-4)
assert_near_equal(J['obj.val', 'parallel.pt1.design.CP_gamma'][-1][-1],
-0.62410223816776056, 1e-4)
if Version(om_version) <= Version("3.30"):
assert_near_equal(J['obj.val', 'bp.antAngle'][0][0],
67.15777407, 1e-4)
assert_near_equal(J['obj.val', 'parallel.pt1.design.CP_gamma'][-1][-1],
-0.62410223816776056, 1e-4)
else:
# as of OpenMDAO 3.31.0, the keys in the jac are the 'user facing' names
# given to the design vars and responses, rather than the absolute names
# that were used previously
assert_near_equal(J['obj.val', 'bp.antAngle'][0][0],
67.15777407, 1e-4)
assert_near_equal(J['obj.val', 'pt1.CP_gamma'][-1][-1],
-0.62410223816776056, 1e-4)
Loading