Closed DavAug closed 4 years ago
The model class works properly but is too slow for useful inference times. This is likely because of unnecessary logs in the background of Myokit.
Currently solving the test one compartment model takes 0.745 sec.
more details:
>>> p = pstats.Stats('tests/model/profile_solve') >>> p.sort_stats('cumulative').print_stats(50) Wed Dec 18 12:19:03 2019 tests/model/profile_solve 335637 function calls (324001 primitive calls) in 0.745 seconds Ordered by: cumulative time List reduced from 3297 to 50 due to restriction <50> ncalls tottime percall cumtime percall filename:lineno(function) 676/1 0.005 0.000 0.746 0.746 {built-in method builtins.exec} 1 0.000 0.000 0.746 0.746 tests/model/profile_solve.py:15(<module>) 1 0.000 0.000 0.498 0.498 /Users/david/Workspace/sabs-r3/PKPD/PKPD/model/model.py:73(solve) 1 0.000 0.000 0.487 0.487 /Users/david/Workspace/sabs-r3/PKPD/env/lib/python3.7/site-packages/myokit/_sim/cvodesim.py:82(__init__) 1 0.000 0.000 0.486 0.486 /Users/david/Workspace/sabs-r3/PKPD/env/lib/python3.7/site-packages/myokit/_sim/__init__.py:88(_compile) 507/21 0.000 0.000 0.410 0.020 <frozen importlib._bootstrap>:211(_call_with_frames_removed) 1 0.000 0.000 0.339 0.339 /Users/david/Workspace/sabs-r3/PKPD/env/lib/python3.7/site-packages/setuptools/__init__.py:142(setup) 1 0.000 0.000 0.327 0.327 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/core.py:57(setup) 1 0.000 0.000 0.323 0.323 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py:960(run_commands) 10/2 0.000 0.000 0.323 0.162 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py:970(run_command) 8/5 0.000 0.000 0.322 0.064 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/cmd.py:308(run_command) 1 0.000 0.000 0.287 0.287 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build.py:128(run) 1 0.000 0.000 0.285 0.285 /Users/david/Workspace/sabs-r3/PKPD/env/lib/python3.7/site-packages/setuptools/command/build_ext.py:75(run) 1 0.000 0.000 0.285 0.285 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build_ext.py:278(run) 1 0.000 0.000 0.284 0.284 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build_ext.py:443(build_extensions) 1 0.000 0.000 0.284 0.284 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build_ext.py:471(_build_extensions_serial) 1 0.000 0.000 0.284 0.284 /Users/david/Workspace/sabs-r3/PKPD/env/lib/python3.7/site-packages/setuptools/command/build_ext.py:193(build_extension) 1 0.000 0.000 0.284 0.284 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build_ext.py:486(build_extension) 411/16 0.002 0.000 0.283 0.018 <frozen importlib._bootstrap>:978(_find_and_load) 411/16 0.001 0.000 0.283 0.018 <frozen importlib._bootstrap>:948(_find_and_load_unlocked) 2 0.000 0.000 0.282 0.141 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/ccompiler.py:909(spawn) 2 0.000 0.000 0.282 0.141 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/spawn.py:16(spawn) 2 0.000 0.000 0.282 0.141 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/spawn.py:88(_spawn_posix) 387/20 0.001 0.000 0.280 0.014 <frozen importlib._bootstrap>:663(_load_unlocked) 3 0.280 0.093 0.280 0.093 {built-in method posix.waitpid} 325/19 0.001 0.000 0.279 0.015 <frozen importlib._bootstrap_external>:722(exec_module) 1 0.000 0.000 0.243 0.243 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/ccompiler.py:511(compile) 1 0.000 0.000 0.242 0.242 /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/unixccompiler.py:111(_compile) 425/84 0.000 0.000 0.188 0.002 {built-in method builtins.__import__} 371/368 0.001 0.000 0.158 0.000 <frozen importlib._bootstrap>:576(module_from_spec) 41/39 0.000 0.000 0.151 0.004 <frozen importlib._bootstrap_external>:1040(create_module) 41/39 0.150 0.004 0.151 0.004 {built-in method _imp.create_dynamic}
New execution time: 0.327 including initialization. Just solving the ODE after initialization is now much faster.
0.327
Progress:
model.solve()
The model class works properly but is too slow for useful inference times. This is likely because of unnecessary logs in the background of Myokit.
Currently solving the test one compartment model takes 0.745 sec.
more details:
New execution time:
0.327
including initialization. Just solving the ODE after initialization is now much faster.Progress: