Problems with Parallel programming (use local cluster, createJob, createTask).

Hello. I'm having some confusion regarding the functions createJob and createTask. I had a similar problem as in the topic http://www.mathworks.com/matlabcentral/answers/62944.
By analogy with the problem in the subject, I tried 2 variants (1 task - a few workers, each working on one job). In both cases, large(!) delay time provides by synchronization (wait). I'm not using matlabpool. I hope for your help.
Part of my code:
c = parcluster;
numlabs = c.NumWorkers;
j = createJob (c);
set (j, 'AttachedFiles', {'initialize.m'});
for i = 1:numlabs
j.createTask (@initialize, 3, {divide (i), nd, box});
end
j.submit
j.wait
The initialization function randomly fills the three arrays (testing was done on small and large size of the array). Inputs: divide (i) - integer, nd - integer, box - array (1x2). Maybe there are some bottlenecks in the use of memory locations, I do not know. But the parallel code runs much longer than the sequential calculations.

Answers (0)

This question is closed.

Asked:

on 27 May 2013

Closed:

on 20 Aug 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!