parfor errors when file is compiled

1 回表示 (過去 30 日間)
Felipe
Felipe 2011 年 12 月 1 日
I'm trying to deploy an application of the form;
try
if(isdeployed)
matfile = 'local.mat'; % can also use uigetfile to let
setmcruserdata('ParallelConfigurationFile',matfile);
end
if (matlabpool('size') > 0)==1 %cerrar matlabpool si está abierto
matlabpool close
end
matlabpool open 2;
parfor i=1:10
end
matlabpool close;
uiwait(msgbox('Success'))
catch ME
uiwait(msgbox(ME.message))
end
This works fine on Matlab, but when compiled, it successfully loads the workers, but when calling parfor it errors saying "distcomp.remoteparfor is undefined perhaps java is not running" (if I remove the setmcruserdata and directly call matlabpool the result is the same). If I change the "parfor" for a "for" it works fine, but if I don't call matlabpool which should make the program consider parfor as a for, it still gives the same error about parfor.
which states that "Standalone executables and libraries generated from MATLAB Compiler for parallel applications can now launch up to twelve local workers without MATLAB® Distributed Computing Server™. And that is precisely what I want to do, compile this file so that it uses the local scheduler without the need of accessing a cluster. What am I getting wrong here? how can I set the envorinment correctly without using a cluster? This soluction http://www.mathworks.com/support/solutions/en/data/1-96PSJ9/index.html?solution=1-96PSJ9 says that this issue should be solved in version 2011a, but it doesen't work. I'd appreciate your help. Regards.

採用された回答

Kaustubha Govind
Kaustubha Govind 2011 年 12 月 2 日
This type of error occurs if you are attempting to compile a script instead of a function. Try changing your code to:
function myParforTest
try
if(isdeployed)
matfile = 'local.mat'; % can also use uigetfile to let
setmcruserdata('ParallelConfigurationFile',matfile);
end
if (matlabpool('size') > 0)==1 %cerrar matlabpool si está abierto
matlabpool close
end
matlabpool open 2;
parfor i=1:10
end
matlabpool close;
uiwait(msgbox('Success'))
catch ME
uiwait(msgbox(ME.message))
end
end
Also, make sure that the local.mat file is included in the CTF archive (-a option if using mcc).
  1 件のコメント
Felipe
Felipe 2011 年 12 月 2 日
Thank you very much. This solved my problem. I'd have never suspected that compiling a script instead of a function could generate this error.

サインインしてコメントする。

その他の回答 (1 件)

Jim hofmann
Jim hofmann 2012 年 1 月 3 日
That worked for me too, THANKS VERY MUCH. Could the user notes be updated to explicitly mention this? It might save a lot of grief in other users.

カテゴリ

Help Center および File ExchangeParallel Computing Fundamentals についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by