CS6620-S21 / Asynchronous-quantum-job-submission-framework

0 stars 5 forks source link

IBM API to submit job and retrieve result #18

Closed srihitha97 closed 3 years ago

srihitha97 commented 3 years ago

To pass the circuit to the backend, we must first map it onto the backend, package it, and send to the device. This is all done by using the execute function:

job = execute(circuit, backend)

Alternatively, the circuit can be mapped using the transpile function, package it using assemble, and then send it from the backend instance itself.

Result on running ibm_api.py:


[<AccountProvider for IBMQ(hub='ibm-q', group='open', project='main')>]

The backends are:
[<IBMQSimulator('ibmq_qasm_simulator') from IBMQ(hub='ibm-q', group='open', project='main')>, <IBMQBackend('ibmqx2') from IBMQ(hub='ibm-q', group='open', p
roject='main')>, <IBMQBackend('ibmq_16_melbourne') from IBMQ(hub='ibm-q', group='open', project='main')>, <IBMQBackend('ibmq_armonk') from IBMQ(hub='ibm-q'
, group='open', project='main')>, <IBMQBackend('ibmq_athens') from IBMQ(hub='ibm-q', group='open', project='main')>, <IBMQBackend('ibmq_santiago') from IBM
Q(hub='ibm-q', group='open', project='main')>, <IBMQBackend('ibmq_lima') from IBMQ(hub='ibm-q', group='open', project='main')>, <IBMQBackend('ibmq_belem')
from IBMQ(hub='ibm-q', group='open', project='main')>, <IBMQBackend('ibmq_quito') from IBMQ(hub='ibm-q', group='open', project='main')>, <IBMQSimulator('si
mulator_statevector') from IBMQ(hub='ibm-q', group='open', project='main')>, <IBMQSimulator('simulator_mps') from IBMQ(hub='ibm-q', group='open', project='
main')>, <IBMQSimulator('simulator_extended_stabilizer') from IBMQ(hub='ibm-q', group='open', project='main')>, <IBMQSimulator('simulator_stabilizer') from
 IBMQ(hub='ibm-q', group='open', project='main')>]

Selecting backend ibmq_qasm_simulator...
ibmq_qasm_simulator

Printing the status of the job
JobStatus.VALIDATING

The job ID of the job is:
6053893a4f7d2b415a96bcfb

The job result is:
Result(backend_name='ibmq_qasm_simulator', backend_version='0.7.6', qobj_id='6448e41c-b8eb-482c-a133-a31e77c78ecd', job_id='60538802ec3b4031b4a8029b', succ
ess=True, results=[ExperimentResult(shots=1024, success=True, meas_level=MeasLevel.CLASSIFIED, data=ExperimentResultData(counts={'0x0': 520, '0x3': 504}),
header=QobjExperimentHeader(clbit_labels=[['c', 0], ['c', 1]], creg_sizes=[['c', 2]], global_phase=0.0, memory_slots=2, n_qubits=2, name='circuit7', qreg_s
izes=[['q', 2]], qubit_labels=[['q', 0], ['q', 1]]), status=DONE, metadata={'fusion': {'enabled': False}, 'measure_sampling': True, 'method': 'stabilizer',
 'parallel_shots': 1, 'parallel_state_update': 16}, seed_simulator=166211994, time_taken=0.0015332310000000001)], date=2021-03-18 13:04:05.721994-04:00, st
atus=COMPLETED, status=QobjHeader(backend_name='ibmq_qasm_simulator', backend_version='0.1.547'), metadata={'max_memory_mb': 515872, 'omp_enabled': True, '
parallel_experiments': 1, 'time_taken': 0.0015976150000000001}, time_taken=0.0015976150000000001, client_version={'qiskit': '0.23.5'})
{'00': 520, '11': 504}
saisankargochhayat commented 3 years ago

@srihitha97 if you are planning to move the get result part into a diff file we can merge this after that?

srihitha97 commented 3 years ago

@srihitha97 if you are planning to move the get result part into a diff file we can merge this after that?

Yes, will make the above 2 changes and request for review again.