How to run multiple instances of MCR
20 次查看(过去 30 天)
显示 更早的评论
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!??
0 个评论
采纳的回答
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 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Installation 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!