qibojit icon indicating copy to clipboard operation
qibojit copied to clipboard

Allowing circuit execution using `float32` and `float64` dtypes

Open renatomello opened this issue 1 year ago • 3 comments

Paired with https://github.com/qiboteam/qibo/pull/1625

renatomello avatar Apr 04 '25 10:04 renatomello

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (ab07e2f) to head (714b283). Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #219   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         7           
  Lines          604       603    -1     
=========================================
- Hits           604       603    -1     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Apr 04 '25 11:04 codecov[bot]

This is fine to sync with the breaking changes due to the rename of set_precision. However, it is not sufficient to enable float32/float64 simulation in qibojit. For the latter, we may just need to register the custom operators for additional types.

For CPU (numba), this should be possible by adding the new types in the njit calls:

https://github.com/qiboteam/qibojit/blob/e3e50854e17593278a9906fc970455a36a2daa46/src/qibojit/custom_operators/gates.py#L15-L19

For GPU, we probably need to modify

https://github.com/qiboteam/qibojit/blob/e3e50854e17593278a9906fc970455a36a2daa46/src/qibojit/backends/gpu.py#L77

and other related lines.

We could try this here, but maybe it is better to do in a different PR.

I added the numba types, but I'm not sure how to don the CUDA ones and would need some help here.

renatomello avatar Apr 20 '25 09:04 renatomello

I added the numba types, but I'm not sure how to don the CUDA ones and would need some help here.

looking at the cupy kernels

https://github.com/qiboteam/qibojit/blob/227006557d90e4bc13c8af3665cbbd6e14314c5e/src/qibojit/custom_operators/raw_kernels.py#L24

it seems they use template types T& thus, in principle, no further modification should be needed. To double check, we should probably trigger GPU tests once again in the qibo PR, and if the new dtype test you added passes then we don't need any further modification I believe.

BrunoLiegiBastonLiegi avatar Apr 23 '25 14:04 BrunoLiegiBastonLiegi

@BrunoLiegiBastonLiegi can you review this one too?

renatomello avatar Jun 19 '25 03:06 renatomello