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 2018/07/19 00:17:36 UTC
[GitHub] nswamy commented on issue #11751: [MXNET-600][Scala] NDArray
auto-collector
nswamy commented on issue #11751: [MXNET-600][Scala] NDArray auto-collector
URL: https://github.com/apache/incubator-mxnet/pull/11751#issuecomment-406113595
@yzhliu Thanks for elaborating with a detailed example and sorry for the delay in response.
While I understand WithScope is what manages the deallocation of the NDArrays and using it ThreadLocal is what makes managing it possible, nevertheless my concern about thread-safety still remains.
The use-case of producer/consumer is not very uncommon and
```
val q = new Queue[NDArray] //assume Queue is thread-safe
val t1 = new Thread() {
@override def run() ={
withScope {
val a = NDArray.load()
q.enqueue(a)
}
}
val t2 = new Thread() {
@override def run() = {
b = q.dequeue()
b.reshape()
}
}
```
This use-case or similar is not hard imagine when you are creating data pipeline and I think we should cautious in introducing new patterns to users that aren't thread-safe.
We discussed offline about using reference-counts, any luck with that?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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