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

Added CGLS using DistributedArray #29

Merged
merged 10 commits into from
Jul 8, 2023
Merged

Added CGLS using DistributedArray #29

merged 10 commits into from
Jul 8, 2023

Conversation

rohanbabbar04
Copy link
Collaborator

  • Added conj() and copy() to DistributedArray as they were used quite often.
  • Added CGLS class similar to pylops but now using DistributedArray.
  • Added cgls method which will be used by users, as we do in pylops(again with DistributedArray).
  • Added some random tests for both real and complex(test cases are same as pylops).
  • Added cgls and CGLS to docs.
  • Also added cgls to __init__.py(same as pylops).

Copy link
Contributor

@mrava87 mrava87 left a comment

Choose a reason for hiding this comment

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

This code looks very good. I just found something in the tests that I didn't like (the use of a very loose assert assert_array_almost_equal(.. decimal=4) and tried to switch to assert_allclose(..., rtol=1e-14) - I remember Yuxi asked something similar for the tests of DistributedArray.

I tried to make the change but the tests fail (some pass if I lift it to 1e-8)... this tells me something isn't the same as the pylops implementation. As long as we understand why this is the case, it is not a problem (perhaps MPI does some rounding when passing arrays?), but I would like you to investigate this a bit before merging and being happy with having some inconsistency with the serial solver

pylops_mpi/optimization/__init__.py Outdated Show resolved Hide resolved
@rohanbabbar04
Copy link
Collaborator Author

So @mrava87 I was able to figure out as to why it was failing for rtol=1e-14, the main reason was the floating precision,
numpy dot product is a little imprecise so to handle this i updated float64 -> float128 and complex64 -> complex256 in the test cases and everything seems to work properly...

@mrava87
Copy link
Contributor

mrava87 commented Jul 8, 2023

Ok, interesting. Good finding :) then I think this is good to go

@rohanbabbar04 rohanbabbar04 merged commit 861dd9f into main Jul 8, 2023
15 checks passed
@rohanbabbar04 rohanbabbar04 deleted the cgls branch July 9, 2023 04:11
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.

2 participants