-
Notifications
You must be signed in to change notification settings - Fork 192
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
Strawberryfields with ProcessPoolExecutor #744
Comments
When I instantiated the Engine in the
|
Hey @DS-Liu! Is there a reason why you can't call
I'm not super familiar with Let me know if this helps! |
I want to run the code concurrently instead of a for loop which is quite slow. That's why I use ProcessPoolExecutor. I can't figure out why the Engine instantiated in the main process won't work in the child process. But when instantiated in the child process, it works. |
I had better luck with getting
Unfortunately the speedup isn't that great when I ran it on my machine. Not sure if I'm using it properly, but maybe this will help 😄 |
Actually you haven't use Pool object in your code. It can be used by calling pool.map() function. There's no speedup since you're running it serially. |
Ah! Well, clearly you know more about parallelizing code than me 😅. In any case, if you use |
The number of shots can only be set to 1 for 'fock' backend, as described here. Therefore, to obtain 10000 measurement sampes, I need to run the circuit for 10000 times. I have already defined the parameterized program and the engine as attributes of my class
GBS
. Then I tried to use ProcessPoolExecutor to to run the circuit 10000 times concurrently. However, this error occurs:TypeError: LocalEngine.__new__() missing 1 required positional argument: 'backend
.A MWE is shown as follows:
How can I solve this?
The text was updated successfully, but these errors were encountered: