3
$\begingroup$

I tried to obtain the gates after fusion in Qiskit-aer statevector simulator. What I can find now is that it provides a backend option saying fusion_verbose (bool): Output gates generated in fusion optimization into metadata [Default: False]. While I set it, I couldn't figure out a way to get the "metadata".

 simulator = aer.StatevectorSimulator(max_parallel_threads=128,fusion_verbose=True)
 result = execute(circuit,simulator).result()
 statevector = result.get_statevector(circuit)
 config = simulator.configuration()
 print(config.to_dict())

That information is not in the configuration. I am wondering how I can get those gates.

Another related question is that if I set the highest optimization level in the qiskit transpile function, do I get the same circuits as I was running it in the statevector simulator?

Thank you in advance.

$\endgroup$

1 Answer 1

1
$\begingroup$

Metadata is accessed through execution result, not simulator configuration.

print(result.results[0].metadata['fusion'])

Note: fusion optimization is enabled only if your circuit contains at least 14 qubits. To lower this value, use fusion_threshold option.

$\endgroup$

Your Answer

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

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