MATLAB compiler/runtime & multiple processes (Windows x64)

11 次查看(过去 30 天)
I'm using the Optimization Toolbox (fmincon) to prototype a non-linear model fitting algorithm. I need to integrate the solution into a compiled Windows x64 application (image processing & measurement software), and one option is to use the MATLAB compiler to generate a library that can be linked into the application (other option is to port the algorithm to some other optimization library).
The software will perform MANY of these model fits in a batch, and currently uses a multi-threaded design to process measurement tasks in parallel (one processing thread for each CPU core).
I've been told (by tech support) that the MATLAB runtime will serialize calls to fmincon, so running the algorithm on multiple threads will not run in parallel.
My question is: Will the MATLAB runtime run in parallel if it's loaded on separate processes? If so I'm thinking of changing the application to create multiple processes, each of which could load the MATLAB runtime and process model fits in parallel.
NOTE: I've already considered using the Parallel Toolbox. It doesn't really help for this problem.

回答(2 个)

Shaf
Shaf 2011-1-20
The MATLAB runtime will run in parallel if loaded in separate processes. There is a single MATLAB interpreter thread per process. So for separate processes the interpreter threads will work in parallel.

Todd Flanagan
Todd Flanagan 2011-1-20
Calls into a shared library are serialized from the host application. This doesn't always mean there is no parallelism.
The MATLAB Compiler will perform the same as it would in MATLAB. Some functions use multiple cores when used in MATLAB. Those function will still use multiple cores when compiled.
It sounds like you require additional parallelism in your compiled application. If this is true, you may want to consider separate processes. Compiled applications will run in parallel if loaded into different processes.

类别

Help CenterFile Exchange 中查找有关 Get Started with Optimization Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by