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

Remove some hard-coded np.linalg calls from tests #501

Merged
merged 3 commits into from
Nov 7, 2021

Conversation

mlazzarin
Copy link
Contributor

In this PR and in qiboteam/qibojit#36 I am trying to fix issue qiboteam/qibojit#34 concerning tests with AMD GPUs.

In particular, there are two tests in Qibo with calls to np.linalg.eigh and np.linalg.eigvalsh.
When these calls are performed with a CuPy object as argument, it seems that somehow there is a automatic call to cp.linalg.eigh or cp.linalg.eigvalsh (I think that this behavior is very confusing).
The problem is that this behavior bypasses the fallback mechanism implemented in qiboteam/qibojit#36 and a rocblas_not_implemented_status error is raised.

The easiest fix is to replace the hard-coded call to NumPy with the backend K in these tests.
However, I wonder if there was a specific reason to use NumPy in these tests, e.g. to compare the results with K.
@scarrazza @stavros11 what do you think?

Copy link
Member

@stavros11 stavros11 left a comment

Choose a reason for hiding this comment

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

Thanks for this update. I do not see any particular reason for using numpy explicitly here, probably using K is a better choice. It may be a "leftover" from before we implemented the backend mechanisms in qibo.

Also, I am not sure if you already looked on this but the same modification should fix #502.

@codecov
Copy link

codecov bot commented Nov 7, 2021

Codecov Report

Merging #501 (2dba502) into rmbackends (f5f0e9f) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           rmbackends     #501   +/-   ##
===========================================
  Coverage       99.99%   99.99%           
===========================================
  Files              84       84           
  Lines           11853    11853           
===========================================
  Hits            11852    11852           
  Misses              1        1           
Flag Coverage Δ
unittests 99.99% <100.00%> (ø)

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

Impacted Files Coverage Δ
src/qibo/tests/test_core_callbacks.py 100.00% <100.00%> (ø)
src/qibo/tests/test_core_hamiltonians.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f5f0e9f...2dba502. Read the comment docs.

@mlazzarin mlazzarin changed the base branch from rmbackends to master November 7, 2021 18:45
@mlazzarin mlazzarin changed the base branch from master to multiqubit November 7, 2021 18:46
@scarrazza scarrazza merged commit fdebfdc into multiqubit Nov 7, 2021
@scarrazza scarrazza deleted the fixrocmtests branch November 7, 2021 22:15
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