How to run multiple instances of MCR

조회 수: 14 (최근 30일)
Mickey
Mickey 2012년 10월 16일
I have problem to solve how to run something parallel without using a parallel toolbox. (i'am using C# for my application)
I don't need some fast parallel operations ,i just want to run one simple function while other long process is running, and not to wait while this long process is over.
Mine one tought was to create two separate assemblies, and to call functions in from them..is it that possible and do i need to create separate wrappers for that assemblies, and how can i do that if it is possible!??

채택된 답변

Friedrich
Friedrich 2012년 10월 16일
편집: Friedrich 2012년 10월 16일
Hi,
no that is not possible. The MCR is process "bound" which means only MCR per process is allowed and in addition the MCR makes use of thread locking, so only one thread is allowed to access the MCR at a time.
If you need more MCR's consider .NET remoting:
Basically you set up small "server" processes which run the MCR and to which you talk to. Thats the only way to get more MCR's "into" your C# application.
However in R2012b there is a new toolbox called Matlab Production Server:
This thing is pretty awesome and makes it pretty easy to call compiled functions from different threads. But I guess buying Parallel Computing Toolbox should be cheaper than buying that beauty ;)
  댓글 수: 1
Mickey
Mickey 2012년 10월 16일
Thanks you on fast replay, i think that i will go on with rewritting some of matlab methods to C++ :)

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

추가 답변 (1개)

owr
owr 2012년 10월 16일
I built something in the past as a test that was able to do this - if I recall it wasnt too difficult (and Im not very proficient in C#).
As Friedrich mentioned, the issue is that the MCR is process bound. So you need your C# application to launch/manage multiple processes.
The way I set it up is each MATLAB task had its own C# exe wrapped around it, I called these "worker1", "worker2" etc. Then I had a master C# application that could create processes independently and attach the workers to these processes.
Take a look on MSDN at the "Process" command in C#. Like I mentioned, I am quite inexperienced in C# but was able to get it all working in about a day, some time ago.
Hope this helps.

카테고리

Help CenterFile Exchange에서 Installation에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by