CompilerRuntimeErrorAction

CompilerRuntimeErrorAction

is an option for FunctionCompile that determines what should happen when an unrecoverable error takes place while computing with low-level code.

Details

  • With the default setting of Automatic, the computation will be rerun in the Wolfram Engine if it avoids compiler-specific code.
  • Possible settings for CompilerRuntimeErrorAction are:
  • Automaticrerun the computation in the Wolfram Engine if it avoids compiler-specific code
    "Evaluate"always rerun the computation in the Wolfram Engine
    Nonereturn a failure object that represents the error
    funapply fun to the failure object and return the result

Examples

Basic Examples  (3)

Generate compiled code with the default CompilerRuntimeErrorAction:

There is an error due to integer overflow and the computation is rerun by the evaluator:

Generate compiled code with CompilerRuntimeErrorAction set to None:

Now the error is not rerun in the Wolfram Engine; instead a Failure is returned:

If the function contains code specific for the compiler, the default setting of CompilerRuntimeErrorAction does not run in the evaluator:

Generate compiled code with CompilerRuntimeErrorAction set to None:

Now the error is not rerun in the Wolfram Engine:

Setting CompilerRuntimeErrorAction to "Evaluate" indicates that if any error occurs, the computation will be rerun in the evaluator:

Now the error is rerun in the Wolfram Engine:

CompilerRuntimeErrorAction can take a function to apply to the failure object:

The failure is returned wrapped in a frame:

Wolfram Research (2024), CompilerRuntimeErrorAction, Wolfram Language function, https://reference.wolfram.com/language/ref/CompilerRuntimeErrorAction.html.

Text

Wolfram Research (2024), CompilerRuntimeErrorAction, Wolfram Language function, https://reference.wolfram.com/language/ref/CompilerRuntimeErrorAction.html.

CMS

Wolfram Language. 2024. "CompilerRuntimeErrorAction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CompilerRuntimeErrorAction.html.

APA

Wolfram Language. (2024). CompilerRuntimeErrorAction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CompilerRuntimeErrorAction.html

BibTeX

@misc{reference.wolfram_2024_compilerruntimeerroraction, author="Wolfram Research", title="{CompilerRuntimeErrorAction}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/CompilerRuntimeErrorAction.html}", note=[Accessed: 10-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_compilerruntimeerroraction, organization={Wolfram Research}, title={CompilerRuntimeErrorAction}, year={2024}, url={https://reference.wolfram.com/language/ref/CompilerRuntimeErrorAction.html}, note=[Accessed: 10-December-2024 ]}