clab / clab/dynet

Are RNNs thread-safe?

Open
#1,335 1 comment 0 reactions 0 assignees View on GitHub
minor bug
Dominant language
C++
Stars
3.4k
Forks
701
PR merge metrics
No merged PRs in 30d

Description

Hi,

as far as I understand, we are allowed to create one computational graph per thread (or we can use the dynet multi-processing API).

Of course, parameters are shared (but not expressions).
However, the RNN API, using builder.new_graph(cg), does not seems thread-safe (ie. states are shared between threads).

In the example provided:
1. this function is called for each thread https://github.com/clab/dynet/blob/master/examples/multiprocessing/rnnlm.h#L35
2. one expression is created in each thread for each parameter, for example : https://github.com/clab/dynet/blob/master/examples/multiprocessing/rnnlm.h#L39
3. however, the RNN internal expressions are shared https://github.com/clab/dynet/blob/master/examples/multiprocessing/rnnlm.h#L37

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.