Code examples ============= Example 1: Submit a program (Hello World!) ------------------------------------------- The example code is intended to guide you, step by step, through the entire task submission and retrieval process supported by the Client. The example demonstrates the submission of a OPENQASM2.0 program, but programs of other supported languages follow the the same process. .. code-block:: python from qcaas_client.client import OQCClient, QPUTask, TaskStatus from qcaas_client.compiler_config import CompilerConfig, QuantumResultsFormat, Tket, TketOptimizations url = authentication_token = qpu_id= # Set up the client client = OQCClient(url=url, authentication_token=authentication_token) # Setup a quantum program. In this case we are using a Hello World circuit written in the QASM2.0 language. hello_world = """ OPENQASM 2.0; include "qelib1.inc"; qreg q[2]; creg c[2]; h q; cx q[0], q[1]; measure q->c; """ # Set compiler configuration options (if desired, default settings will be used if no user input provided) shot_count = 1000 res_format = QuantumResultsFormat().binary_count() optimisations = Tket() optimisations.tket_optimizations = TketOptimizations.Two config = CompilerConfig(repeats=shot_count, results_format=res_format, optimizations=optimisations) # We can construct a QPU task object task = QPUTask(program=hello_world, config=config) # Schedule the task on the QPU task_id = client.schedule_tasks(task,qpu_id=qpu_id)[0].task_id task_status = client.get_task_status(task_id,qpu_id=qpu_id) if task_status == TaskStatus.COMPLETED.value: schedule_result = client.get_task_results(task_id,qpu_id=qpu_id) print(schedule_result.result)