1
$\begingroup$

I want to measure the time spent for simulation of different algorithms to make some assumption about their efficiency.

I use Microsoft Azure Quantum SDK and VS Code setup.

$\endgroup$

1 Answer 1

1
$\begingroup$

You can get the time spent in simulation (or resource estimation) from a Python wrapper for the Q# code. You'll need to create either a Jupyter Notebook with both Q# and Python code or a Python host for Q# code, and wrap the call to qsharp.eval or qsharp.run (or qsharp.estimate) in Python time-handling routines:

from datetime import datetime

start_time = datetime.now()
qsharp.eval("YourEntryPoint()")
end_time = datetime.now()
print(f"Simulation time: {end_time - start_time}")

I don't think there's a way to get simulation time when running Q#-only file in VS Code using "Run Q# file" command. (That could be an interesting improvement suggestion to file at https://github.com/microsoft/qsharp/issues)

$\endgroup$

Your Answer

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

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