Skip to main content

A Python SDK for interacting with Guoji Quantum and Electronic Computing Service Platform.

Project description

GuojiQE-SDK

GuojiQE-SDK is a Python SDK for interacting with the Guoji Quantum and Electronic Computing Service Platform.

This SDK supports submitting and executing Qiskit circuit code on Guoji Quantum's superconducting quantum computers and simulators.

Installation

You can install GuojiQE-SDK using pip:

pip install guojiqe-sdk

Usage

Step 1: Create a service instance

from guojiqe_sdk.runtime_service import GjqRuntimeService
service = GjqRuntimeService(channel="CPU_FULL_AMPLITUDE_SIMULATOR")

channel: Selects the specified type of quantum device, including simulators and quantum computers.

  • "CPU_FULL_AMPLITUDE_SIMULATOR",
  • "CPU_NOISY_SIMULATOR",
  • "CPU_SINGLE_AMPLITUDE_SIMULATOR",
  • "CPU_PARTIAL_AMPLITUDE_SIMULATOR",
  • "GPU_FULL_AMPLITUDE_SIMULATOR",
  • "GPU_NOISY_SIMULATOR",
  • "GPU_SINGLE_AMPLITUDE_SIMULATOR",
  • "GPU_PARTIAL_AMPLITUDE_SIMULATOR",
  • "NPU_FULL_AMPLITUDE_SIMULATOR",
  • "NPU_NOISY_SIMULATOR",
  • "NPU_SINGLE_AMPLITUDE_SIMULATOR",
  • "NPU_PARTIAL_AMPLITUDE_SIMULATOR",
  • "SUPERCONDUCTING_QUANTUM_COMPUTER"

Step 2: Get the backend

Method 1: Automatically select the least busy backend

backend = service.least_busy()

Method 2: Provide the user with a list of available backends of a specified type, allowing the user to select a backend by viewing this information.

2.1 Viewing a list of available backends of a specified type

backends = service.backends()
for backend in backends:
    print("Name:", backend.name, "Number of qubits:", backend.num_qubits, "Device ID:", backend.device_id)

2.2 Selecting a backend with a specified device_id based on the output

backend = service.backend("tgq-super-0001")

Step 3: Create a circuit

Create a circuit using Qiskit

from qiskit import QuantumCircuit
circuit = QuantumCircuit(2)
circuit.x(range(2))
circuit.cz(0, 1)
circuit.measure_all()

Step 4: Run the circuit on the backend

Submit the circuit using run() in the backend, and get the calculation results in Qiskit Result format using result() in the job

job = backend.run(circuit)
result = job.result().results[0].data.to_dict()
print("Backend run result:", result)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

guojiqe_sdk-0.0.2.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

guojiqe_sdk-0.0.2-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file guojiqe_sdk-0.0.2.tar.gz.

File metadata

  • Download URL: guojiqe_sdk-0.0.2.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for guojiqe_sdk-0.0.2.tar.gz
Algorithm Hash digest
SHA256 48f0e350b5984dc18b51e3a495125078952cf0145376728cebbf8803c5f8d85c
MD5 4aef13ab98815ca7d543fba35dccd64d
BLAKE2b-256 04cdf0a451f6416bb2fe26dadf0400477b4b12f3155536970c43973de46f7532

See more details on using hashes here.

File details

Details for the file guojiqe_sdk-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: guojiqe_sdk-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for guojiqe_sdk-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 07b54eb78faf75cac2565f73b257df1b4f3f2fc837d09a8cb47df5c27147e1c5
MD5 ac2ea12dda806524fbf8c0c770a30f74
BLAKE2b-256 9ea86568ef58565ea4421c4fb0fac6e43ee3ad9b92708d8af48542f1b1b52970

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page