diff options
author | Soumith Chintala <soumith@gmail.com> | 2016-06-04 20:05:12 +0300 |
---|---|---|
committer | Soumith Chintala <soumith@gmail.com> | 2016-06-04 20:05:12 +0300 |
commit | 6bb6be81e43cbc2b682d332f82a33d64543901d7 (patch) | |
tree | 2560061d05c8e588ab5f34cc84562b34f0a76bb4 | |
parent | 251411d95da1d03fe6a8664001a4941a61e7642d (diff) | |
parent | 7baef484bb6a7712be57d3470339f09c00441d4e (diff) |
Merge pull request #65 from lake4790k/master
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'/> |