Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/clementfarabet/lua---nnx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Farabet <clement.farabet@gmail.com>2011-09-05 08:22:39 +0400
committerClement Farabet <clement.farabet@gmail.com>2011-09-05 08:22:39 +0400
commit69327936c2ce1d4e521dd1d1eec8c5afbe5e0cc3 (patch)
tree1ffff0847d7bb4c4b511d00c61ae51c609ab0f78
parentecd615e257bc819a85eb1d97d9ebac3a6de989f0 (diff)
Protected map-reduce setup.
-rw-r--r--BatchOptimization.lua20
1 files changed, 12 insertions, 8 deletions
diff --git a/BatchOptimization.lua b/BatchOptimization.lua
index ebf2144..9673768 100644
--- a/BatchOptimization.lua
+++ b/BatchOptimization.lua
@@ -305,12 +305,16 @@ function Batch:setup_mapreduce ()
end
]]
- -- (2) startup all workers
- parallel.sfork(self.parallelize)
- parallel.children:exec(worker_code)
-
- -- (3) and send them the module + criterion architecture
- parallel.children:join()
- parallel.children:send(self.module)
- parallel.children:send(self.criterion)
+ local setup = function()
+ -- (2) startup all workers
+ parallel.sfork(self.parallelize)
+ parallel.children:exec(worker_code)
+
+ -- (3) and send them the module + criterion architecture
+ parallel.children:join()
+ parallel.children:send(self.module)
+ parallel.children:send(self.criterion)
+ end
+ local ok,err = pcall(setup)
+ if not ok then print(err) parallel.close() end
end