voxcity.simulator_gpu.init_taichi¶
Taichi initialization for simulator_gpu.
This module provides centralized Taichi initialization to ensure ti.init() is called before any Taichi fields or kernels are used.
Attributes¶
Functions¶
|
Initialize Taichi runtime if not already initialized. |
Ensure Taichi is initialized with default settings. |
|
|
Check if Taichi has been initialized. |
|
Reset initialization state. |
Module Contents¶
- voxcity.simulator_gpu.init_taichi.init_taichi(arch: str | None = None, default_fp: type = ti.f32, default_ip: type = ti.i32, debug: bool = False, suppress_fp16_warnings: bool = True, honor_env: bool = True, **kwargs) bool¶
Initialize Taichi runtime if not already initialized.
This function is idempotent - calling it multiple times is safe. The first call will initialize Taichi, subsequent calls will be no-ops.
- Parameters:
arch – Architecture to use. Options: - None (default): Auto-detect best available (GPU preferred) - ‘gpu’: Use GPU (CUDA, Vulkan, Metal, etc.) - ‘cuda’: Use CUDA specifically - ‘vulkan’: Use Vulkan - ‘metal’: Use Metal (macOS) - ‘cpu’: Use CPU
default_fp – Default floating point type (ti.f32 or ti.f64)
default_ip – Default integer type (ti.i32 or ti.i64)
debug – Enable debug mode for better error messages
suppress_fp16_warnings – Suppress Taichi’s fp16 precision loss warnings (default: True). These warnings occur when using fp16 intermediate buffers for memory bandwidth optimization.
**kwargs – Additional arguments passed to ti.init()
- Returns:
True if initialization was performed, False if already initialized.
- voxcity.simulator_gpu.init_taichi.ensure_initialized()¶
Ensure Taichi is initialized with default settings.
This is a convenience function for lazy initialization. Call this before any Taichi operations if you’re not sure whether init_taichi() has been called.
- voxcity.simulator_gpu.init_taichi.is_initialized() bool¶
Check if Taichi has been initialized.
- voxcity.simulator_gpu.init_taichi.reset()¶
Reset initialization state.
Note: This does NOT reset Taichi itself (which cannot be reset once initialized). This only resets the tracking flag for testing purposes.
- voxcity.simulator_gpu.init_taichi.taichi¶