parfor error after compiled

3 views (last 30 days)
Qiang
Qiang on 24 Oct 2011
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

Accepted Answer

Jason Ross
Jason Ross on 24 Oct 2011
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 Comments
Qiang
Qiang on 24 Oct 2011
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 on 24 Oct 2011
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

Sign in to comment.

More Answers (3)

James
James on 24 Jan 2012
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 on 24 Jan 2012
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 on 25 Jan 2012
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.

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!