WOLFRAM

is an option for Compile that specifies attributes for the compiled function it creates.

Details

  • RuntimeAttributes applies to the execution of the compiled function.
  • A possible setting for RuntimeAttributes is Listable.
  • RuntimeAttributes->Listable is effectively equivalent to the Listable attribute of the built-in function.
  • If a compiled function with Listable attribute matches its argument specification, it will run in the normal way.
  • If a compiled function with Listable attribute receives any arguments with higher rank than specified, the function will thread over these arguments.

Examples

Basic Examples  (3)Summary of the most common use cases

This creates a compiled function that is listable:

Out[1]=1

It operates on a single input in normal fashion:

Out[2]=2

When the arguments include a list that does not match the input specification, it threads the function over that argument:

Out[3]=3

This compiled function is not listable:

Out[4]=4

An error results when the argument specification does not match:

Out[5]=5

If there is a branch, listability needs a function to be defined, as shown below using Function:

Out[1]=1

A listable compiled function does the same thing much faster:

Out[2]=2

A listable compiled function can run in parallel, giving an acceleration on multicore machines:

Out[2]=2
Wolfram Research (2010), RuntimeAttributes, Wolfram Language function, https://reference.wolfram.com/language/ref/RuntimeAttributes.html.
Wolfram Research (2010), RuntimeAttributes, Wolfram Language function, https://reference.wolfram.com/language/ref/RuntimeAttributes.html.

Text

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

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

CMS

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

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

APA

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

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

BibTeX

@misc{reference.wolfram_2024_runtimeattributes, author="Wolfram Research", title="{RuntimeAttributes}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/RuntimeAttributes.html}", note=[Accessed: 08-January-2025 ]}

@misc{reference.wolfram_2024_runtimeattributes, author="Wolfram Research", title="{RuntimeAttributes}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/RuntimeAttributes.html}", note=[Accessed: 08-January-2025 ]}

BibLaTeX

@online{reference.wolfram_2024_runtimeattributes, organization={Wolfram Research}, title={RuntimeAttributes}, year={2010}, url={https://reference.wolfram.com/language/ref/RuntimeAttributes.html}, note=[Accessed: 08-January-2025 ]}

@online{reference.wolfram_2024_runtimeattributes, organization={Wolfram Research}, title={RuntimeAttributes}, year={2010}, url={https://reference.wolfram.com/language/ref/RuntimeAttributes.html}, note=[Accessed: 08-January-2025 ]}