The Taichi Programming Language
Project description
import taichi as ti
What is Taichi?
Taichi 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, numberical computation, augmented reality, artificial intelligence, vision and robotics, visual effects in films and games, general-purpose computing, and much more.
Why Taichi?
- Built around Python: Taichi shares almost the same syntax with Python, allowing you to write algorithms with minimal language barrier. It is also well integrated into the Python ecosystem, including NumPy and PyTorch.
- Flexibility: Taichi provides a set of generic data containers known as SNode (/ˈsnoʊd/), an effective mechanism for composing hierarchical, multi-dimensional fields. This can cover many use patterns in numerical simulation (e.g. spatially sparse computing).
- Performance: With the
@ti.kernel
decorator, Taichi's JIT compiler automatically compiles your Python functions into efficient GPU or CPU machine code for parallel execution. - Portability: Write your code once and run it everywhere. Currently, Taichi supports most mainstream GPU APIs, such as CUDA and Vulkan.
- ... and many more features! A cross-platform, Vulkan-based 3D visualizer, differentiable programming, quantized computation (experimental), etc.
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:
pip install --upgrade taichi
We also provide a nightly package. Note that nighly 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 is properly installed, you should get the animation below 🎉:
See Get started for more information.
Build from source
If you wish to try our our experimental features or build Taichi for your own environments, see Developer installation.
Documentation
Contributing
Kudos to all of our amazing contributors! Taichi 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 is distributed under the terms of Apache License (Version 2.0).
See Apache License for details.
Community
Join our discussions
Report an issue
- If you spot an technical or documentation issue, file an issue at GitHub Issues
- If you spot any security issue, mail directly to security@taichi.graphics.
Contact us
You can also join our community from Slack or WeChat. Drop us a message at contact@taichi.graphics first, and we'll follow up.
Reference
Demos
Lectures & talks
- SIGGRAPH 2020 course on Taichi basics: YouTube, Bilibili, slides (pdf).
- Chinagraph 2020 用太极编写物理引擎: 哔哩哔哩
- GAMES 201 高级物理引擎实战指南 2020: 课件
- 太极图形课第一季:课件
- TaichiCon: Taichi Developer Conferences
- More to come...
Citations
If you use Taichi in your research, please cite the corresponding papers:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for taichi-1.0.1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d69ecaf5b528dccfc526680e15274736c4dadfe414786d2bdeba764fe4bb902c |
|
MD5 | 68070a72f491a8feb0fde78d61200e29 |
|
BLAKE2b-256 | 04c32b3809074c05d78e1d4fa77163d23ee8a59dc58f755e3b5984c637a687a1 |
Hashes for taichi-1.0.1-cp310-cp310-manylinux_2_27_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7578ed7ccc996e1e3f989380a612f273b30ce1c67877ad67a07c9d6ac4fcac5c |
|
MD5 | 5294975c1f0c092a213374c9a6756fff |
|
BLAKE2b-256 | 69b7a8282181ea6f6bfbb4139f41fd3eaeb6919cf0441ec6ab28aa8bf8e0cf74 |
Hashes for taichi-1.0.1-cp310-cp310-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b49d99cc0c31bf7f103fe63c5e15d1f9f6f008401936e6ee276352a65b7b821 |
|
MD5 | 9cf4190fe77b95743cdf6b3941dfa9ff |
|
BLAKE2b-256 | bb6487c57fe2f5b4cb12395f4b73341a35819bf51a40200000c61fc9f16d73d4 |
Hashes for taichi-1.0.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34d2093ad7096a429e606567b39cce2f0cbaf0e385e36f543e0661c079ea1ceb |
|
MD5 | f20829a69dfee9cf6abe3843af3f2e66 |
|
BLAKE2b-256 | 326f40cebdf2f622cea42e7f166323a2d40540d4c00f970e3617090bce2abb36 |
Hashes for taichi-1.0.1-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 502440a0f571fd8238ab399b46c2c83c8d8dbc57a473d7887822ec28ae0e33cb |
|
MD5 | 9437ad61998e8d2b9a56dd92ddd01f25 |
|
BLAKE2b-256 | 76b33ec2e86af56528c418aff5b0917a5a1e17780cfa1b1958f2de08bf58cc42 |
Hashes for taichi-1.0.1-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d33d01a7d27033d5e05218a5b9a4fa0ae44b0dd500197caa12dcf6a379bcf0e |
|
MD5 | c4af18619612510c653934734d17c452 |
|
BLAKE2b-256 | 44e69e06744effe82909e90318f4b450b00ab680c90230326c4f0e4c0a4c201a |
Hashes for taichi-1.0.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1a8bf4c353ca1310733cb576cea08846dbddbf5c4e1d6c5436dafbf92df8cfe |
|
MD5 | 4a5101a7e225eae012e2ec075e025601 |
|
BLAKE2b-256 | 768d7f257edc4442fd831ed413f31c006acd8688466785a4c07a149a9be78c01 |
Hashes for taichi-1.0.1-cp39-cp39-manylinux_2_27_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7bb13eb18ca04123c3fc35d17986a316451b8c5d269226778f2016f11368162 |
|
MD5 | 5f7eb7ca8d39d32262c9489d2226d22f |
|
BLAKE2b-256 | 4bc29b9e890c25e1db930f128cf3334f9d8e68cb5dbf072e09d8873c131a6a63 |
Hashes for taichi-1.0.1-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17f00c3b4ca13aa9a0a42ae3d4c6cc6460adbf00db1dfa862ba1d02beecf6075 |
|
MD5 | 94a85c8c7172ab41bd1f91c4d7f81d1b |
|
BLAKE2b-256 | 55bb28b0793e2ea4e0d8ffad7f4517d0206a783214efc00d07dbdc4f54cc1d70 |
Hashes for taichi-1.0.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31fd930f03ee3295c080d8974d2eb965f6947b94ff6d49ca7fd35f8a58f0f8ca |
|
MD5 | b4882886595c97b0bb170dbbf714f844 |
|
BLAKE2b-256 | c0e04a5541e0f86d44f1a8302991363e647797b8b98041d13fff73cbb5bee0d3 |
Hashes for taichi-1.0.1-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69927cd4df065543fd01e75d0050362f7b68dacfa4b7b3ee227a816a87ef1585 |
|
MD5 | 4a2c7ba88e7a833af0a89179d25d8e2c |
|
BLAKE2b-256 | ce82f09ef836e7d700a0cccb9f1f09ea2cd5938b89734b0440e62c24798eed64 |
Hashes for taichi-1.0.1-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e30b84c740a5d0adbc3c1f933d5ca608056b208512e0f3770967f64bc3e566b |
|
MD5 | 27a67b344c5bb586315793afa1490894 |
|
BLAKE2b-256 | 999010d73f2831a7014c01787749828c790a1fbabd1e2c3c95f143c38a9572c6 |
Hashes for taichi-1.0.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba3c78b1b69d415b00482cedd0f63eebb9f440b639ed6ac0acd9398378a639f4 |
|
MD5 | e940d49d8f1d39c9b4ffbbb2893a941d |
|
BLAKE2b-256 | ff858d190188d630ad611c867e31ef6823bd854eb22e8faac753e0e7dc318362 |
Hashes for taichi-1.0.1-cp38-cp38-manylinux_2_27_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 091bb8343d840d99101d1588b0971f37e40214a9597fe9931b6896a70b401def |
|
MD5 | 877929badc0f760255134c7c9ffcea1e |
|
BLAKE2b-256 | fee1bde64cbf9d786ae14e00b1ad407535e67f6430f88d53e490f2c69f285100 |
Hashes for taichi-1.0.1-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5fed4490dcf318843603ade947cb4d40a66a2c4bc17c33144ad9cf1f1e34cca |
|
MD5 | 404f137419f7b05eacb31119a0af3284 |
|
BLAKE2b-256 | d099c79a74b5c445d3d101aeaaca03529a1cd608718b6852dbd68ce814ac22b3 |
Hashes for taichi-1.0.1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 637e8612eba514675e1d7e7fc47401f5139963d9ade4c55bab39dd6d09dcf14e |
|
MD5 | 0d98015e1affe8afe4e86e7f57c0352d |
|
BLAKE2b-256 | a940924bcef1d586f37ef6456fec150af76ac92eaf5553b8c092b82755d16a00 |
Hashes for taichi-1.0.1-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db0a6b534562e886c8d1d0eceec21ab04ae46d571b9e8288678741368a99e66b |
|
MD5 | 2f7977e0f84d194af8a3457d595bb6f7 |
|
BLAKE2b-256 | 8c2d4892e8379a5ef624c77dea2c7cff9eb1f7acf64e36e1de15f51722c913c8 |
Hashes for taichi-1.0.1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbac63224a6956e7492b543e3063ce30732038a2cedf54bffb71ac8f3946ea8c |
|
MD5 | 8a98d16e05a424617228ef9b976d8e29 |
|
BLAKE2b-256 | eedfdf73b4ebc735c076e73055afcb0017410be9a4c36585a18a84be65102201 |
Hashes for taichi-1.0.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 755723018d0fbfa2ad17a5cfccf82f0f00624292d84c7bdc99e0ab38677f5bf9 |
|
MD5 | 1472b9348339fbd20a6cfb4a30158866 |
|
BLAKE2b-256 | fb91c73dcca2cb042760260d6d1a8cd5df4f58bbdbd32e3f00d0c9603c1203f4 |
Hashes for taichi-1.0.1-cp37-cp37m-manylinux_2_27_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b37e8c78d783eab5c3b2f71c4face7d1edd0f2f274e3091581673dee1b56f8f |
|
MD5 | 91066a4876ad959ed9057cb7e4b6b760 |
|
BLAKE2b-256 | 35a09c2701b2cde48967390880036c7d4d57c1df5eb983cb7190d9d1327237c3 |
Hashes for taichi-1.0.1-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4eef69b33e0799e700da6768c74c8e094961ab3572baef1c2e4593a6c26d77dd |
|
MD5 | 10fde8dc27578e76c192827cfb729ed3 |
|
BLAKE2b-256 | 3057797406fc432becee4eb59395a481d1e6ec3be89d4ce818c8926676f390e3 |
Hashes for taichi-1.0.1-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b07097b1303a6149da6f6af5f5077f31e98d8ad93a2606bbfe89c3d49c949c2 |
|
MD5 | f9601549ad0088bda2609bb79232345f |
|
BLAKE2b-256 | 908d27f177216b7ffaf0f83be693fd5e9b2c8de08236e8dba29c039004706a9e |
Hashes for taichi-1.0.1-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d01bc5d8b6e5e4eef4dfa620862878089b9ed00f86a79f62c4dd3f293a764cb5 |
|
MD5 | e405a116ca24112bb9f2d59c7e016d3e |
|
BLAKE2b-256 | 97730c4d7bf1a47fa9c9eccef4acbfc1803b7056f7aaf8febe494e077bf21cd3 |
Hashes for taichi-1.0.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0340b4cc9e4a15a5e43c014ba43eff810c33c7992ac74ed7ae3b9480fe1132c6 |
|
MD5 | 0da4018fd7a123a3a9dc0fe186373b92 |
|
BLAKE2b-256 | bc83f201ec79424a2f301f56348e638547822d99509f1870fd2c9b1090b0d238 |
Hashes for taichi-1.0.1-cp36-cp36m-manylinux_2_27_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5a8f17ecc2e6536bfa6af012f56d3f2fa5da3332ed3ea5ff8057928e7d7a40c |
|
MD5 | 144c78ad08d930456c465b309c2da0ba |
|
BLAKE2b-256 | a1f7d6d21becb8744fae9cd6247355e327231b9383530e7b66435b0fe622d4a5 |
Hashes for taichi-1.0.1-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd771812a0b0b01e260effed781a5427861bac3417b18c7c46bc9d4b0e47ac75 |
|
MD5 | e33ce91e71432c7be471419fa34e9ce3 |
|
BLAKE2b-256 | 18c27840a0a281c75b301b5abfae4d3a629323072c2f27de6980e1756a748634 |
Hashes for taichi-1.0.1-cp36-cp36m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1306f707af90647b57c17d62f8296665793fdefc3a4f25d63f564eb96d48b35b |
|
MD5 | 75a11b9623135502b422658d3078d13b |
|
BLAKE2b-256 | 65c16f730621ece5584cddb58f605db482696447fba0db45f2e45e8b7be0642c |
Hashes for taichi-1.0.1-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5828042ff5577728b0c289b205aba4a839de144af03fb8631ae002402f431cdd |
|
MD5 | 44a165188ce4131ec0eaaacda800ba37 |
|
BLAKE2b-256 | df848939f1c531077cce1af25b1b2fd46aba7144572383861f76f3c798138409 |