warp.ModuleBuildOptions#

class warp.ModuleBuildOptions(
*,
extra_cuda_include_dirs=None,
extra_cpu_include_dirs=None,
extra_cuda_preamble='',
extra_cpu_preamble='',
extra_build_dependencies=None,
)[source]#

Extra build options for a Warp module.

Experimental: this API may change in future releases.

Example:

build_options = wp.ModuleBuildOptions(extra_cuda_include_dirs=["/path/to/include"])
wp.set_module_options({"extra_build_options": build_options})

Changes to an instance take effect when it is passed to warp.set_module_options(). After modifying an instance, call warp.set_module_options() again so Warp invalidates the module’s cached compilation state. Use merged() to combine options from multiple addons without modifying either input.

Parameters:
  • extra_cuda_include_dirs (Sequence[str | os.PathLike[str]] | None) – Extra include directories used only when compiling CUDA modules. Each entry must be an absolute path to an existing directory.

  • extra_cpu_include_dirs (Sequence[str | os.PathLike[str]] | None) – Extra include directories used only when compiling CPU modules. Each entry must be an absolute path to an existing directory.

  • extra_cuda_preamble (str) – Extra CUDA source inserted after Warp’s headers and before codegen-only cast macros and the generated code, so it may use Warp’s public macros and ordinary C++ casts.

  • extra_cpu_preamble (str) – Extra CPU source inserted after Warp’s headers and before codegen-only cast macros and the generated code, so it may use Warp’s public macros and ordinary C++ casts.

  • extra_build_dependencies (Sequence[str | os.PathLike[str]] | None) – Files whose contents are hashed into the module hash. Each entry must be an absolute path to an existing file. Contents are re-read when the module hash is recomputed (after warp.set_module_options() or in a new process), not on every launch.

Methods

merged(*others)

Return build options formed by appending one or more option sets.

merged(*others)[source]#

Return build options formed by appending one or more option sets.

Include directories and dependencies retain their first occurrence. Preambles are concatenated in argument order with a newline between non-empty values.

Parameters:

*others (ModuleBuildOptions) – Additional build options to append.

Returns:

A new options instance. The inputs are not modified.

Return type:

ModuleBuildOptions