# In Cirq, how do I separate transpilation from execution in simulator.simulate()?

In Qiskit, there are explicit transpile [1] (where a circuit is transpiled to primitive gates) and backend.run [2] (where the circuit is executed in either statevector simulation or real hardware) steps. I wonder what would be the equivalent in Cirq. In Cirq, you only have 1 API of simulator.simulate() [3].

Note: I am executing my circuit multiple times under various parameters in a hybrid quantum-classical feedback loop algorithm. And so, using sweep is not possible.

• Welcome to QCSE! Some feedback on your question: Ideally, the post would explain what transpile and backend.rundo in order to make the question self-contained. At minimum it should provide links, though these are discouraged since they can become dead reducing the future value of the post. As it stands, the post shifts the burden of figuring out what it is you're trying to do in cirq on the readers which further reduces its future value and your current chances of getting an answer. Aug 9 at 3:39
• Thank you for the feedback. I have added permalinks to the functions, and added elaboration for what they did.
– pcr
Aug 9 at 7:32

• Thank you for the answer. Looks like there are several in the Cirq repo: cz_gateset.py, sqrt_iswap_gateset.py, sycamore_gateset.py, ionq_gateset.py, and pasqal_gateset.py. I tried cirq.optimize_for_target_gateset(circuit, gateset=ionq_gateset.IonQTargetGateset()), and this step alone is >45x slower than doing simulator.simulate() on the original circuit.