Skip to content

Qiskit/QiskitIBMRuntime.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stable Dev Qiskit Ecosystem Build Status Coverage PkgEval Aqua

QiskitIBMRuntime.jl

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.

Example

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 samples

When 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", ...]

Installation instructions

Install Julia

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 release

Install QiskitIBMRuntime.jl

Latest stable release

Type ] add QiskitIBMRuntime in the Julia REPL, or run the following command:

julia -e 'using Pkg; pkg"add QiskitIBMRuntime"'

Development version

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.

Run tests

Type ] test QiskitIBMRuntime in the Julia REPL, or run the following command:

julia -e 'using Pkg; Pkg.test("QiskitIBMRuntime")'

Documentation

Documentation is available at https://qiskit.github.io/QiskitIBMRuntime.jl.

License

Apache License 2.0

About

Execute circuits on an IBM quantum computer from Julia, using the Qiskit IBM Runtime service

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors

Languages