-
Notifications
You must be signed in to change notification settings - Fork 240
/
benchmark_manyvars.py
53 lines (39 loc) · 1.14 KB
/
benchmark_manyvars.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import unittest
import openmdao.api as om
from openmdao.test_suite.build4test import DynComp, create_dyncomps
def _build_comp(np, no, ns=0):
prob = om.Problem()
prob.model.add_subsystem("C1", DynComp(np, no, ns))
return prob
class BM(unittest.TestCase):
"""Some tests for setup of a component with a large
number of variables.
"""
def benchmark_1Kparams(self):
prob = _build_comp(1000, 1)
prob.setup()
prob.final_setup()
def benchmark_2Kparams(self):
prob = _build_comp(2000, 1)
prob.setup()
prob.final_setup()
def benchmark_1Kouts(self):
prob = _build_comp(1, 1000)
prob.setup()
prob.final_setup()
def benchmark_2Kouts(self):
prob = _build_comp(1, 2000)
prob.setup()
prob.final_setup()
def benchmark_1Kvars(self):
prob = _build_comp(500, 500)
prob.setup()
prob.final_setup()
def benchmark_2Kvars(self):
prob = _build_comp(1000, 1000)
prob.setup()
prob.final_setup()
if __name__ == '__main__':
prob = _build_comp(1, 2000)
prob.setup()
prob.final_setup()