coder.MexConfig

Package: coder

Code acceleration configuration object for use with fiaccel

Description

A coder.MexConfig object contains all the configuration parameters that the fiaccel function uses when accelerating fixed-point code via a generated MEX function. To use this object, first create it using the lowercase coder.mexconfig function and then, pass it to the fiaccel function using the -config option.

Construction

cfg = coder.mexconfig creates a coder.MexConfig object, cfg, for fiaccel MEX function generation.

Properties

ConstantFoldingTimeout

Maximum number of constant folder instructions

Specify, as a positive integer, the maximum number of instructions to be executed by the constant folder.

Default: 10000

DynamicMemoryAllocation

Dynamic memory allocation for variable-size data

By default, when this property is set to 'Threshold' , dynamic memory allocation is enabled for all variable-size arrays whose size is greater than DynamicMemoryAllocationThreshold and fiaccel allocates memory for this variable-size data dynamically on the heap. Set this property to 'Off' to allocate memory statically on the stack. Set it to'AllVariableSizeArrays' to allocate memory for all variable-size arrays dynamically on the heap . You must use dynamic memory allocation for all unbounded variable-size data.

This property, DynamicMemoryAllocation, is enabled only when EnableVariableSizing is true. When you set DynamicMemoryAllocation to `Threshold', it enables the DynamicMemoryAllocationThreshold property.

Default: Threshold

DynamicMemoryAllocationThreshold

Memory allocation threshold

Specify the integer size of the threshold for variable-size arrays above which fiaccel allocates memory on the heap.

Default: 65536

EchoExpressions

Show results of code not terminated with semicolons

Set this property to true to have the results of code instructions that do not terminate with a semicolon appear in the MATLAB® Command Window. If you set this property to false, code results do not appear in the MATLAB Command Window.

Default: true

EnableDebugging

Compile generated code in debug mode

Set this property to true to compile the generated code in debug mode. Set this property to false to compile the code in normal mode.

Default: false

EnableVariableSizing

Variable-sized arrays support

Set this property to true to enable support for variable-sized arrays and to enable the DynamicMemoryAllocation property. If you set this property to false, variable-sized arrays are not supported.

Default: true

ExtrinsicCalls

Extrinsic function calls

An extrinsic function is a function on the MATLAB path that the generated code dispatches to MATLAB software for execution. fiaccel does not compile or generate code for extrinsic functions. Set this property to true to have fiaccel generate code for the call to a MATLAB function, but not generate the function's internal code. Set this property to false to have fiaccel ignore the extrinsic function and not generate code for the call to the MATLAB function. If the extrinsic function affects the output of fiaccel, a compiler error occurs.

ExtrinsicCalls affects how MEX functions built by fiaccel generate random numbers when using the MATLAB rand, randi, and randn functions. If extrinsic calls are enabled, the generated mex function uses the MATLAB global random number stream to generate random numbers. If extrinsic calls are not enabled, the MEX function built with fiaccel uses a self-contained random number generator.

Default: true

GenerateReport

Code generation report

Set this property to true to create an HTML code generation report. Set this property to false to not create the report.

Default: false

GlobalDataSyncMethod

MEX function global data synchronization with MATLAB global workspace

Set this property to SyncAlways so synchronize global data at MEX function entry and exit and for all extrinsic calls to ensure maximum consistency between MATLAB and the generated MEX function. If the extrinsic calls do not affect global data, use this option in conjunction with the coder.extrinsic -sync:off option to turn off synchronization for these calls to maximize performance.

If you set this property to SyncAtEntryAndExits, global data is synchronized only at MEX function entry and exit. If your code contains extrinsic calls, but only a few affect global data, use this option in conjunction with the coder.extrinsic -sync:on option to turn on synchronization for these calls to maximize performance.

If you set this property to NoSync, no synchronization occurs. Ensure that your MEX function does not interact with MATLAB globals before disabling synchronization otherwise inconsistencies between MATLAB and the MEX function might occur.

Default: SyncAlways

InlineStackLimit

Stack size for inlined functions

Specify, as a positive integer, the stack size limit on inlined functions.

Default: 4000

InlineThreshold

Maximum size of functions to be inlined

Specify, as a positive integer, the maximum size of functions to be inlined.

Default: 10

InlineThresholdMax

Maximum size of functions after inlining

Specify, as a positive integer, the maximum size of functions after inlining.

Default: 200

IntegrityChecks

Memory integrity

Sset this property to true to detect any violations of memory integrity in code generated for MATLAB. When a violation is detected, execution stops and a diagnostic message displays. Set this property to false to disable both memory integrity checks and the runtime stack.

Default: true

LaunchReport

Code generation report display

Set this property to true to open the HTML code generation report automatically when code generation completes. Set this property to false to disable displaying the report automatically. This property applies only if you set the GenerateReport property to true.

Default: true

ResponsivenessChecks

Responsiveness checks

Set this property to true to turn on responsiveness checks. Set this property to false to disable responsiveness checks.

Default: true

SaturateOnIntegerOverflow

Integer overflow action

Overflows saturate to either the minimum or maximum value that the data type can represent. Set this property to true to have overflows saturate. Set this property to false to have overflows wrap to the appropriate value representable by the data type.

Default: true

StackUsageMax

Maximum stack usage per application

Specify, as a positive integer, the maximum stack usage per application in bytes. Set a limit that is lower than the available stack size. Otherwise, a runtime stack overflow might occur. Overflows are detected and reported by the C compiler, not by fiaccel.

Default: 200000

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Copying Objects in the MATLAB documentation.

Examples

Use the lowercase coder.mexconfig function to create a coder.MexConfig configuration object. Set this object to disable run-time checks.

cfg = coder.mexconfig
% Turn off Integrity Checks, Extrinsic Calls, 
% and Responsiveness Checks
cfg.IntegrityChecks = false;
cfg.ExtrinsicCalls = false;
cfg.ResponsivenessChecks = false;
% Use fiaccel to generate a MEX function for file foo.m
fiaccel -config cfg foo
Was this topic helpful?