taichi README

The project's README from github.com/taichi-dev/taichi. As one markdown file: README.md.


Latest Release downloads CI Nightly Release discord invitation link

pip install taichi  # Install Taichi Lang
ti gallery          # Launch demo gallery

What is Taichi Lang?

Taichi Lang is an open-source, imperative, parallel programming language for high-performance numerical computation. It is embedded in Python and uses just-in-time (JIT) compiler frameworks, for example LLVM, to offload the compute-intensive Python code to the native GPU or CPU instructions.

The language has broad applications spanning real-time physical simulation, numerical computation, augmented reality, artificial intelligence, vision and robotics, visual effects in films and games, general-purpose computing, and much more.

...More

Why Taichi Lang?

Getting Started

Installation

Prerequisites
  • Operating systems
    • Windows
    • Linux
    • macOS
  • Python: 3.6 ~ 3.10 (64-bit only)
  • Compute backends
    • x64/ARM CPUs
    • CUDA
    • Vulkan
    • OpenGL (4.3+)
    • Apple Metal
    • WebAssembly (experiemental)

Use Python's package installer pip to install Taichi Lang:

pip install --upgrade taichi

We also provide a nightly package. Note that nightly packages may crash because they are not fully tested. We cannot guarantee their validity, and you are at your own risk trying out our latest, untested features. The nightly packages can be installed from our self-hosted PyPI (Using self-hosted PyPI allows us to provide more frequent releases over a longer period of time)

pip install -i https://pypi.taichi.graphics/simple/ taichi-nightly

Run your "Hello, world!"

Here is how you can program a 2D fractal in Taichi:

# python/taichi/examples/simulation/fractal.py

import taichi as ti

ti.init(arch=ti.gpu)

n = 320
pixels = ti.field(dtype=float, shape=(n * 2, n))


@ti.func
def complex_sqr(z):
    return ti.Vector([z[0]**2 - z[1]**2, z[1] * z[0] * 2])


@ti.kernel
def paint(t: float):
    for i, j in pixels:  # Parallelized over all pixels
        c = ti.Vector([-0.8, ti.cos(t) * 0.2])
        z = ti.Vector([i / n - 1, j / n - 0.5]) * 2
        iterations = 0
        while z.norm() < 20 and iterations < 50:
            z = complex_sqr(z) + c
            iterations += 1
        pixels[i, j] = 1 - iterations * 0.02


gui = ti.GUI("Julia Set", res=(n * 2, n))

for i in range(1000000):
    paint(i * 0.03)
    gui.set_image(pixels)
    gui.show()

If Taichi Lang is properly installed, you should get the animation below 🎉:

See Get started for more information.

Build from source

If you wish to try our experimental features or build Taichi Lang for your own environments, see Developer installation.

Documentation

Community activity Time period

Timeline graph Issue status graph Pull request status graph Trending topics

Contributing

Kudos to all of our amazing contributors! Taichi Lang thrives through open-source. In that spirit, we welcome all kinds of contributions from the community. If you would like to participate, check out the Contribution Guidelines first.

Contributor avatars are randomly shuffled.

License

Taichi Lang is distributed under the terms of Apache License (Version 2.0).

See Apache License for details.

Community

For more information about the events or community, please refer to this page

Join our discussions

Report an issue

Contact us

Reference

Demos

AOT deployment

Lectures & talks

Citations

If you use Taichi Lang in your research, please cite the corresponding papers:

taichi (taichi-dev/taichi)

Searching Database…

28.4K ·GitHub
这是什么?Taichi Lang 是一门嵌入 Python 的开源高性能 GPU 编程语言:你写类似 Python 的代码,它的 JIT 编译器会把它编译成高效的并行 GPU 或 CPU 机器码。
它是 Python 库,还是一门独立的语言?某种程度上两者都是:它是一门生活在 Python 里的独立语言——语法和 Python 几乎一样,还能和 NumPy、PyTorch 配合使用,不过编译器本身是用 C++ 写的。
必须有 NVIDIA 显卡才能运行吗?不需要——普通的 x64 和 ARM CPU 也能跑。在 GPU 加速方面,Taichi 支持大多数主流 API:CUDA、Vulkan、OpenGL 4.3+ 以及苹果的 Metal。对 WebAssembly 的支持还处于实验阶段。
上手之前有什么要注意的坑吗?Python 只支持到 3.10(仅限 64 位),而且 nightly 每夜版测试不充分,可能会崩溃。量化计算和 WebAssembly 仍属于实验性功能。
它是给谁用的——偏图形还是偏 AI?主要用于计算密集型的工作:实时物理仿真、数值计算、增强现实、AI、视觉与机器人,以及电影和游戏中的视觉效果,也可以做通用并行计算。
SNodes 是什么,跟我有什么关系?SNode 是 Taichi 用来构建分层多维字段的通用数据容器,也是空间稀疏计算背后的机制——在做大规模数值仿真时这一点很重要。
它支持可微编程吗?支持,这是它的招牌功能之一:kernel 可以求梯度,DiffTaichi 就用它来做可微物理仿真,以及机器学习研究中的优化。
在哪里能看到示例或者学习它?README 里链接了 Taichi Lang 示例、进阶示例和一个 Awesome Taichi 列表,还有配套课程:YouTube 和 B 站上的 SIGGRAPH 2020 课程,以及 GAMES 201 高级物理引擎课程。
Taichi 代码能在 Python 之外运行吗?可以——有 AOT(ahead-of-time,提前编译)部署示例,还有一份教程教你运行脱离 Python 运行时编译好的 kernel。
What are similar projects?Open3D, numba, DLSS5-Feeder, crosstl, bgfx, taskflow, renderdoc, filament
Creator
taichi-dev
Size
58.9 MB
Stars
28.4K
Age
9y
Commits · 90 Days