Control Compilation of parfor-Loops
By default, MATLAB®
Coder™ generates code that can run the
parfor-loop on multiple
threads. To treat the
parfor-loops as for-loops that run on a single
parfor with one of these methods:
By using the
-O disable:openmpoption at the command line.
By using a code generation configuration object with the property
EnableOpenMPset to false. For example:
cfg = coder.config('lib'); cfg.EnableOpenMP = false; codegen myFunction -config cfg
By setting Enable OpenMP library if possible to
Nounder All Settings tab in the project settings dialog box.
When to Disable parfor
Disable parfor if you want to:
Compare the execution times of the serial and parallel versions of the generated code.
Investigate failures. If the parallel version of the generated code fails, disable
parforand generate a serial version to facilitate debugging.
Use C compilers that do not support OpenMP.