This package allows you to execute circuits on a quantum computer from the Julia programming language using the Qiskit IBM Runtime service. It builds on Qiskit.jl and provides a lightweight Julia wrapper of the qiskit-ibm-runtime-c client.
Note
This package was formerly known as QiskitIBMRuntimeC.jl.
The following example constructs a circuit that generates a Bell state. It transpiles and submits that circuit to the least busy quantum backend. When the job is done, it displays the results.
using Qiskit
using QiskitIBMRuntime
function generate_bell_circuit()
qc = QuantumCircuit(2, 2) # 2 qubits, 2 clbits
qc.h(1)
qc.cx(1, 2)
qc.measure(1, 1)
qc.measure(2, 2)
qc
end
service = Service()
search_results = backend_search(service)
backend = least_busy(search_results)
@show backend.name
target = target_from_backend(backend, service)
qc = generate_bell_circuit()
transpiled_circuit, layout = transpile(qc, target)
@show transpiled_circuit.num_instructions
shots = 1024
job = run_sampler_job(service, backend, transpiled_circuit, shots)
samples = get_job_results(job, service)
@show samplesWhen run with the appropriate credentials to access quantum hardware, the above code may generate output similar to the following:
backend.name = "ibm_fez"
transpiled_circuit.num_instructions = 10
samples = ["0x0", "0x0", "0x0", "0x3", "0x0", "0x3", "0x0", "0x3", "0x0", "0x0", "0x3", "0x0", "0x0", "0x3", "0x3", "0x3", "0x0", "0x0", "0x3", "0x0", "0x0", "0x3", "0x0", "0x0", "0x3", "0x3", "0x3", ...]
The official install instructions are at https://julialang.org/install/.
If you are a Rust user, you may choose to obtain juliaup via cargo.
cargo install juliaup
juliaup add releaseType ] add QiskitIBMRuntime in the Julia REPL, or run the following command:
julia -e 'using Pkg; pkg"add QiskitIBMRuntime"'Type ] dev QiskitIBMRuntime in the Julia REPL, or run the following command:
julia -e 'using Pkg; pkg"dev QiskitIBMRuntime"'Afterward, the repository will be cloned to ~/.julia/dev/QiskitIBMRuntime.
Type ] test QiskitIBMRuntime in the Julia REPL, or run the following command:
julia -e 'using Pkg; Pkg.test("QiskitIBMRuntime")'Documentation is available at https://qiskit.github.io/QiskitIBMRuntime.jl.
Apache License 2.0