- The short answer is: it is code dependent.
- Many MATLAB functions are overloaded to handle vector or parallel operations based on the variables’ data type, i.e., scalars, vectors, or distributed (parallel) arrays. Some applications require only that you turn on the parallel option. The rest is taken care of by MATLAB. An example is the use of the financial toolbox.
- If arrays have been declared distributed (i.e., for parallel operations), subsequent operations on these arrays using parallel MATLAB or user-defined functions will be processed in parallel without additional instructions. Output arrays that have not been declared as distributed will be promoted to distributed if they are used with distributed arrays. On the other hand, parfor, a parallel version of the for-loop, may be used to automatically distribute the loop indices among the processors for concurrent processing.
- On the other extreme, some codes may require more time and effort to parallelize.