parfor error after compiled

조회 수: 3 (최근 30일)
Qiang
Qiang 2011년 10월 24일
I am testing parfor using a simple code as below
--- matlabpool open 2; parfor i = 1:10 display(i); end matlabpool close;
It does not work after compiled and gives the following error. Does anyone have an idea on this? Thanks for your help
--- Starting matlabpool using the 'local' configuration ... connected to 2 labs. ??? The class "distcomp.remoteparfor" is undefined. Perhaps Java is not running.
Error in ==> parallel_function at 430
Error in ==> Untitled at 3
MATLAB:subscripting:undefinedClass

채택된 답변

Jason Ross
Jason Ross 2011년 10월 24일
What is the command line you are using to launch the application?
Can you validate the local configuration successfully (Parallel > Manage Configurations > select local > validate)
If you run the code in MATLAB, does it work?
  댓글 수: 2
Qiang
Qiang 2011년 10월 24일
Jason,
Thank you for answering my question. This code works in Matlab but does not after compiled. I ran the compiled executable in a command-line window like cmd/PowerShell.
I am using a trial version of parallel toolbox. Do you think that could be a problem. Thanks
Qiang
Jason Ross
Jason Ross 2011년 10월 24일
You might want to take a look at the following examples to make sure you have done the right things to set up the environment:
http://www.mathworks.com/help/toolbox/compiler/f12-999353.html#bsm9wmx
http://www.mathworks.com/help/toolbox/compiler/f12-999353.html#bsh5e8h-1

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

James
James 2012년 1월 24일
I'm using 2011a on a winXP machine. I'm trying the exact same thing using the command window (cmd), but am getting the exact same error. Can the OP explain what was changed or exactly how you compile your code to get the executable to run? I've looked over the links and have followed the instructions to the tee, but still no luck.
My local parallel configuration has been validated. When I run the matlab code, it runs fine. But when I compile it and try to run the .exe file, no dice. I don't think I need to create a job manager configuration since I'm only running on local cores.
The problem seems to be when the executable hits the parfor line in the code. I don't know why it has a problem with that.
Been trying for days to get this working and am pulling my hair out. Any help would be great!

James
James 2012년 1월 24일
Here's my code for reference. Compiled.mat is my local parallel configuration saved as a mat file...
clear all
close all
% Set the Parallel Configuration file:
if(isdeployed)
matfile = 'compiled.mat';
setmcruserdata('ParallelConfigurationFile',matfile);
end
matlabpool open
parfor ii = 1:8
disp(ii)
end
matlabpool close

James
James 2012년 1월 25일
I figured it out. Turns out I needed to make my code a function before making it an executable. This got rid of the
Error in ==> parallel_function at 430 error.
Hope this little detail helps someone out.

카테고리

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