Class Profiler

Class Documentation

class Profiler

Public Functions

Profiler(std::string target_circuit, const int n_qubits, const double gate_1q_time_ms = 0.001, const double gate_2q_time_ms = 0.001, const double q_initialisation_time_ms = 30, const double q_readout_time_ms = 10, const double pc_send_to_control_time_ms = 10000, const bool debug = false)

Constructor (from an OpenQASM string)

Parameters:
  • target_circuit

  • n_qubits

  • gate_1q_time_ms

  • gate_2q_time_ms

  • q_initialisation_time_ms

  • q_readout_time_ms

  • pc_send_to_control_time_ms

  • debug

Profiler(std::shared_ptr<xacc::CompositeInstruction> &f, const int n_qubits, const double gate_1q_time_ms = 0.001, const double gate_2q_time_ms = 0.001, const double q_initialisation_time_ms = 30, const double q_readout_time_ms = 10, const double pc_send_to_control_time_ms = 10000, const bool debug = false)

Constructor (from a XACC IR)

Parameters:
  • f

  • n_qubits

  • gate_1q_time_ms

  • gate_2q_time_ms

  • q_initialisation_time_ms

  • q_readout_time_ms

  • pc_send_to_control_time_ms

  • debug

ND get_total_initialisation_maxgate_readout_time_ms(const double simulation_total_time = 0.0, const int shots = 1)

Get the total time (i.e., init + gate + readout) for all qubits.

Parameters:
  • simulation_total_time

  • shots

Returns:

NN get_count_1q_gates_on_q()

Get the count of one-qubit gates for all qubits.

Returns:

NN get_count_2q_gates_on_q()

Get the count of two-qubit gates for all qubits.

Returns:

int get_count_1q_gates_on_q(const int iq)

Get the count of one-qubit gates on a qubit line.

Parameters:

iq

Returns:

int get_count_2q_gates_on_q(const int iq)

Get the count of two-qubit gates on a qubit line Note: a two-qubit gate will be accounted for on both of its qubit operands.

Parameters:

iq

Returns:

int get_largestdepth_q()

Get Id of the qubit having the most number of gates (largest depth)

Returns:

Public Members

const int KEY_TOTAL_TIME = 0

Index key for total time.

const int KEY_INITIALISATION_TIME = 1

Index key for initialisation time.

const int KEY_MAX_DEPTH_GATE_TIME = 2

Index key for total gate time on the qubit having the max gate depth.

const int KEY_READOUT_TIME = 3

Index key for readout time.

const int KEY_SIMULATION_TOTAL_TIME = 4

Index key for circuit simulation time.

const int KEY_PC_SEND_TO_CONTROL_TIME = 5

Index key for communication overhead time.

Protected Attributes

std::shared_ptr<xacc::CompositeInstruction> placed_circuit_

IR representation of the circuit for profiling.

Private Functions

void run()

Run the profiler (automatically called during Profiler construction)

Private Members

std::unordered_map<int, int> count_1q_gates_on_q_

Map from qubit index to single-qubit gates on that qubit wire. Note that the qubit index can be non-contiguous due to placement, e.g., a 2-qubit circuit may happen to use qubit indices 20 and 100 due to placement.

std::unordered_map<int, int> count_2q_gates_on_q_

Map from qubit index to two-qubit gates on that qubit wire.

int largestdepth_q_

Qubit that has the largest gate depth (total of 1 qubit- and 2 qubit-gates).

size_t n_qubits_

Number of qubits in the circuit.

double gate_1q_time_ms_

Single-qubit gate time (in milliseconds)

double gate_2q_time_ms_

Two-qubit gate time (in milliseconds)

double q_initialisation_time_ms_

Circuit initialization time before gate execution (in milliseconds)

double q_readout_time_ms_

Qubit readout/measurement time (in milliseconds)

double pc_send_to_control_time_ms_

Classical communication overhead w.r.t. remote QPU execution (in milliseconds)

bool debug_

Debugging flag.