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

Fix tests for cupy and cuquantum backends #1238

Merged
merged 24 commits into from
May 15, 2024
Merged

Fix tests for cupy and cuquantum backends #1238

merged 24 commits into from
May 15, 2024

Conversation

renatomello
Copy link
Contributor

@renatomello renatomello commented Feb 29, 2024

Checklist:

  • Reviewers confirm new code works as expected.
  • Tests are passing.
  • Coverage does not decrease.
  • Documentation is updated.

@renatomello renatomello changed the title Fix tests for cuquantum backend Fix tests for cupy and cuquantum backends Feb 29, 2024
Copy link

codecov bot commented Mar 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.81%. Comparing base (81c173b) to head (7e04b68).
Report is 6 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1238   +/-   ##
=======================================
  Coverage   99.81%   99.81%           
=======================================
  Files          72       72           
  Lines       10520    10528    +8     
=======================================
+ Hits        10501    10509    +8     
  Misses         19       19           
Flag Coverage Δ
unittests 99.81% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@renatomello renatomello linked an issue Mar 1, 2024 that may be closed by this pull request
@renatomello renatomello marked this pull request as draft March 1, 2024 06:31
Copy link
Member

@alecandido alecandido left a comment

Choose a reason for hiding this comment

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

Thanks @renatomello, I see that it is not completed yet, but it already seems a simplification.

As soon as you complete, I'll be glad to approve!

tests/test_quantum_info_clifford.py Outdated Show resolved Hide resolved
tests/test_models_encodings.py Outdated Show resolved Hide resolved
@renatomello
Copy link
Contributor Author

Some tests in tests/test_models_error_mitigation.py fail on GPU only if the tests are ran in sequence. If the tests are ran individually, the tests pass. This is probably an issue with GlobalBackend being set up by a previous test

@renatomello
Copy link
Contributor Author

@MatteoRobbiati the majority of DBI tests are failing on GPU. It seems that it is because self.backend is not setup properly in the DoubleBracketIteration class. That would also explain the need for all those self.backend.to_numpy calls inside the class.

@renatomello renatomello added this to the Qibo 0.2.6 milestone Mar 1, 2024
@renatomello renatomello self-assigned this Mar 1, 2024
@alecandido
Copy link
Member

Some tests in tests/test_models_error_mitigation.py fail on GPU only if the tests are ran in sequence. If the tests are ran individually, the tests pass. This is probably an issue with GlobalBackend being set up by a previous test

If you are receiving the global backend from a fixture, as in here:

qibo/tests/conftest.py

Lines 57 to 59 in 31bbbb4

@pytest.fixture
def backend(backend_name):
yield get_backend(backend_name)

you could add some cleanup code after the yield.

@andrea-pasquale
Copy link
Contributor

Some tests in tests/test_models_error_mitigation.py fail on GPU only if the tests are ran in sequence. If the tests are ran individually, the tests pass. This is probably an issue with GlobalBackend being set up by a previous test

I also saw the same behavior some time ago, very weird.

@MatteoRobbiati the majority of DBI tests are failing on GPU. It seems that it is because self.backend is not setup properly in the DoubleBracketIteration class. That would also explain the need for all those self.backend.to_numpy calls inside the class.

You are right, given that we don't tests on GPU with the CI sometimes we forget. I can also have a look if you want @MatteoRobbiati.

@renatomello
Copy link
Contributor Author

It's better to move forward with this PR only after #1202 is merged

@scarrazza scarrazza modified the milestones: Qibo 0.2.6, Qibo 0.2.7 Mar 13, 2024
@renatomello renatomello marked this pull request as ready for review March 16, 2024 05:36
@renatomello
Copy link
Contributor Author

renatomello commented Mar 16, 2024

All tests should be passing on GPUs now. Someone else should test locally too. Thanks @andrea-pasquale for making DBI tests faster and GPU compatible.

@renatomello renatomello added the bug Something isn't working label Mar 18, 2024
@scarrazza scarrazza merged commit 6fe21bb into master May 15, 2024
27 checks passed
@scarrazza scarrazza deleted the cuquantum_tests branch June 25, 2024 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tests on master branch failing for cupy and cuquantum backends
6 participants