{"id":7774,"library":"taichi","title":"Taichi Programming Language","description":"Taichi is an open-source parallel programming language designed for high-performance visual computing. It allows users to write highly parallelized computational kernels using Python syntax, which are then compiled to run efficiently on various backends like GPUs (CUDA, Metal, Vulkan, OpenGL) or CPUs. It's currently at version 1.7.4 and maintains an active release schedule with frequent minor updates.","status":"active","version":"1.7.4","language":"en","source_language":"en","source_url":"https://github.com/taichi-dev/taichi","tags":["scientific computing","GPU programming","GPGPU","high-performance computing","physics simulation","graphics","compiler"],"install":[{"cmd":"pip install taichi","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"taichi","correct":"import taichi as ti"},{"symbol":"ti.math","correct":"import taichi as ti\n# ... later in code ...\nvec = ti.math.vec3(1, 2, 3)"},{"note":"The experimental decorator was deprecated in v1.7.0.","wrong":"@ti.experimental.real_func","symbol":"ti.real_func","correct":"@ti.real_func"}],"quickstart":{"code":"import taichi as ti\n\nti.init(arch=ti.cpu) # Try ti.gpu for GPU acceleration if available\n\n# Declare a 2D field (similar to a NumPy array)\nN = 32\nx = ti.field(ti.f32, shape=(N, N))\ny = ti.field(ti.f32, shape=(N, N))\n\n@ti.kernel\ndef compute():\n    for i, j in x: # Iterate over all elements in the field x\n        x[i, j] = float(i + j) / N\n        y[i, j] = x[i, j] * 2.0\n\nif __name__ == '__main__':\n    compute()\n    print(f\"x[0,0]: {x[0,0]}\")\n    print(f\"y[0,0]: {y[0,0]}\")\n    # Fields can be converted to NumPy arrays for further processing:\n    # x_np = x.to_numpy()\n    # print(x_np[0,0])","lang":"python","description":"This example initializes Taichi, declares two 2D fields, and then defines a Taichi kernel to perform a simple computation over all elements. The `@ti.kernel` decorator compiles the Python function into a high-performance kernel that runs on the chosen backend (CPU or GPU)."},"warnings":[{"fix":"Update your code to use `@ti.real_func` instead of `@ti.experimental.real_func`.","message":"The `@ti.experimental.real_func` decorator was deprecated in Taichi v1.7.0 and replaced by `@ti.real_func`.","severity":"breaking","affected_versions":">=1.7.0"},{"fix":"Replace `field_dim` with `ndim` when creating `ti.ndarray` instances. For example, `ti.ndarray(ti.f32, ndim=2)`.","message":"The `field_dim` argument for `ti.ndarray` has been removed. Use `ndim` instead.","severity":"breaking","affected_versions":">=1.5.0"},{"fix":"Migrate calls from `ti.Matrix.rotation2d()` to `ti.math.rotation2d()`.","message":"The `ti.Matrix.rotation2d()` method was removed. Its functionality is now provided by `ti.math.rotation2d()`.","severity":"breaking","affected_versions":">=1.4.0"},{"fix":"Remove these arguments from your `ti.init()` calls. Taichi's SNode system has evolved to handle these aspects more automatically or through different configuration mechanisms.","message":"The `packed` and `dynamic_index` arguments in `ti.init()` have been removed. `packed` was removed in v1.4.0, `dynamic_index` in v1.5.0.","severity":"breaking","affected_versions":">=1.4.0 (packed), >=1.5.0 (dynamic_index)"},{"fix":"If a matrix type is explicitly required, you may need to explicitly construct a 1xN or Nx1 matrix from the resulting vector, e.g., `ti.Matrix.rows([my_vector])` or `ti.Matrix.cols([my_vector])`.","message":"Slicing a single row or column of a `ti.Matrix` now returns a vector, not a 1xN or Nx1 matrix, potentially leading to dimension mismatches in subsequent matrix operations.","severity":"gotcha","affected_versions":">=1.4.0"},{"fix":"Consider migrating AOT workflows to use TiRT. Refer to Taichi's AOT documentation for the latest deployment strategies.","message":"The `ti.cc` backend is deprecated in favor of the Taichi Runtime (TiRT) and its C API, especially for Ahead-of-Time (AOT) deployment.","severity":"deprecated","affected_versions":">=1.5.0"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Replace `@ti.experimental.real_func` with `@ti.real_func`.","cause":"Attempting to use `@ti.experimental.real_func` after Taichi v1.7.0.","error":"AttributeError: module 'taichi' has no attribute 'experimental'"},{"fix":"Change `field_dim` to `ndim` when defining your `ti.ndarray`, e.g., `ti.ndarray(ti.f32, ndim=2)`.","cause":"Using the `field_dim` argument with `ti.ndarray` after Taichi v1.5.0.","error":"TypeError: ndarray() got an unexpected keyword argument 'field_dim'"},{"fix":"Use `ti.math.rotation2d()` for 2D rotation matrix generation.","cause":"Calling `rotation2d()` directly on a `ti.Matrix` object after Taichi v1.4.0.","error":"AttributeError: 'Matrix' object has no attribute 'rotation2d'"},{"fix":"Remove `packed=True/False` from your `ti.init()` call. The SNode system manages memory packing automatically.","cause":"Using the `packed` argument in `ti.init()` after Taichi v1.4.0.","error":"TypeError: ti.init() got an unexpected keyword argument 'packed'"}]}