QHybrid

Defined in qhybrid.hpp.

Qrack::QHybrid switches between QEngineCPU and QEngineOCL as optimal. It may be used as sub-engine type with Qrack::QUnit. It supports the standard Qrack::QInterface API.

The parameter “qubitThreshold” is the number of qubits at which QHybrid will automatically switch to GPU operation. A value of “0” will automatically pick this threshold based on best estimates of efficiency.

Qrack::QHybrid::QHybrid(bitLenInt qBitCount, bitCapInt initState = 0, qrack_rand_gen_ptr rgp = nullptr, complex phaseFac = CMPLX_DEFAULT_ARG, bool doNorm = false, bool randomGlobalPhase = true, bool useHostMem = false, int deviceId = -1, bool useHardwareRNG = true, bool useSparseStateVec = false, real1_f norm_thresh = REAL1_EPSILON, std::vector<int> ignored = {}, bitLenInt qubitThreshold = 0)
virtual void Qrack::QHybrid::SwitchModes(bool useGpu)

Switches between CPU and GPU used modes.

(This will not incur a performance penalty, if the chosen mode matches the current mode.) Mode switching happens automatically when qubit counts change, but Compose() and Decompose() might leave their destination QInterface parameters in the opposite mode.