CompilationOptions
is an option for Compile that specifies settings for the compilation process.
Details
- CompilationOptions applies to the creation of the compiled function.
- CompilationOptions accepts lists of settings in the form CompilationOptions->{…}.
- CompilationOptions can also take the following nested settings:
-
"ExpressionOptimization" Automatic whether to optimize the input expression "InlineCompiledFunctions" Automatic whether to expand the body of nested compiled functions "InlineExternalDefinitions" Automatic whether to use external definitions - Possible values for "ExpressionOptimization" are:
-
False do not optimize the input expression True optimize the input expression Automatic only use the optimized expression if the compiled function does not make external calls - Possible values for "InlineCompiledFunctions" are:
-
False do not inline nested compiled functions True inline nested compiled functions Automatic inline small nested compiled functions - Possible values for "InlineExternalDefinitions" are:
-
False do not use external definitions True insert the body of external definitions Automatic use the type of external definitions
Examples
open allclose allBasic Examples (1)
Options (3)
ExpressionOptimization (1)
The default setting of Automatic optimizes the input expression to avoid computing the same subpart more than once:
If the compiled function needs to make an external call to the Wolfram Language, the default setting of Automatic does not optimize:
Turning off compilation optimizations may cause the same computation to be done more than once:
Setting "CompileOptimizations" to True causes optimization even if the compiled function needs to make an external call to the Wolfram Language:
InlineCompiledFunctions (1)
InlineExternalDefinitions (1)
The default setting of Automatic uses the type of external definitions, but makes an external call. In this case the external call fails:
A setting of True will inline the external definition, allowing the computation to proceed without errors:
A setting of False will not inline the external definition and will not use the type information. In this case there is an external call that fails:
Text
Wolfram Research (2010), CompilationOptions, Wolfram Language function, https://reference.wolfram.com/language/ref/CompilationOptions.html.
CMS
Wolfram Language. 2010. "CompilationOptions." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CompilationOptions.html.
APA
Wolfram Language. (2010). CompilationOptions. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CompilationOptions.html