tempoCollaboration / OQuPy

A Python package to efficiently simulate non-Markovian open quantum systems with process tensors.
https://oqupy.readthedocs.io
Apache License 2.0
71 stars 24 forks source link

A start on performance testing, and the generation of process tensors for that purpose. #123

Closed gefux closed 3 months ago

gefux commented 3 months ago

resolves #119 and #120.

Implements:

tests/data/generate_pts.py: a module that generates process tensors for performance testing purposes based on a name convention similar to the one discussed in #119.

Performance analysis for the PT-TEBD functionality (serving as a blueprint for other use cases). This entails:

piperfw commented 3 months ago

@gefux The framework looks really good. I have a few questions and suggestions on particulars:

The other thought I had on is whether we should code in some timeouts. I'm not familiar with GitHub CI but I understand free accounts get 2000 mins / month. If we're using their runners, we don't want a test to hang (it looks like GitHub has a job timeout of 6 hours). Here are two ways timeouts can be imposed in Python: https://medium.com/@chaoren/how-to-timeout-in-python-726002bf2291

piperfw commented 3 months ago

@JoelANB Note there were some changes to the test file arrangement. If you've already started on the mean-field test, I would probably suggest just getting that done and it shouldn't be too much work to reorganise things at the end as needed.

gefux commented 3 months ago

Thank you @piperfw for your comments and suggestions.

piperfw commented 3 months ago

All the changes look great @gefux! The added verbosity is very helpful and the combination of prepare and run scripts a good simplification.

Thanks for responding to my comments in detail. Manually invoking testings for now (and so not requiring timeouts) makes sense.

The only point I would pick up with is the metadata: including even a basic amount now seems like a very low cost operation that can be built upon if/when we decide exactly what metadata will be useful.

It's surprising how quickly one forgets exactly which test generated which results file, and short of deleting all test data and running every test again, there is no reliable way to ascertain this (e.g. perhaps parameters were changed between tests).

Version metadata may be helpful if a performance change with time is noticed. It may also be useful when investigating performance issues reported by other users (e.g., the hd5py version problem we had a while ago).

The metadata could just be added by run_all, so separate to the implementation of any particular test. I've added a basic function to do this in run_all.py. If you really don't think this is helpful, then we can remove it, otherwise I at least don't see any harm in having the template there now.

Let me know and I can complete the PR!

piperfw commented 3 months ago

I've just finished tidying up Joel's performance test for mean-field systems to be in line with the current testing structure. I suggest we merge his fork into yours before completing this PR.

gefux commented 3 months ago

Hi Piper. The meta-data function is great - you have convinced me. On the PR²: I don't think a PR on a PR is a good idea. In this case it messes up the rebase that I've done. So, I think it would be better to first merge this PR to dev-v0.5. Then Joel's PR should be a seperate PR and ideally rebase on dev-v0.5 (as we advice in the CONTRIBUTION.md) I am happy to help with that rebase.

piperfw commented 3 months ago

Great Gerald, are you happy for me to squash the commits (I normally just group by authorship) here and merge? Would do it tomorrow AM.

Rebasing Joel's after should be fine but I'll let you know if I need help.

piperfw commented 3 months ago

Merged (closed #120, left #119 open for now). Attempting to rebase second-order PR...