MATLAB compiler/runtime & multiple processes (Windows x64)

35 views (last 30 days)
Gabriel on 20 Jan 2011
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.

Answers (2)

Shaf on 20 Jan 2011
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 on 20 Jan 2011
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.

Community Treasure Hunt

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

Start Hunting!

Translated by