Optimize reductions
R2026bSingle instruction, multiple data (SIMD) code for reduction operation loops
Since R2022a
Model Configuration Pane: Code Generation / Optimization
Description
The Optimize reductions parameter instructs the code generator to generate single instruction, multiple data (SIMD) code for reduction operation loops. A reduction is an operation that reduces a set of elements, such as an array, to a single value using an associative binary operator. For example, calculating the sum of the elements in an array is a reduction operation that uses the addition operator. Reduction operations are generated from blocks such as Sum of elements and Product of elements blocks.
If the block input signal uses an integer data type and the block has
Saturate on integer overflow set to on,
there might be a mismatch between simulation and code generation numerical
results.
Dependencies
To use this parameter, you must set Instruction set extensions to a valid instruction set.
Settings
off (default) | on- On
Generates single instruction, multiple data (SIMD) code for reduction operation loops.
- Off
Generates non-parallel
forloops for reduction operations.
Examples
Recommended Settings
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | On (execution speed) |
| Safety precaution | Off |
Programmatic Use
Parameter: OptimizeReductions |
| Type: character vector |
Value: 'on' | 'off' |
Default: 'off' |
Version History
Introduced in R2022a

