You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/03/06 19:58:47 UTC
[GitHub] [incubator-mxnet] anirudhacharya commented on issue #12128:
NaiveEngine is not threadsafe and crashes when called from multiple threads.
anirudhacharya commented on issue #12128: NaiveEngine is not threadsafe and crashes when called from multiple threads.
URL: https://github.com/apache/incubator-mxnet/issues/12128#issuecomment-470253776
The following code runs fine when run with `MXNET_ENGINE_TYPE=NaiveEngine`
```python
import threading
import mxnet as mx
def worker(module, input1, input2, lock, outputs):
o1 = mx.nd.broadcast_add(input1, input2)
o2 = mx.nd.broadcast_mul(o1, input1)
o3 = mx.nd.broadcast_mul(input2, o2)
outnd = o2 + o3
outnd.wait_to_read()
with lock:
outputs.append(outnd)
threads = []
outputs = []
lock = threading.Lock()
for i in range(3):
thread = threading.Thread(target=worker, args=(net, mx.random.randn(1, 3, 10), mx.random.randn(1, 3, 10), lock, outputs))
threads.append(thread)
for thread in threads:
thread.start()
for thread in threads:
thread.join()
for i in outputs:
print(i)
```
I think we can close this issue unless the author still has pending concerns.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services