In [ ]:
import os
import sys
cwd = os.getcwd()
qiskit_dir = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(cwd))))
sys.path.append(qiskit_dir)
In [ ]:
from qiskit import BasicAer, execute
from qiskit.circuit import QuantumRegister, ClassicalRegister, QuantumCircuit
from qiskit.compiler import transpile
from qiskit.tools.parallel import parallel_map
from qiskit.tools.monitor import job_monitor
from qiskit.tools.events import TextProgressBar
from qiskit.tools.jupyter import *
In [ ]:
sim_backend = BasicAer.get_backend('qasm_simulator')
In [ ]:
import time
def func(_):
time.sleep(0.1)
return 0
In [ ]:
HTMLProgressBar()
parallel_map(func, list(range(10)));
In [ ]:
%qiskit_progress_bar
parallel_map(func, list(range(10)));
In [ ]:
TextProgressBar()
parallel_map(func, list(range(10)));
In [ ]:
%qiskit_progress_bar -t text
parallel_map(func, list(range(10)));
In [ ]:
q = QuantumRegister(2)
c = ClassicalRegister(2)
qc = QuantumCircuit(q, c)
qc.h(q[0])
qc.cx(q[0], q[1])
qc.measure(q, c)
HTMLProgressBar()
qobj = transpile([qc]*20, backend=sim_backend)
In [ ]:
job_sim2 = execute([qc]*10, backend=sim_backend)
job_monitor(job_sim2)