I think has a bug when is used with plot(obj,obj2) option and is utilized with 10 o more workers.
I fixed this problem with:
*Change (Line 592 and 593):
newlabels = char(zeros(length(ylabels),6));
newlabels(:,1) = ylabels;
serTex = 'Serial';
carSerTex = length(serTex);
carYLab = size(ylabels,2);
newlabels = char(zeros(length(ylabels),max(carSerTex,carYLab)));
newlabels(:,1:carYLab) = ylabels;
newlabels(1,1:carSerTex) = serTex;
Maybe I'm wrong, but I'll try to explain better. Generally in a parfor loop called several times I have two data types. A constantly changing and one that is fixed over a parfor loop cycle.
a = rand (x2, 1);
b = rand (x2, 1);
for i1 = 1: x1
parfor i2 = 1: x2
a (i2) = fun1 (a (i2), b (i2));
a = fun2 (a, b);
It would be interesting that the sliced variable "b" to be persistent and that the sliced variable "a" the drive automatically by the parfor.
It is now certain that the remaining portion of b stored in each worker corresponds to the part that is sent from "a" to the worker in each call to parfor loop?
That is my question.
Hi Matt J.
Good idea, but I think it is difficult in the parfor loop if it distributed the data in different way in each parfor call. As far as I know, in the parfor isn't defined what information receive each worker.
Works well, thanks!
It does consume a fair bit amount of memory though. Since "random access constant data" seems to be the most common model for many data-intensive applications, it would be great if Matlab somehow supports read-only shared memory across labs in the future.
22 Jan 2014
Worker Object Wrapper
Simplifies managing resources such as large data within PARFOR loops and SPMD blocks
Hi Matt, calling "clear" inside SPMD is not necessary - that's not the problem. Because of the way Composites work, when they go out of scope the workers don't find out immediately, only on the next SPMD block. If you add an SPMD block to your function, that's not sufficient since that happens before the Composites are created during the WorkerObjWrapper deletion.
Next suggestion: try adding the following line
val = ; dtor = ; valdtor = ;
as the last line inside the SPMD block in workerDelete.