1

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.

Egretta.Thula
  • 9,972
  • 1
  • 11
  • 30
SageCat
  • 125
  • 4

1 Answers1

1

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)

Mariia Mykhailova
  • 9,010
  • 1
  • 12
  • 39