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

Apply channel for Clifford circuits with cupy #1404

Merged
merged 1 commit into from
Jul 29, 2024
Merged

Conversation

AlejandroSopena
Copy link
Contributor

@AlejandroSopena AlejandroSopena commented Jul 27, 2024

This PR fixes a TypeError when using noise channels in Clifford circuits and running them with the CliffordBackend on GPU. It can be reproduced with the following code extracted from test_backends_clifford.py:

import numpy as np
from qibo import gates
from qibo.backends import CliffordBackend
from qibo.quantum_info import random_clifford
from qibo.noise import NoiseModel, PauliError

backend = CliffordBackend('cupy')

nqubits = 3

c = random_clifford(nqubits, density_matrix=True, backend=backend)

noise = NoiseModel()
noisy_gates = np.random.choice(c.queue, size=1, replace=False)
noise.add(PauliError([("X", 0.3)]), noisy_gates[0].__class__)

c.add(gates.M(*range(nqubits)))

c = noise.apply(c)

result = backend.execute_circuit(c)

@AlejandroSopena AlejandroSopena added the bug Something isn't working label Jul 27, 2024
@AlejandroSopena AlejandroSopena added this to the Qibo 0.2.10 milestone Jul 27, 2024
@AlejandroSopena AlejandroSopena self-assigned this Jul 27, 2024
Copy link

codecov bot commented Jul 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.99%. Comparing base (d8cc501) to head (3f471a7).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1404   +/-   ##
=======================================
  Coverage   99.99%   99.99%           
=======================================
  Files          78       78           
  Lines       11192    11193    +1     
=======================================
+ Hits        11191    11192    +1     
  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.

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

@renatomello renatomello changed the title Apply channel for Clifford circuits with cupy Apply channel for Clifford circuits with cupy Jul 29, 2024
@renatomello renatomello added this pull request to the merge queue Jul 29, 2024
Merged via the queue into master with commit 256ba0b Jul 29, 2024
30 checks passed
@renatomello renatomello deleted the clifford_noise branch July 29, 2024 10:44
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.

3 participants