diff options
author | lake4790k <lake4790k@users.noreply.github.com> | 2016-05-27 17:39:03 +0300 |
---|---|---|
committer | lake4790k <lake4790k@users.noreply.github.com> | 2016-05-27 17:39:03 +0300 |
commit | 7baef484bb6a7712be57d3470339f09c00441d4e (patch) | |
tree | 2560061d05c8e588ab5f34cc84562b34f0a76bb4 | |
parent | 18e0c0698526d7f9400e44a35374e0d227e07414 (diff) |
document how to share lua objects
-rw-r--r-- | README.md | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -180,11 +180,12 @@ Upon receipt of the results, an optional `endcallback` is executed on the main t There are no guarantee that all jobs are executed until [Threads:synchronize()](#threads.synchronize) is called. Each thread has its own -[lua_State](http://www.lua.org/manual/5.1/manual.html#lua_State). Note that -with that kind approach, there is no way to share Lua objects between -threads. However, we provide a [serialization](#threads.serialization) +[lua_State](http://www.lua.org/manual/5.1/manual.html#lua_State). However, we provide a [serialization](#threads.serialization) scheme which allows automatic sharing for several Torch objects (storages, -tensors and tds.hash). +tensors and tds types). Sharing of vanilla lua objects is not possible, but instances of classes that support serialization +(eg. [classic objects](https://github.com/deepmind/classic) with using `require 'classic.torch'` or those created with `torch.class`) +can be shared, but remember that only the memory in tensor storages and tds objects will be shared by the instances, other fields will be copies. +Also if synchronization is required that must be implemented by the user (ie. with `mutex`). <a name='threads.Threads'/> |