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

QulacsBackend #1272

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open

QulacsBackend #1272

wants to merge 38 commits into from

Conversation

BrunoLiegiBastonLiegi
Copy link
Contributor

This adds qulacs as an optional backend.

Checklist:

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

Copy link

codecov bot commented Mar 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.85%. Comparing base (a61f9f7) to head (bb7417b).
Report is 188 commits behind head on master.

Current head bb7417b differs from pull request most recent head 885c680

Please upload reports for the commit 885c680 to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1272      +/-   ##
==========================================
+ Coverage   99.82%   99.85%   +0.03%     
==========================================
  Files          72       74       +2     
  Lines       10560    10673     +113     
==========================================
+ Hits        10541    10658     +117     
+ Misses         19       15       -4     
Flag Coverage Δ
unittests 99.85% <100.00%> (+0.03%) ⬆️

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.

@BrunoLiegiBastonLiegi BrunoLiegiBastonLiegi marked this pull request as ready for review March 20, 2024 05:33
@BrunoLiegiBastonLiegi
Copy link
Contributor Author

BrunoLiegiBastonLiegi commented Mar 21, 2024

@scarrazza some preliminary results for the qulacs backend, it looks indeed comparable with our `qibojit

1 core

qulacs_vs_numba-1

8 cores

qulacs_vs_numba_8_cores-1

@scarrazza
Copy link
Member

Thanks @BrunoLiegiBastonLiegi, could you please include some GPU curves too?

@BrunoLiegiBastonLiegi
Copy link
Contributor Author

Yes I am trying to install the qulacs-gpu package on the cluster, but it requires a little bit of machinery. The pip install qulacs-gpu doesn't work, thus I am not sure how we could set that as an optional dependency.

Copy link
Member

@scarrazza scarrazza left a comment

Choose a reason for hiding this comment

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

Looks good, however we are missing documentation.

@BrunoLiegiBastonLiegi
Copy link
Contributor Author

I added a small paragraph in the documentation about qulacs, there is not much to say as at this level we are supporting the basic features of qulacs only. What still needs to updated is the scheme in the getting started section that summarizes all the available backends. @MatteoRobbiati can I ask you hand with that?

@MatteoRobbiati MatteoRobbiati self-assigned this May 8, 2024
@MatteoRobbiati
Copy link
Contributor

I just opened a PR in the Xmind-diagrams repo adding Qulacs to diagrams.

@BrunoLiegiBastonLiegi
Copy link
Contributor Author

BrunoLiegiBastonLiegi commented May 21, 2024

Apparently there is some problem with qulacs and python3.12, even though it should be supporting python > 3.7 from what stated in the readme.

Edit: I was able to reproduce the problem locally, it looks like with python3.12 simply giving pip install qulacs doesn't work, as it fails to collect and install cmake and boost for some reason I presume. Manually installing them fixes the problem. qulacs/qulacs#645

@scarrazza
Copy link
Member

@alecandido could you please try to install and run tests from this branch in your mac?

@BrunoLiegiBastonLiegi
Copy link
Contributor Author

I tried on my mac (darwin) with python3.9 and it builds correctly

@scarrazza
Copy link
Member

Did you run with poetry?

@BrunoLiegiBastonLiegi
Copy link
Contributor Author

Yep poetry install --with tests

@alecandido
Copy link
Member

alecandido commented Jun 4, 2024

Sorry for the delay: I'm also able to install with Poetry and run tests. And just one of them is failing.

        log.error(message)
>       raise exception(message)
E       ValueError: Backend qulacs is not available. To check which backends are installed use `qibo.list_available_backends()`.

src/qibo/config.py:46: ValueError
--------------------------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------------------------
[Qibo 0.2.9|ERROR|2024-06-03 15:35:25]: Backend qulacs is not available. To check which backends are installed use `qibo.list_available_backends()`.
---------------------------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------------------------
ERROR    qibo.config:config.py:45 Backend qulacs is not available. To check which backends are installed use `qibo.list_available_backends()`.

I will also have a look to the CI asap.

@BrunoLiegiBastonLiegi
Copy link
Contributor Author

Yeah thanks for spotting this, I forgot to add qulacs to the QIBO_NATIVE_BACKENDS global var. It should be fixed now.

@BrunoLiegiBastonLiegi
Copy link
Contributor Author

By the way, I think the problem with 3.9 is always related to some missing dependecies, namely the c++ boost library. Could it be that the qulacs wheel they distribute for python3.9 is missing it? However, that would be weird, beacuse I remember we did not have problem with 3.9 before.

@alecandido
Copy link
Member

alecandido commented Jun 4, 2024

The problem is a distribution problem: Qulacs is not distributing py3.9 wheels for MacOS ARM
image
https://pypi.org/project/qulacs/0.6.4.1/#files
The asymmetry on their side is causing the asymmetry in our CI (which, only for py3.9 ARM, is attempting to build the wheel).

The missing library should have not been a difference among different Python versions (at least to first order approximation).

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

4 participants