Sharing Large Memory Variable in a parfor

2 views (last 30 days)
Christopher
Christopher on 18 Jan 2016
I have a code which uses a very large variable of size [3 10 61 50 50 50 60], which is about 55 Gb. The form of the code is roughly like the following:
numthreads = 8;
numvals = 10^6;
load('dat.mat') % loads the big matrix "data"
for i=1:numthreads
vals{i} = zeros(numvals,1);
end
parfor i=1:numthreads
for j=1:numvals
a = randi(3);
b = randi(10);
c = randi(61);
d = randi(50);
e = randi(50);
f = randi(50);
g = randi(60);
refind = sub2ind([3 10 61 50 50 50 60],a,b,c,d,e,f,g);
vals{i}(j) = data(refind);
end
end
Unfortunately, because the matrix 'data is 55 Gb and i only have 64 Gb, I cannot run the above code.
Is there a way I can get around this? Is it possible, for example, to access the matrix directly from the hard drive? If so, perhaps I can load it on a RAM Disk and get fast access as well.
Thanks.

Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!