How can I use multiple MCR computational engines in applications which call functions compiled with MATLAB Compiler?
조회 수: 16 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2013년 8월 7일
편집: MathWorks Support Team
2023년 3월 27일
I have compiled my MATLAB code using one of the following products:
MATLAB Compiler
MATLAB Builder NE
MATLAB Builder EX
MATLAB Builder JA
I have a multithreaded application which is calling my compiled code. I would like to manage how many MCR computational engines are used.
채택된 답변
MathWorks Support Team
2023년 3월 25일
편집: MathWorks Support Team
2023년 3월 27일
A single application only has access to a single MCR computational engine. This is guarded by a process wide lock, so multiple components cannot access the computational engine simultaneously.
The setting for "object instances share MCR" in DEPLOYTOOL or the "Create Singleton MCR" (-S option) of the MCC command does not affect this limitation. These options only control the MATLAB environment, i.e., workspace, in which the code will execute, not whether they share a computational engine.
The only way to work around the limitation of a single computational engine is to create a second process (for example, by running a second instance of your executable). Alternatively, our MATLAB Production Server (MPS) product (
) can help facilitate use of multiple MCR computational engines in this way by providing infrastructure for out of process MCRs (MPS workers).
Consider an application "myApp" which creates instances of classes from multiple .NET Assemblies created by MATLAB Builder NE. All instances of the classes will use the same computational engine. This is similar to calling all the MATLAB files one after the other in the same open session of MATLAB.
However if you run two executions of "myApp" at the same time, each process will have its own MCR computational engine because they are separate processes. This is similar to calling the MATLAB files simultaneously in two distinct sessions of MATLAB.
On a single processor or single core machine, creating a second computational thread in many cases will not realize any performance improvement, as the processing power of the computer is limited by the single processor. On a multi-core/multi-processor machine, however, having only one computational engine is a bottleneck.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB Compiler SDK에 대해 자세히 알아보기
제품
릴리스
아직 릴리스를 입력하지 않았습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!