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

dynamic args #990

Merged
merged 3 commits into from Jun 10, 2019
Merged

dynamic args #990

merged 3 commits into from Jun 10, 2019

Conversation

Ericgig
Copy link
Member

@Ericgig Ericgig commented May 15, 2019

This PR is part of PR #969 , splitting that PR in two parts.

It contains:

  • qobjevo's args that update with the state. (replacing rhs_with_state functionality)
  • method norm renamed to _cdc as it was not used as a norm.
  • cython side of expect method no longer take isherm as an arguments.
  • security check in propagator for H as a function with batch method.
  • propagator uses sesolve capability to evolve operators.
  • floquet now call sesolve instead of mesolve with no collapse.

@Ericgig Ericgig mentioned this pull request May 15, 2019
@coveralls
Copy link

coveralls commented May 15, 2019

Coverage Status

Coverage decreased (-0.2%) to 72.356% when pulling e2d29ad on Ericgig:qoe_dyn_args into 8432b43 on qutip:master.

@Ericgig Ericgig mentioned this pull request May 15, 2019
@nathanshammah
Copy link
Member

@Ericgig thank you a lot for splitting that PR and giving more details.

Copy link
Member

@nathanshammah nathanshammah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks fine. Test notebooks ran fine. Travis CI tests are ok, besides Mac.

@nathanshammah
Copy link
Member

When opening python and importing qutip the first time, I get the warnings

/miniconda3/envs/qdev/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: qutip.cy.cqobjevo.CQobjCte size changed, may indicate binary incompatibility. Expected 344 from C header, got 352 from PyObject
  return f(*args, **kwds)
/miniconda3/envs/qdev/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: qutip.cy.cqobjevo.CQobjEvoTd size changed, may indicate binary incompatibility. Expected 560 from C header, got 568 from PyObject
  return f(*args, **kwds)
/miniconda3/envs/qdev/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: qutip.cy.cqobjevo.CQobjEvoTdMatched size changed, may indicate binary incompatibility. Expected 1344 from C header, got 1352 from PyObject
  return f(*args, **kwds)
/miniconda3/envs/qdev/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: qutip.cy.cqobjevo_factor.CoeffFunc size changed, may indicate binary incompatibility. Expected 32 from C header, got 40 from PyObject
  return f(*args, **kwds)
/miniconda3/envs/qdev/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: qutip.cy.cqobjevo_factor.StrCoeff size changed, may indicate binary incompatibility. Expected 40 from C header, got 488 from PyObject
  return f(*args, **kwds)
/miniconda3/envs/qdev/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: qutip.cy.cqobjevo.CQobjEvo size changed, may indicate binary incompatibility. Expected 288 from C header, got 296 from PyObject
  return f(*args, **kwds)
/miniconda3/envs/qdev/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: qutip.cy.cqobjevo.CQobjCteDense size changed, may indicate binary incompatibility. Expected 496 from C header, got 504 from PyObject
  return f(*args, **kwds)
/miniconda3/envs/qdev/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: qutip.cy.cqobjevo.CQobjEvoTdDense size changed, may indicate binary incompatibility. Expected 920 from C header, got 928 from PyObject
  return f(*args, **kwds)

@nathanshammah
Copy link
Member

nathanshammah commented Jun 10, 2019

Benchmarking
The results of development notebooks

  • development-smesolve-milstein-speed-test.ipynb
  • development-smesolver-new-methods.ipynb
  • development-smesolve-tests.ipynb
  • development-ssesolver-new-methods

all seem consistent with previous notebook results.

Time Benchmarking
All the stochastic solvers in those notebooks now run much faster: between a factor 2 and 30 in speedup from last time I ran them, which was consistent with times obtained by @Ericgig and saved in the folder.

I am on Python 3.7.3, I recently updated OS from High Sierra to Mojave, plus some other updates in scipy and numpy, and reinstalled conda, so I am curious to see if these speedups are machine independent, which would be great. My specs

Software	Version
QuTiP	4.4.0.dev0+e1639f73
Numpy	1.16.4
SciPy	1.2.1
matplotlib	3.1.0
Cython	0.29.8
Number of CPUs	2
BLAS Info	INTEL MKL
IPython	7.5.0
Python	3.7.3 (default, Mar 27 2019, 16:54:48) [Clang 4.0.1 (tags/RELEASE_401/final)]
OS	posix [darwin]
Mon Jun 10 21:16:02 2019 JST

Some details:
In cell 6 of development-ssesolver-new-methods, the running time went from over 160 seconds to 6 seconds (x25 speedup). Total run time in cell 21 is now down to 14.22s from 79.46s, cell 24/25 of is now 1.4 seconds down from 14.22s in smesolve. ssesolve in cell 4 is down from 164.50s to 11.06s. Cell 6 is down to 11.48s from 250s. The next cell checking all solver methods in ssesolve is down from 80s to 24s. In the notebook with new smesolve methods, cell 11 with multiple time dependence in sc_ops now runs in 69s instead of 171s.

Also, the benchmarking of the different methods now reads

{'solver': 'euler-maruyama'}
Total run time:   0.21s
Total run time:   0.25s
Total run time:   0.30s
Total run time:   0.38s
Total run time:   0.45s
Total run time:   0.55s
Total run time:   0.67s
Total run time:   0.81s
{'solver': 'platen'}
Total run time:   0.70s
Total run time:   0.90s
Total run time:   1.13s
Total run time:   1.15s
Total run time:   1.41s
Total run time:   1.66s
Total run time:   2.03s
Total run time:   2.47s
{'solver': 'pc-euler'}
Total run time:   0.38s
Total run time:   0.46s
Total run time:   0.58s
Total run time:   0.70s
Total run time:   0.84s
Total run time:   1.00s
Total run time:   1.26s
Total run time:   1.49s
{'solver': 'milstein'}
Total run time:   0.31s
Total run time:   0.39s
Total run time:   0.46s
Total run time:   0.56s
Total run time:   0.70s
Total run time:   0.84s
Total run time:   1.05s
Total run time:   1.24s
{'solver': 'milstein-imp'}
Total run time:   1.69s
Total run time:   2.10s
Total run time:   2.48s
Total run time:   2.96s
Total run time:   3.62s
Total run time:   4.37s
Total run time:   5.36s
Total run time:   6.73s
{'solver': 'pc-euler-2'}
Total run time:   0.68s
Total run time:   0.91s
Total run time:   0.96s
Total run time:   1.12s
Total run time:   1.37s
Total run time:   1.75s
Total run time:   2.12s
Total run time:   2.46s
{'solver': 'explicit1.5'}
Total run time:   1.96s
Total run time:   2.35s
Total run time:   3.11s
Total run time:   3.48s
Total run time:   4.31s
Total run time:   5.49s
Total run time:   6.86s
Total run time:   7.85s
{'solver': 'taylor1.5'}
Total run time:   1.34s
Total run time:   1.71s
Total run time:   2.19s
Total run time:   2.36s
Total run time:   2.89s
Total run time:   3.45s
Total run time:   4.88s
Total run time:   5.56s
{'solver': 'taylor1.5-imp'}
Total run time:   2.60s
Total run time:   3.08s
Total run time:   3.59s
Total run time:   4.41s
Total run time:   5.35s
Total run time:   6.58s
Total run time:   7.96s
Total run time:   9.72s
1

instead of

{'solver': 'euler-maruyama'}
Total run time:   0.53s
Total run time:   0.58s
Total run time:   0.70s
Total run time:   0.87s
Total run time:   1.08s
Total run time:   1.28s
Total run time:   1.57s
Total run time:   2.01s
{'solver': 'platen'}
Total run time:   1.52s
Total run time:   1.82s
Total run time:   2.21s
Total run time:   2.78s
Total run time:   3.33s
Total run time:   4.05s
Total run time:   4.97s
Total run time:   6.01s
{'solver': 'pc-euler'}
Total run time:   0.92s
Total run time:   1.10s
Total run time:   1.33s
Total run time:   1.64s
Total run time:   2.01s
Total run time:   2.41s
Total run time:   3.05s
Total run time:   3.60s
{'solver': 'milstein'}
Total run time:   0.73s
Total run time:   0.88s
Total run time:   1.06s
Total run time:   1.32s
Total run time:   1.62s
Total run time:   1.96s
Total run time:   2.37s
Total run time:   2.88s
{'solver': 'milstein-imp'}
Total run time:   3.11s
Total run time:   3.61s
Total run time:   4.36s
Total run time:   5.51s
Total run time:   6.58s
Total run time:   9.64s
Total run time:  10.74s
Total run time:  12.29s
{'solver': 'pc-euler-2'}
Total run time:   1.54s
Total run time:   1.86s
Total run time:   2.50s
Total run time:   2.79s
Total run time:   3.36s
Total run time:   4.03s
Total run time:   4.98s
Total run time:   6.56s
{'solver': 'explicit1.5'}
Total run time:   5.28s
Total run time:   6.35s
Total run time:   7.74s
Total run time:   8.99s
Total run time:  10.34s
Total run time:  12.41s
Total run time:  15.40s
Total run time:  21.40s
{'solver': 'taylor1.5'}
Total run time:   3.30s
Total run time:   3.85s
Total run time:   4.52s
Total run time:   5.63s
Total run time:   7.22s
Total run time:   8.72s
Total run time:   9.51s
Total run time:  11.84s
{'solver': 'taylor1.5-imp'}
Total run time:   5.43s
Total run time:   6.81s
Total run time:   7.60s
Total run time:  10.05s
Total run time:  11.88s
Total run time:  12.88s
Total run time:  15.63s
Total run time:  22.31s

Minor issue: plots breaking notebook rendering
Jupyter Notebooks have a broken rendering when cells with plots are run; refreshing the notebook sometimes works fine. This is sometimes fixed in the first place by adding

plt.show()
plt.close()

but not always. Maybe we can have a look at this minor issue in the development notebooks.

Documentation
It would really increase the adoption rate if the API doc and User Guide could be updated to highlight the stochastic solvers and new methods. The development notebooks are so well written that drawing from their examples should be simple.

Congratulations @Ericgig for this refurbishment, improvement, optimization and thorough benchmarking investigations of the stochastic solvers, which I hope will be widely tested by @nwlambert @ajgpitch @quantshah (and @fminga) for robustness once merged in the development master branch. I am merging this and the montecarlo split PR, hoping there are no incompatibility issues (#990 --> #991 --> #969).

@nathanshammah nathanshammah added review in progress PR being reviewed merge ready Contributor happy for PR to be merged labels Jun 10, 2019
@nathanshammah nathanshammah merged commit f95ab88 into qutip:master Jun 10, 2019
@Ericgig Ericgig deleted the qoe_dyn_args branch December 14, 2022 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge ready Contributor happy for PR to be merged review in progress PR being reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants