When certain conditions are met, you can generate SIMD code using Intel AVX2 technology from certain MATLAB® System objects in DSP System Toolbox™.
To generate SIMD code from MATLAB System objects, create a coder.config
(MATLAB Coder) object, set the CodeReplacementLibrary
parameter to 'Intel AVX (Windows)'
or 'Intel AVX
(Linux)'
, and use it with the codegen
(MATLAB Coder) command as shown.
This workflow requires you to install MATLAB Coder™ and Embedded Coder® on your machine.
cfg=coder.config('lib'); cfg.CodeReplacementLibrary='Intel AVX (Windows)'; codegen {FunctionName.m} -config cfg
cfg=coder.config('dll'); cfg.CodeReplacementLibrary='Intel AVX (Windows)'; codegen {FunctionName.m} -config cfg
cfg=coder.config('exe'); cfg.CodeReplacementLibrary='Intel AVX (Windows)'; cfg.GenerateExampleMain='GenerateCodeAndCompile'; codegen {FunctionName.m} -config cfg
Here, FunctionName.m
is the MATLAB function that calls the System object™ you are trying to generate SIMD code from.
This table contains a list of System objects in DSP System Toolbox that support SIMD code generation. The table also details the conditions under which the support is available.
MATLAB System objects | Conditions |
---|---|
dsp.FIRFilter |
|
dsp.FIRDecimator |
|
dsp.FIRInterpolator |
|
dsp.LMSFilter |
|