diff --git a/releasenotes/notes/fix-controller-parallel-shots-d32967c029259790.yaml b/releasenotes/notes/fix-controller-parallel-shots-d32967c029259790.yaml new file mode 100644 index 0000000000..86aefecec7 --- /dev/null +++ b/releasenotes/notes/fix-controller-parallel-shots-d32967c029259790.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Fixed bug with statevector and unitary simulators running a number of (parallel) + shots equal to the number of CPU threads instead of only running a single shot. diff --git a/src/controllers/statevector_controller.hpp b/src/controllers/statevector_controller.hpp index 769a17712e..883194ab0f 100755 --- a/src/controllers/statevector_controller.hpp +++ b/src/controllers/statevector_controller.hpp @@ -137,6 +137,10 @@ void StatevectorController::set_config(const json_t& config) { // Set base controller config Base::Controller::set_config(config); + // Override max parallel shots to be 1 since this should only be used + // for single shot simulations + Base::Controller::max_parallel_shots_ = 1; + // Add custom initial state if (JSON::get_value(initial_state_, "initial_statevector", config)) { // Check initial state is normalized diff --git a/src/controllers/unitary_controller.hpp b/src/controllers/unitary_controller.hpp index 147154d571..eb3cf4dac9 100755 --- a/src/controllers/unitary_controller.hpp +++ b/src/controllers/unitary_controller.hpp @@ -129,6 +129,10 @@ void UnitaryController::set_config(const json_t &config) { // Set base controller config Base::Controller::set_config(config); + // Override max parallel shots to be 1 since this should only be used + // for single shot simulations + Base::Controller::max_parallel_shots_ = 1; + // Add custom initial unitary if (JSON::get_value(initial_unitary_, "initial_unitary", config)) { // Check initial state is unitary