qsimcirq.QSimOptions

Container for options to the QSimSimulator.

Options for the simulator can also be provided as a {string: value} dict, using the format shown in the 'as_dict' function for this class.

max_fused_gate_size maximum number of qubits allowed per fused gate. Circuits of less than 22 qubits usually perform best with this set to 2 or 3, while larger circuits (with >= 22 qubits) typically perform better with it set to 3 or 4.
cpu_threads number of threads to use when running on CPU. For best performance, this should equal the number of cores on the device.
ev_noisy_repetitions number of repetitions used for estimating expectation values of a noisy circuit. Does not affect other simulation modes.
use_gpu whether to use GPU instead of CPU for simulation. The "gpu_" arguments below are only considered if this is set to True.
gpu_mode use CUDA if set to 0 (default value) or use the NVIDIA cuStateVec library if set to any other value. The "gpu_" arguments below are only considered if this is set to 0.
gpu_state_threads number of threads per CUDA block to use for the GPU StateSpace. This must be a power of 2 in the range [32, 1024].
gpu_data_blocks number of data blocks to use for the GPU StateSpace. Below 16 data blocks, performance is noticeably reduced.
verbosity Logging verbosity.
denormals_are_zeros if true, set flush-to-zero and denormals-are-zeros MXCSR control flags. This prevents rare cases of performance slowdown potentially at the cost of a tiny precision loss.

max_fused_gate_size Dataclass field
cpu_threads Dataclass field
ev_noisy_repetitions Dataclass field
use_gpu Dataclass field
gpu_mode Dataclass field
gpu_state_threads Dataclass field
gpu_data_blocks Dataclass field
verbosity Dataclass field
denormals_are_zeros Dataclass field

Methods

as_dict

View source

Generates an options dict from this object.

Options to QSimSimulator can also be provided in this format directly.

__eq__

Return self==value.

cpu_threads 1
denormals_are_zeros False
ev_noisy_repetitions 1
gpu_data_blocks 16
gpu_mode 0
gpu_state_threads 512
max_fused_gate_size 2
use_gpu False
verbosity 0