16#define _CRT_SECURE_NO_WARNINGS 1
23#pragma warning(disable : 4789)
24#include "simulators/statevector/qv_avx2.cpp"
32#define INCLUDED_BY_FACTORY
42std::shared_ptr<GpuLibrary> SimulatorsFactory::gpuLibrary =
nullptr;
43std::atomic_bool SimulatorsFactory::firstTime =
true;
47 gpuLibrary = std::make_shared<GpuLibrary>();
48 if (!firstTime.exchange(
false))
49 gpuLibrary->SetMute(
true);
51 if (gpuLibrary->Init(
"libcomposer_gpu_simulators.so"))
60bool SimulatorsFactory::InitGpuLibraryWithMute() {
62 gpuLibrary = std::make_shared<GpuLibrary>();
64 gpuLibrary->SetMute(
true);
66 if (gpuLibrary->Init(
"libcomposer_gpu_simulators.so"))
77std::shared_ptr<ISimulator>
81 auto sim = std::make_shared<Private::QCSimSimulator>();
83 sim->Configure(
"method",
"matrix_product_state");
85 sim->Configure(
"method",
"stabilizer");
87 sim->Configure(
"method",
"tensor_network");
93 auto sim = std::make_shared<Private::AerSimulator>();
95 sim->Configure(
"method",
"matrix_product_state");
97 sim->Configure(
"method",
"stabilizer");
99 sim->Configure(
"method",
"tensor_network");
101 sim->Configure(
"method",
"statevector");
106 return std::make_shared<Private::CompositeSimulator>(
112 case SimulatorType::kGpuSim:
113 if (gpuLibrary && gpuLibrary->IsValid() &&
116 auto sim = std::make_shared<Private::GpuSimulator>();
118 sim->Configure(
"method",
"matrix_product_state");
129 throw std::invalid_argument(
"Simulator Type not supported");
134std::unique_ptr<ISimulator>
138 auto sim = std::make_unique<Private::QCSimSimulator>();
140 sim->Configure(
"method",
"matrix_product_state");
142 sim->Configure(
"method",
"stabilizer");
144 sim->Configure(
"method",
"tensor_network");
150 auto sim = std::make_unique<Private::AerSimulator>();
152 sim->Configure(
"method",
"matrix_product_state");
154 sim->Configure(
"method",
"stabilizer");
156 sim->Configure(
"method",
"tensor_network");
158 sim->Configure(
"method",
"statevector");
163 return std::make_unique<Private::CompositeSimulator>(
169 case SimulatorType::kGpuSim:
170 if (gpuLibrary && gpuLibrary->IsValid() &&
173 auto sim = std::make_unique<Private::GpuSimulator>();
175 sim->Configure(
"method",
"matrix_product_state");
186 throw std::invalid_argument(
"Simulator Type not supported");
static std::shared_ptr< ISimulator > CreateSimulator(SimulatorType t=SimulatorType::kQCSim, SimulationType method=SimulationType::kMatrixProductState)
Create a quantum computing simulator.
static std::unique_ptr< ISimulator > CreateSimulatorUnique(SimulatorType t=SimulatorType::kQCSim, SimulationType method=SimulationType::kMatrixProductState)
Create a quantum computing simulator.
static bool InitGpuLibrary()
SimulationType
The type of simulation.
@ kStatevector
statevector simulation type
@ kMatrixProductState
matrix product state simulation type
@ kStabilizer
Clifford gates simulation type.
@ kTensorNetwork
Tensor network simulation type.
SimulatorType
The type of simulator.
@ kCompositeQCSim
composite qcsim simulator type
@ kQCSim
qcsim simulator type
@ kQiskitAer
qiskit aer simulator type
@ kCompositeQiskitAer
composite qiskit aer simulator type