1
$\begingroup$

I have the following code in which I provide an API-key and set ibmq dict.

ibmq = {'token':'',
            'hub':'ibm-q',
            'group':'open',
            'project':'main'}

after setting ibmq, I pass it to the following function

evaluate(circuit_cases=circuit_cases,eval_mode=eval_mode,num_nodes=1,num_threads=4,early_termination=[1],ibmq=ibmq)

after that, I take these values as following

token=ibmq['token'],hub=ibmq['hub'],group=ibmq['group'],project=ibmq['project']

I have question about how to set in qiskit-ibm-runtime

$\endgroup$
2
  • $\begingroup$ Your question is a bit unclear to me. What exactly is your question? What are you trying to do with qiskit-ibm-runtime? $\endgroup$
    – FDGod
    Mar 15 at 5:58
  • $\begingroup$ i want to run the qiskit code with qiskit-ibm-runtime not with IBMQ LOADER AND SAVE ACCOUNT. $\endgroup$ Mar 15 at 18:19

1 Answer 1

2
$\begingroup$

tl;dr: Most of your questions will likely be answered here https://cloud.ibm.com/docs/quantum-computing?topic=quantum-computing-get-started


If you are using IBM Cloud, you will have to first create a Runtime instance, which will have an associated instance-key. Additionally, you will also need your account's token.

Once you have installed Qiskit Runtime with pip install qiskit-ibm-runtime, you need to make use of the QiskitRuntimeService function in the following way

from qiskit_ibm_runtime import QiskitRuntimeService

service = QiskitRuntimeService(channel = "ibm_cloud", token = token, instance = instance-key)

Once you have access to the service, you can send jobs for execution using the Qiskit primitives Sampler and Estimator (see additional info here: https://docs.quantum.ibm.com/api/migration-guides/v2-primitives) in the following way

from qiskit_ibm_runtime import Sampler, Session

with Session(service=service, backend='your_device') as session:
     sampler = Sampler()
     job = sampler.run(your_circuit)
     result = job.result()
     session.close()

There is of course plenty of room for further customisation, which you can find by exploring the link above.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.