Commit ea272bcb authored by Nguyen, Thien Minh's avatar Nguyen, Thien Minh
Browse files

Adding Qiskit import example to the qcor demo



Signed-off-by: default avatarThien Nguyen <nguyentm@ornl.gov>
parent b7218214
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -20,9 +20,9 @@

- Execution: state-vector (`qpp`); noisy (`aer`); IBM; IonQ. Show QObj (IBMQ portal) to demonstate native gate set mapping (e.g. H -> rz and sx decomposition)

- Advance: increase number of qubits (~50) => MPS simulation (TNQVM); choose IBM pulse-mode (submitting pulses to IBM)
- Choose IBM pulse-mode (submitting pulses to IBM)

- Python binding: equivalent kernel expressed in Python (qjit)
- Python binding: `ghz.py` - QCOR IR from Qiskit

- IonQ: Create `.ionq_config` with 

+5 −0
Original line number Diff line number Diff line
/// QCOR IR compile and execution on backends:
/// "Write once run all"

/// Simulator
/// $qcor -qpu qpp ghz.cpp 

@@ -14,6 +17,8 @@
/// QPU (11 qubits)
/// qcor -qpu ionq:qpu ghz.cpp


/// Entangled state preparation:
__qpu__ void ghz(qreg q) {
  H(q[0]);

+25 −0
Original line number Diff line number Diff line
# Demonstate the ability to interop with other quantum programming framework/IR
# "Run all that is written"

from qcor import qjit, qalloc

# Import from Qiskit qiskit_circuit
import qiskit

# Generate 3-qubit GHZ state with Qiskit
qiskit_circ = qiskit.QuantumCircuit(3)
qiskit_circ.h(0)
qiskit_circ.cx(0, 1)
qiskit_circ.cx(1, 2)
qiskit_circ.measure_all()

# Convert Qiskit circuit to QCOR IR
qcor_kernel = qjit(qiskit_circ)

# Allocate the qreg
q = qalloc(3)

# Examine the QCOR IR:
print('QCOR IR:')
qcor_kernel.print_kernel(q)