Skip to content

Commit

Permalink
add output to tools/verify_wheels.py
Browse files Browse the repository at this point in the history
  • Loading branch information
hhorii committed Jul 14, 2020
1 parent 32702e3 commit 8952b07
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ jobs:
- mkdir out; cd out; virtualenv aer-test
- aer-test/bin/pip install -c ../constraints.txt git+https://github.com/Qiskit/qiskit-terra
- aer-test/bin/pip install ../dist/*tar.gz
- aer-test/bin/python ../tools/verify_wheels.py
- aer-test/bin/python -u ../tools/verify_wheels.py
- aer-test/bin/pip check
# Linux Standalone
- stage: compile
Expand Down
21 changes: 21 additions & 0 deletions tools/verify_wheels.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,45 +435,66 @@ def model_and_pi_schedule():
if __name__ == '__main__':
# Run qasm simulator
shots = 4000
print ("test grovers_circuit")
print (" generate a circuit")
circuits = grovers_circuit(final_measure=True, allow_sampling=True)
targets = [{'0x0': 5 * shots / 8, '0x1': shots / 8,
'0x2': shots / 8, '0x3': shots / 8}]
simulator = QasmSimulator()
print (" assemble a qobj")
qobj = assemble(transpile(circuits, simulator), simulator, shots=shots)
print (" run simulation")
result = simulator.run(qobj).result()
assert result.status == 'COMPLETED'
print (" compare result")
compare_counts(result, circuits, targets, delta=0.05 * shots)
assert result.success is True
print (" success")

# Run statevector simulator
print ("test cx_gate_circuits_deterministic and statevector")
print (" generate a circuit")
circuits = cx_gate_circuits_deterministic(final_measure=False)
targets = cx_gate_statevector_deterministic()
print (" run simulation")
job = execute(circuits, StatevectorSimulator(), shots=1)
result = job.result()
print (" compare result")
assert result.status == 'COMPLETED'
assert result.success is True
compare_statevector(result, circuits, targets)
print (" success")

# Run unitary simulator
print ("test cx_gate_circuits_deterministic and unitary simulator")
print (" generate a circuit")
circuits = cx_gate_circuits_deterministic(final_measure=False)
targets = cx_gate_unitary_deterministic()
print (" run simulation")
job = execute(circuits, UnitarySimulator(), shots=1,
basis_gates=['u1', 'u2', 'u3', 'cx'])
result = job.result()
print (" compare result")
assert result.status == 'COMPLETED'
assert result.success is True
compare_unitary(result, circuits, targets)
print (" success")

# Run pulse simulator
print ("test pulse simulator")
system_model, schedule = model_and_pi_schedule()
backend_sim = PulseSimulator()
print (" assemble a qobj")
qobj = assemble([schedule],
backend=backend_sim,
qubit_lo_freq=[5.0],
meas_level=1,
meas_return='avg',
shots=1)
print (" run simulation")
results = backend_sim.run(qobj, system_model).result()
state = results.get_statevector(0)
print (" compare result")
assertAlmostEqual(state[0], 0, delta=10**-3)
assertAlmostEqual(state[1], -1j, delta=10**-3)
print (" success")

0 comments on commit 8952b07

Please sign in to comment.