Search code examples
matlabparformatlab-coder

MATLAB Coder and parfor in MATLAB R2014b


Does the MATLAB Coder in MATLAB R2014b support parfor?

If I check the documentation, it reports:

Treated as a for-loop in a MATLAB Function block.

Does that mean that there is no speed improvement?


Solution

  • Does Matlab Coder in Matlab-r2014b support parfor?

    Yes, the list provided in you reference tells you it is supported.

    Does that mean that there is no speed reduction?

    Yes. You literally quote "it is treated as a for loop".

    So in the strict sense of the word parfor is supported, since it will not throw an error. However, it is treated the same way MATLAB would treat it when the parallellisation toolbox is not installed, as a regular for loop. Thus yes, you can compile MATLAB code containing parfor loops, but they will be treated as serial for loops.

    Note that the above only holds true for function blocks; as @Edric pointed out:

    parfor ... ... creates a loop in a generated MEX function or in C/C++ code that runs in parallel on shared-memory multicore platforms.