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

evaluate_subcircuits issue after the 1st march 2024 update #501

Closed
sayali1711 opened this issue Mar 12, 2024 · 8 comments · Fixed by #504
Closed

evaluate_subcircuits issue after the 1st march 2024 update #501

sayali1711 opened this issue Mar 12, 2024 · 8 comments · Fixed by #504
Assignees
Labels
cutqc Related to the wire cutting code based on the CutQC paper, arXiv:2012.02333

Comments

@sayali1711
Copy link

sayali1711 commented Mar 12, 2024

Issue/Error:-

Sample code snippet:-

#qc is any circuit
cuts = cut_circuit_wires(
        circuit=qc, method="manual", subcircuit_vertices=list(...)
    )

--------------error is raised in below line------------------------

_subcircuit_instance_probabilities = evaluate_subcircuits(cuts, **kwargs)_
reconstructed_probabilities = reconstruct_full_distribution( qc, subcircuit_instance_probabilities, cuts, num_threads=1 )

(backend used is any real ibm hardware , and rest parameters are passed from the code)

After Cutting the circuit when we pass the subcircuits and its complete path map generated i.e(cuts) by cut_circuit_wires function ,
evaluate_subcircuits is throwing an error shown below

image

Reason for the Error:-

Update to Qiskit Runtime Primitives | IBM Quantum Platform
As of 1 March 2024, circuits and observables need to be transformed to only use instructions supported by the system (referred to as instruction set architecture (ISA) circuits and observables) before being submitted to the Qiskit Runtime primitives.

Update Requested:-

Hence in evaluate_subcircuts function provided by cutting knitting toolbox , updates need to be done so that while running the circuits inside that function it won't throw the above error.

@garrison garrison added the cutqc Related to the wire cutting code based on the CutQC paper, arXiv:2012.02333 label Mar 12, 2024
@garrison
Copy link
Member

Thank you for the report. I do think this is worth fixing even though cutqc is the legacy interface (#494).

@garrison garrison self-assigned this Mar 15, 2024
garrison added a commit that referenced this issue Mar 15, 2024
Fixes #501.

I've also replaced `service_args`, which appears nowhere else in
the repository, with `service`.
@garrison
Copy link
Member

I opened #504 but am currently unsure how to fix the ValueError I am now seeing.

@sayali1711
Copy link
Author

I opened #504 but am currently unsure how to fix the ValueError I am now seeing.

Along with the above errror, Even I was facing value error issue for large circuits as numpy array's dimension is exceeding while calculating probability.

garrison added a commit that referenced this issue Mar 29, 2024
Fixes #501.

I've also replaced `service_args`, which appears nowhere else in
the repository, with `service`.
@sayali1711
Copy link
Author

I am still facing with the same issue even after the update:-

It gives the following error :-

line 92, in validate_isa_circuits
raise IBMInputValueError(
qiskit_ibm_runtime.exceptions.IBMInputValueError: 'The instruction h on qubits (5,) is not supported by the target system. Circuits that do not match the target hardware definition are no longer supported after March 4, 2024. See the transpilation documentation (https://docs.quantum.ibm.com/transpile) for instructions to transform circuits and the primitive examples (https://docs.quantum.ibm.com/run/primitives-examples) to see this coupled with operator transformations.'

@garrison
Copy link
Member

I am still facing with the same issue even after the update:-

Could you provide a full code snippet, with any explicit circuit that triggers that error? Are you using the main version of ckt? (The PR that supposedly fixed this has not made it to a release yet.)

@sayali1711
Copy link
Author

I am still facing with the same issue even after the update:-

Could you provide a full code snippet, with any explicit circuit that triggers that error? Are you using the main version of ckt? (The PR that supposedly fixed this has not made it to a release yet.)

Thankyou for the clarification , I believed that release has been made but I will definitely wait for the release too,
The code used is:-

from circuit_knitting.cutting.cutqc import verify,cut_circuit_wires,evaluate_subcircuits,reconstruct_full_distribution
#circuit_knitting version is 0.6.0

qc=QuantumCircuit.from_qasm_file('MQTBench_2023-12-18-09-22-43/ghz_indep_qiskit_9.qasm')
cuts = cut_circuit_wires(circuit=qc, method="manual", subcircuit_vertices=list(...))
subcircuit_instance_probabilities = evaluate_subcircuits(circuit_cut, **kwargs)
reconstructed_probabilities = `reconstruct_full_distribution(` circuit = qc, subcircuit_instance_probabilities =subcircuit_instance_probabilities, cuts = circuit_cut, num_threads=10 )

Can you please confirm if this issue will be solved after the release of circuit knitting toolbox or update will be expected in validate_isa_circuits function present in another file/library (as per the above error).

@garrison
Copy link
Member

garrison commented Apr 2, 2024

Can you please confirm if this issue will be solved after the release of circuit knitting toolbox or update will be expected in validate_isa_circuits function present in another file/library (as per the above error).

I don't think I have access to the qasm file that would allow me to test this code, but if you want to install the current development version of CKT and test for yourself, you can run pip install git+https://github.com/Qiskit-Extensions/circuit-knitting-toolbox.git.

@sayali1711
Copy link
Author

Can you please confirm if this issue will be solved after the release of circuit knitting toolbox or update will be expected in validate_isa_circuits function present in another file/library (as per the above error).

I don't think I have access to the qasm file that would allow me to test this code, but if you want to install the current development version of CKT and test for yourself, you can run pip install git+https://github.com/Qiskit-Extensions/circuit-knitting-toolbox.git.

Thanks I will try updating the library.
Also to test the circuit you can download the above qasm circuit from https://www.cda.cit.tum.de/mqtbench/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cutqc Related to the wire cutting code based on the CutQC paper, arXiv:2012.02333
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants