Why does the standalone matlab (executable) code including the parallel computing feature do not work?

The (compiled) standalone matlab code (.exe) with the parallel computing/multi-core processing feature do not work even though the matlab script (.m) perfectly executes the task.
Is this the Matlab R2011b software limitation? Is there any solution to this problem?

 採用された回答

OCDER
OCDER 2018 年 7 月 30 日
編集済み: OCDER 2018 年 7 月 31 日
NEW ANSWER:
Turn your script into a function. This is the same issue seen here for Matlab 2011 version:
OLD ANSWER:
Seems like it's a known issue and thus you must use a workaround
gcp('nocreate')
Original Q&A here:

2 件のコメント

By any chance, are you compiling without java virtual machine? I get a similar message, "MATLAB: undefinedVarOrClass", if I try to compile something like this:
%main.m
gcp('nocreate')
parpool(4)
%compiler command
mcc -m main.m -R -nojvm
%running main.exe
Undefined variable "com" or class "com.mathworks.toolbox.distcomp.pmode.SessionInfo.NULL_SESSION_INFO".
Error in parpool (line 82)
Error in main (line 2)
MATLAB:undefinedVarOrClass
OCDER
OCDER 2018 年 7 月 31 日
Turn your script into a function. Someone had the exact issue and resolved it by doing that.

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

その他の回答 (2 件)

Woo-Jae Cheong
Woo-Jae Cheong 2018 年 7 月 31 日
編集済み: Walter Roberson 2018 年 7 月 31 日
Yes. It is a known problem. However, Matlab R2011b version does not seem to recognize the function - gcp('nocreate'). Also, the second walkaround "%#function gcp" is just recognized as a comment in the script, and compiling with the pragma code at the top of the Matlab code does not make any difference. Here is the error message shown in the command prompt after running the executable code:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Starting matlabpool using the 'local' configuration ... connected to 4 labs.
The class "distcomp.remoteparfor" is undefined.
Perhaps Java is not running.
Error in parallel_function <line 430>
Error in 'myfilename' <line 76>
MATLAB: subscripting:undefinedClass
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
In my opinion, it is the software version R2011b limitation. Do you agree?
Thank you in advance.
Woo-Jae Cheong
Woo-Jae Cheong 2018 年 7 月 31 日
No. I am compiling with the Java® Virtual Machine (JVM™) that is enabled by default (unless specified).

5 件のコメント

OCDER
OCDER 2018 年 7 月 31 日
Hi Woo-Jae, these "ANSWER" section you're posting to should be reserved for actual answers and not comments. Use the "Comments" section to respond instead.
Thank you for letting me know. I will utilize the "Comments" section for my response to the suggestion.
OCDER
OCDER 2018 年 7 月 31 日
I edited the answer above. Did it work?
Yes. It worked very nicely. Thank you very much for your help.
OCDER
OCDER 2018 年 7 月 31 日
You're welcome!

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

カテゴリ

ヘルプ センター および File ExchangeMATLAB Compiler SDK についてさらに検索

製品

質問済み:

2018 年 7 月 30 日

編集済み:

2018 年 7 月 31 日

Community Treasure Hunt

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

Start Hunting!

Translated by