Downtime between calls to workers in MATLAB

2019-09-01 14:33发布

I am running this code in MATLAB:

for i=1:n
   job1=batch('script1.m');
   ...
   job8=batch('script8.m');
   wait(job1);
   ...
   wait(job8);
   load(job1,'var1');
   ...
   load(job8,'var8');
   delete(job1);
   ...
   delete(job8);
   for j=1:m
      do stuff with var1 thru var8;
   end
end

I am running this code on a quad core processor and judging by the output of the 'j loop' and monitoring the machine's performance it seems that there is a significant amount of downtime 'after the j loop' and before the next call of the 8 workers.

Any ideas how to reduce the gap between these calls or what might be the cause of it? I should mention that the workers need to wait for the outcome of the 'j loop' (this loop is not computationally intensive).

0条回答
登录 后发表回答