coder.mexconfig
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
coder.mexconfig
function, then pass it to the
fiaccel
function using the -config
option.
Creation
Syntax
Description
creates a
cfg
= coder.mexconfigcoder.MexConfig
code generation object for use with
fiaccel
, which generates a MEX function.
Properties
CompileTimeRecursionLimit
— Number of copies of a function allowed in generated code for compile-time recursion
50 (default) | integer
Number of copies of a function allowed in generated code for compile-time recursion,
specified as an integer. To disallow recursion in the MATLAB® code, set CompileTimeRecursionLimit
to
0
. The default compile-time recursion limit is high enough for most
recursive functions that require compile-time recursion. If code generation fails
because of the compile-time recursion limit, and you want compile-time recursion, try to
increase the limit. Alternatively, change your MATLAB code so that the code generator uses run-time recursion.
ConstantFoldingTimeout
— Maximum number of constant folder instructions
10000 (default) | positive integer
Maximum number of instructions to be executed by the constant folder, specified as a positive integer.
ConstantInputs
— Constant input checking mode
'CheckValues'
(default) | 'IgnoreValues'
| 'Remove'
Constant input checking mode, specified as one of the values in this table.
Value | Description |
---|---|
'CheckValues' | This value is the default value. When you call the MEX function, it checks that the value you provide for a constant input argument is the value specified at code generation time. You can call the MEX function and the original MATLAB function with the same arguments. Therefore, you can use the same test file for both functions. Checking the values can slow down execution of the MEX function. |
'IgnoreValues' | When you call the MEX function, it ignores the value that you provide for a constant input argument. It uses the value specified at code generation time. You can use the same test file without the overhead of checking the constant argument values. |
'Remove' | The code generator removes constant input arguments from the MEX function signature. When you call the MEX function, you do not provide a value for a constant input argument. This option provides backward compatibility. |
See Constant Input Checking in MEX Functions (MATLAB Coder).
DynamicMemoryAllocation
— Dynamic memory allocation for variable-size data
'Threshold'
(default) | 'AllVariableSizeArrays'
| 'Off'
Dynamic memory allocation for variable-size data, specified as one of these values:
'Threshold'
— Dynamic memory allocation is enabled for all variable-size arrays whose size is greater thanDynamicMemoryAllocationThreshold
andfiaccel
allocates memory for this variable-size data dynamically on the heap.'AllVariableSizeArrays'
— Allocate memory for all variable-size arrays dynamically on the heap. You must use dynamic memory allocation for all unbounded variable-size data.'Off'
— Allocate memory statically on the stack.
You must use dynamic memory allocation for all unbounded variable-size data.
Dependencies:
EnableVariableSizing
enables this parameter.Setting this
DynamicMemoryAllocation
to'Threshold'
enables theDynamicMemoryAllocationThreshold
parameter.
Note
DynamicMemoryAllocation
configuration option will be removed
in a future release. To dynamically allocation memory for variable-size arrays, use
the EnableDynamicMemoryAllocation
option. To set the threshold,
use the DynamicMemoryAllocationThreshold
option.
DynamicMemoryAllocationForFixedSizeArrays
— Dynamic memory allocation for fixed-size arrays
false
(default) | true
Dynamic memory allocation for fixed-size arrays, specified as one of the values in this table.
Value | Description |
---|---|
true | The code generator allocates memory dynamically on the heap for
fixed-size arrays whose size (in bytes) is greater than or equal to
|
false | This value is the default value. The code generator statically allocates memory for fixed-size arrays on the stack. |
Dependency:
Setting
EnableDynamicMemoryAllocation
totrue
enables this option.
See, Control Dynamic Memory Allocation for Fixed-Size Arrays (MATLAB Coder).
DynamicMemoryAllocationThreshold
— Memory allocation threshold
65536
(default) | integer
Size of the threshold for variable-size arrays above which
fiaccel
allocates memory on the heap, specified as an
integer.
Dependency:
Setting
EnableDynamicMemoryAllocation
totrue
enables this parameter.
EnableAutoExtrinsicCalls
— Treat common visualization functions as extrinsic functions
true
(default) | false
Whether fiaccel
treats common visualization functions as
extrinsic functions, specified as true
or false
.
When this option is enabled, fiaccel
detects calls to many common
visualization functions, such as plot
, disp
,
and figure
. It calls out to MATLAB for these functions. This capability reduces the amount of time that you
spend making your code suitable for code generation. It also removes the requirement to
declare these functions extrinsic using the coder.extrinsic
function.
EchoExpressions
— Show results of code not terminated with semicolons
true
(default) | false
Whether to show results of code not terminated with semicolons, specified as
true
or false
.
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.
EnableRuntimeRecursion
— Allow recursive functions in the generated code
true
(default) | false
Whether to allow recursive functions in the generated code, specified as
true
or false
. If your MATLAB code requires run-time recursion and this parameter is
false
, code generation fails.
EnableDebugging
— Compile generated code in debug mode
false
(default) | true
Whether to compile generated code in debug mode, specified as
true
or false
.
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.
EnableDynamicMemoryAllocation
— Enable dynamic memory allocation for variable-size arrays
true
(default) | false
Dynamic memory allocation for variable-size arrays, specified as one of the values in this table.
Value | Description |
---|---|
true | This value is the default value. The code generator
allocates memory dynamically on the heap for variable-size arrays whose size
(in bytes) is greater than or equal to
|
false | The code generator statically allocates memory for variable-size arrays on the stack. |
EnableImplicitExpansion
— Enable implicit expansion capabilities in generated code
true
(default) | false
Whether to enable implicit expansion capabilities in generated code, specified as
true
or false
.
Set this property to true
to enable implicit expansion in the
generated code. The code generator includes modifications in the generated code to apply
implicit expansion. See Compatible Array Sizes for Basic Operations. Set this property to false
so
the generated code does not follow the rules of implicit expansion.
EnableVariableSizing
— Enable support for variable-size arrays
true
(default) | false
Whether to enable support for variable-size arrays, specified as
true
or false
.
Set this property to true
to enable support for variable-size
arrays and to enable the DynamicMemoryAllocation
property. If you
set this property to false
, variable-size arrays are not supported.
ExtrinsicCalls
— Extrinsic function calls
true
(default) | false
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.
If you disable extrinsic calls, the generated MEX function cannot display run-time
messages from error
or assert
statements in your
MATLAB code. The MEX function reports that it cannot display the error message.
To see the error message, enable extrinsic function calls and generate the MEX function
again.
GenerateReport
— Create an HTML code generation report
false
(default) | true
Whether to create an HTML code generation report, specified as
true
or false
.
GlobalDataSyncMethod
— MEX function global data synchronization with MATLAB global workspace
SyncAlways
(default) | SyncAtEntryAndExits
| NoSync
MEX function global data synchronization with MATLAB global workspace, specified as one of these values:
SyncAlways
— 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 thecoder.extrinsic
-sync:off
option to turn off synchronization for these calls to maximize performance.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 thecoder.extrinsic
-sync:on
option to turn on synchronization for these calls to maximize performance.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.
Data Types: char
InlineStackLimit
— Stack size limit for inlined functions
4000
(default) | positive integer
Stack size limit for inlined functions, specified as a positive integer.
InlineThreshold
— Maximum size of functions to be inlined
10
(default) | positive integer
Maximum size of functions to be inlined, specified as a positive integer.
InlineThresholdMax
— Maximum size of functions after inlining
200
(default) | positive integer
Maximum size of functions after inlining, specified as a positive integer.
IntegrityChecks
— Memory integrity
true
(default) | false
Set 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.
LaunchReport
— Open the HTML code generation report automatically
true
(default) | false
Whether to open the HTML code generation report automatically when code generation
completes, specified as true
or false
. This
property applies only if you set the GenerateReport
property to
true
.
ReportPotentialDifferences
— Report potential behavior differences between generated code and MATLAB code
true
(default) | false
Whether to report potential behavior differences between generated code and
MATLAB code, specified as true
or false
. If
the ReportPotentialDifferences
property is set to
true
, the code generation report has a tab that lists the potential
differences. A potential difference is a difference that occurs at run time only under
certain conditions.
ResponsivenessChecks
— Enable responsiveness checks
true
(default) | false
Whether to enable responsiveness checks, specified as true
or
false
.
SaturateOnIntegerOverflow
— Saturate on integer overflow
true
(default) | false
Whether to saturate on integer overflow, specified as true
or
false
. 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.
StackUsageMax
— Maximum stack usage per application in bytes
200000
(default) | positive integer
Maximum stack usage per application in bytes, specified as a positive integer. 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
.
Examples
Create a Code Acceleration Configuration Object
This example shows how to use the coder.mexconfig
function to create a coder.MexConfig
configuration object. The object is set 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 the fiaccel
function to generate a MEX function for the file foo.m
.
fiaccel -config cfg foo
Version History
Introduced in R2011aR2023a: ConstantInputs
property added to coder.MexConfig
object
The coder.mexconfig
object now includes the
ConstantInputs
property.
R2023a: DynamicMemoryAllocation
Property To Be Removed
In a future release, the DynamicMemoryAllocation
property will be
removed.
To dynamically allocate memory for variable-size arrays, use the
EnableDynamicMemoryAllocation
property. To configure the dynamic memory
allocation threshold, use DynamicMemoryAllocationThreshold
property.
See Also
coder.ArrayType
| coder.Constant
| coder.EnumType
| coder.FiType
| coder.PrimitiveType
| coder.StructType
| coder.Type
| coder.newtype
| coder.resize
| coder.typeof
| fiaccel
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)