Configuration#
Warp has settings at the global, module, and kernel level that can be used to fine-tune the compilation and verbosity
of Warp programs. In cases in which a setting can be changed at multiple levels (e.g.: enable_backward
),
the setting at the more-specific scope takes precedence.
Global Settings#
Settings can be modified by direct assignment before or after calling wp.init()
,
though some settings only take effect if set prior to initialization.
For example, the location of the user kernel cache can be changed with:
import os
import warp as wp
example_dir = os.path.dirname(os.path.realpath(__file__))
# set default cache directory before wp.init()
wp.config.kernel_cache_dir = os.path.join(example_dir, "tmp", "warpcache1")
wp.init()
- warp.config.verify_fp: bool = False#
Enable floating-point verification for inputs and outputs.
When enabled, checks if all values are finite before and after operations.
Note: Enabling this flag impacts performance.
- warp.config.verify_cuda: bool = False#
Enable CUDA error checking after kernel launches.
This setting cannot be used during graph capture
Note: Enabling this flag impacts performance
- warp.config.print_launches: bool = False#
Enable detailed kernel launch logging.
Prints information about each kernel launch including:
Launch dimensions
Input/output parameters
Target device
Note: Enabling this flag impacts performance.
- warp.config.mode: str = 'release'#
Compilation mode for Warp kernels.
- Parameters:
mode – Either
"release"
or"debug"
.
Note: Debug mode may impact performance.
- warp.config.verbose_warnings: bool = False#
Enable extended warning messages with source location information.
- warp.config.quiet: bool = False#
Disable Warp module initialization messages.
Error messages and warnings remain unaffected.
- warp.config.verify_autograd_array_access: bool = False#
Enable warnings for array overwrites that may affect gradient computation.
- warp.config.enable_vector_component_overwrites: bool = False#
Allow multiple writes to vector/matrix/quaternion components.
Note: Enabling this may significantly increase kernel compilation time.
- warp.config.kernel_cache_dir: str | None = None#
Directory path for storing compiled kernel cache.
If
None
, the path is determined in the following order:WARP_CACHE_PATH
environment variable.System’s user cache directory (via
appdirs.user_cache_directory
).
Note: Subdirectories prefixed with
wp_
will be created in this location.
- warp.config.cuda_output: str | None = None#
Preferred CUDA output format for kernel compilation.
- Parameters:
cuda_output – One of {
None
,"ptx"
,"cubin"
}. IfNone
, format is auto-determined.
- warp.config.ptx_target_arch: int = 75#
Target architecture version for PTX generation.
Defaults to minimum architecture version supporting all Warp features.
- warp.config.enable_graph_capture_module_load_by_default: bool = True#
Enable automatic module loading before graph capture.
Only affects systems with CUDA driver versions below 12.3.
Module Settings#
Module-level settings to control runtime compilation and code generation may be changed by passing a dictionary of
option pairs to wp.set_module_options()
.
For example, compilation of backward passes for the kernel in an entire module can be disabled with:
wp.set_module_options({"enable_backward": False})
The options for a module can also be queried using wp.get_module_options()
.
Field |
Type |
Default Value |
Description |
---|---|---|---|
|
String |
Global setting |
Controls whether to compile the module’s kernels in debug or release
mode by default. Valid choices are |
|
Integer |
Global setting |
The maximum fixed-size loop to unroll. Note that |
|
Boolean |
Global setting |
If |
|
Boolean |
|
If |
|
Boolean |
|
If |
|
Boolean |
|
If |
|
String |
|
The preferred CUDA output format for kernels. Valid choices are |
Kernel Settings#
enable_backward
is currently the only setting that can also be configured on a per-kernel level.
Backward-pass compilation can be disabled by passing an argument into the @wp.kernel
decorator
as in the following example:
@wp.kernel(enable_backward=False)
def scale_2(
x: wp.array(dtype=float),
y: wp.array(dtype=float),
):
y[0] = x[0] ** 2.0