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

Pyspinw (Initial Version) #136

Merged
merged 16 commits into from
Apr 25, 2023
Merged

Pyspinw (Initial Version) #136

merged 16 commits into from
Apr 25, 2023

Conversation

wardsimon
Copy link

No description provided.

mducle and others added 15 commits March 24, 2023 14:01
* Parameterize tests to loop over mex enabled/disabled

* Validate eignevectors allowing sign-flip in super class

* Add setup/teardown that disables mex

I would like this to be a single static method thats called on setup/teardown

* Compile mex files in run_tests

* brew install llvm to allow mac os to compile mex with openMP

And change compile flags in sw_mex for mac

* In rare case chol_omp fails try the non-mex code ( cbebda2 )

test test_sw_qh5_saveSabp_incommensurate fails ~1/50 timeswith an error in sortmode - but the cause is actually that K2 contains NaN values.
Have moved non-nex code to a separate function - hopefully copy-on-write will mean the matrices passed as input (for which memory is pre-allocated) aren't copied/duplicated

* Fix non-thread safe mex code cause flaky tests

It seems that calls which reference the input arrays
  plhs and prhs in mex files are not thread safe
The code in `eig_omp` and `chol_omp` has been fix
  so that this is now done outside the parallel loops

* Fix flaky MacOS test with mex

For some reason with a large omega_tol added to the diagonal,
on MacOS `chol` gives erroneous eigenvalues (of ~1e-3 instead of zero).
This error goes down with the value of omega_tol.
On other platforms the error is not so large (~1e-6).
In the non-mex code, it tries first with smaller omega_tol,
(==`min(eig(ham))`) so doesn't get this error but the mex code
just uses `omega_tol` input directly.

* Revert cbebda2 - not needed after mex thread safe fix

---------

Co-authored-by: Duc Le <duc.le@stfc.ac.uk>
Fix out-of-memory error in mmat
* Fix bug in systemtest where ref data was always regenerated

* Reduce test verbosity

* Fix flaky optmagk test

* Use persistent swpref in sw_timeit

* Fix PCSMO system test twin matrix

* Silence warnings in tests

* OpenMP mex improvements

Zero initialises arrays in chol_omp
  seems to fix remaining flaky mex tests
Change omp critical to atomic for better performance

* Improve optmagstr params test with new mock

* Fix chol_omp error code collision
@wardsimon wardsimon changed the base branch from master to pyspinw April 25, 2023 09:30
@wardsimon wardsimon marked this pull request as ready for review April 25, 2023 11:33
@wardsimon wardsimon merged commit 734a8b0 into SpinW:pyspinw Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants