parfor works on local computer but not on a cluster

1 次查看(过去 30 天)
My code has the following form:
clear all
rng('shuffle')
runtables = importdata('runtable.mat'); % a 40000x22 table of 22 parameters for 40000 different models to run in parallel (embarassingly simple type)
numfiles = numel(runtables(:,1));
runind = 3000:numfiles; % run models 3000:40000
% function importing data that is the same for all models (prevents importing of 500 MB of data thousands of times)
[O,P,normx,normy,normz,refractmat,away_area] = importraddata3Dphaseadhoc(5,mindist_thresh,[1 1 1 1 1],[1 1 1 1 1]);
nummods = numel(runind); % total number of models to run
runtables2 = runtables(runind,:); % table of parameters only for models to run
% BEGIN CYCLING THROUGH MODELS
parfor j=1:nummods
curmodel = runind(j);
% import properties of current case model
param1 = runtables2(j,1); % parameter 1
param2 = runtables2(j,2); % parameter 2
% etc.
% begin numerical analysis for current case model.
parsave(savefilename,Esum,extdisti,extdist,Estp,freq_min,freq_max,radintensity,polys,effk); % function to save case model results to HD
end
My problem is that the code works perfectly fine when run on a local machine with 16 cores. However, having tried to run the code on a cluster, I have been unsuccessful. The problem is that when it gets to the parfor line (parfor j=1:nummods) it returns the error:
Index exceeds matrix dimensions
I have no idea why this occurs. On the other hand, the code runs correctly if I modify the code such that nummods==1.
The following link seems to address a problem like the one I am experiencing:
http://www.mathworks.com/matlabcentral/answers/224150-index-exceeds-matrix-dimensions-error-when-using-parfor
but, I do not understand what to do, and I do not understand why my code works perfectly on a single multi-core machine but fails on a cluster.
Thanks.
  1 个评论
Christopher
Christopher 2015-11-5
OK, it works on the cluster if I change the initial lines to:
clear all
rng('shuffle')
runtables = importdata('runtable9.mat');
[O,P,normx,normy,normz,refractmat,away_area] = importraddata3Dphaseadhoc(5,mindist_thresh,[1 1 1 1 1],[1 1 1 1 1]); %
nummods = numel(runtables(:,1));
parfor j=1:nummods
% etc.
Why does this work and the previous code does not? I need to be able to only run specified case models, not every single one.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Parallel for-Loops (parfor) 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by