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

Can I use more than one Computational Graph in different threads? #678

Open
liu946 opened this issue Jul 9, 2017 · 3 comments
Open

Can I use more than one Computational Graph in different threads? #678

liu946 opened this issue Jul 9, 2017 · 3 comments

Comments

@liu946
Copy link

liu946 commented Jul 9, 2017

When I run my program with one thread, it works fine and there is always one computation graph at a time. However, I want to run it with multi-threads then I get the "Attempt to create >1 CG" error. Could you please tell me the reason assuming one CG, and if there is any chance to use more CG in different threads. I think it is safe since the model is not changed in my predict program. Thank you very much.

@neubig
Copy link
Contributor

neubig commented Jul 14, 2017

You can use DyNet's multi-processing functionality, which may solve your problem (http://dynet.readthedocs.io/en/latest/multiprocessing.html). Using multiple threads within a single is not supported at the moment. I've heard that there are people interested in this and potentially working on it, so if things go well we might be able to push a thread-safe version.

@dlwh
Copy link

dlwh commented Oct 3, 2017

Hi,

We (Semantic Machines) are interested in making this happen. It seemingly interacts (a bit) with multigpu support, since it involves removing global variables and such.

Anyway, please let me know if you'd like to discuss or if you already have efforts in this direction.

Thanks!

@neubig
Copy link
Contributor

neubig commented Mar 23, 2018

Will be fixed by #1064

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

No branches or pull requests

3 participants