フィルターのクリア

Running anonymous functions in parallel avoiding comunication overhead

1 回表示 (過去 30 日間)
Andres Codas
Andres Codas 2014 年 3 月 24 日
回答済み: Walter Roberson 2014 年 3 月 24 日
Hi,
I want to run a set of anonymous function with different input data.
My code strucutre looks like this:
hugeData = loadData();
nJobsW = 10;
obj =Composite();
for w = 1:numel(obj)
objW = cell(nJobsW,1);
for i = 1:nJobsW
funData = importFunData(w,i);
objW{i} = @(x) fun(x,workerData,hugeData);
end
obj{w} = objW;
end
result = Composite();
condition = true;
while condition
spmd
x = getX(result);
result = cell(nJobsW,1);
for i = 1:nJobsW
result{k} = obj{i}(x);
end
end
condition = testCondition(result);
end
So as you can see, there is a large constant data, and data per worker-job. This code is consuming a lot of memory, much more than if executed sequentially.
I suspect that hugedata is being copied many times.
My questions are: If all workers are local (same machine), is hugeData being copied? Can I avoid copying hugeData? How do I check what is consuming memory? How do I minimize the overall data overhead?
Thanks

回答 (1 件)

Walter Roberson
Walter Roberson 2014 年 3 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by