Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Too Many Compiler Engines Added to the MainEngine in ProjectQ #481

Open
saifawan2703 opened this issue Nov 7, 2024 · 1 comment

Comments

@saifawan2703
Copy link

saifawan2703 commented Nov 7, 2024

Hi everyone,

I’m encountering an issue when trying to run a quantum circuit using ProjectQ. Specifically, I’m getting the following error:
RuntimeError: Too many compiler engines added to the MainEngine!
The error is raised from this part of the code:
File "/home/qc/anaconda3/lib/python3.12/site-packages/projectq/meta/_util.py", line 32, in insert_engine raise RuntimeError('Too many compiler engines added to the MainEngine!') . Any suggestion or guidance to resolve this error.

@damiansteiger
Copy link
Contributor

Too many compiler engines. The compiler engines are given as a parameter (engine_list) when initialising the MainEngine. Further compiler engines are temporarily added when meta instructions are used. E.g.
with Control will insert a compiler engine to add the control qubits to the gates within the with Control context. Once the context is exited, this additional engine disappears.

By default there are 100 (n_engines_max) compiler engines allowed, see doc MainEngine. One can change this value but nesting of meta instructions typically never reaches 100 unless there is a bug in the user code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants