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.9 (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 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.
pip install -i https://test.pypi.org/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.
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-0.9.2-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b644234378c8e7af090480cae3e57d346a41d079cc587f553c2b3309644392d |
|
MD5 | 102c901970afbc505ead902440ef1576 |
|
BLAKE2b-256 | 7bd703a5017a7a86db68ff8e36f54a4ae5f42387a6617c5d4dba4373c37c868f |
Hashes for taichi-0.9.2-cp310-cp310-manylinux_2_27_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f07fa80fbaac8e57f763339647257feb7893e3e34f82204f17079c68c16c9e43 |
|
MD5 | a69361226f01e0192c97935b8c10971f |
|
BLAKE2b-256 | 059a9823bdf3e38337ab51662f65ba412799b5f0c16075bc12cbb65174b54115 |
Hashes for taichi-0.9.2-cp310-cp310-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31e7c9bb19a83ee4b11ec38807af8b3196a3dcdc987a0b702e32b31077c1dae9 |
|
MD5 | 256af99fc50ebb974b045dccb64a6d36 |
|
BLAKE2b-256 | 694ad23e8503e6618bb39cc9c5613503d856d4b5ffd5ed75a995de6b8d32d184 |
Hashes for taichi-0.9.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bd1b52fad8911a10ab83e1f7ede920bb25f8eb38a373760446b879b696d3295 |
|
MD5 | 59b74a39f8b51b8b17451bb3117fa522 |
|
BLAKE2b-256 | 5205d9065d033a4deae62f0bd9659cf94b0826e5cea90ff0c2abb03796d4850a |
Hashes for taichi-0.9.2-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f87d37386b40ef949b158aa6e4550911f7b5471b74f418a60c14f2d6399330b |
|
MD5 | f914b5a6cda6d5f70c28c1a46474665a |
|
BLAKE2b-256 | ea0ecc0820bd34df3f8611803d44221cab665ad4773d8408949c1dafc516a11e |
Hashes for taichi-0.9.2-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 936de3ae2e0ef1f5d2a523f2dda9e4a1ddaf017d15211f337d6cc5bc1a6827d2 |
|
MD5 | 2baa928322e2ca7ccd506e56502c0178 |
|
BLAKE2b-256 | de2bca14b15d8465932791a0321394f9bd194c856e89b6264a7f29849b7bc890 |
Hashes for taichi-0.9.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ed1778e53645f228ed06b58de107eea455d2750f9460011521e7abf233b1c14 |
|
MD5 | f8a63a2e12b3d8c62f9b01cc990fe253 |
|
BLAKE2b-256 | 52db02e22ca103caef4f623f2275a185eade66b81fa4a3461b150952b4d2c16d |
Hashes for taichi-0.9.2-cp39-cp39-manylinux_2_27_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ee04cf07cffe63f039284e1863afcf01b01dc55cb8515e653c9f8768f57bbad |
|
MD5 | 516474e1d52f00e010793ed0a5fccbf0 |
|
BLAKE2b-256 | 8120dbe3ab7c32951959465a74f4309037ecebb3fe3ef44c086e4c1cf6425f4f |
Hashes for taichi-0.9.2-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de8e9a15c682010e63ba7ee7d6413ff24e9993e7ee043a8104f4c392775aa632 |
|
MD5 | 94ccaa19f835a0771418f151462ae48d |
|
BLAKE2b-256 | a894246a4b6118113662022826402f3e340437fa2dbd55e0e0f3c5ff96661af9 |
Hashes for taichi-0.9.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 744d5b5fb6887b3627e6f7efe54d366a1ce734fdf5119f7275c267a3849759ed |
|
MD5 | 9e1e4cd277013a7fad8cfefc5d90e6c9 |
|
BLAKE2b-256 | fd00050cd3b4294fb26397070e46956a0db79568db97db8fc19706f8baaaf85d |
Hashes for taichi-0.9.2-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2360e97bce9da8275f525c5ad35ef632f1bb836579167bd373ff6e686c03e180 |
|
MD5 | 23eea14e7a32990abcb9885c32f70e44 |
|
BLAKE2b-256 | 8b2b7a4037ea7634b0cb1e1d4127634340f77187315d87a2000c87e1302e2f9c |
Hashes for taichi-0.9.2-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | abe91f687fa5200b090759c8516562b65e4cc3cac60370372a552e65b5afb7b8 |
|
MD5 | c1f73978522875d22d07fd1e686269e5 |
|
BLAKE2b-256 | 390c4b4b571a0d981c124026492096568526d5242ac72ab4cb9e029cb6453139 |
Hashes for taichi-0.9.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09468f71a399af0c4c020f11e238c64667e82f2480376b40491858c505d76553 |
|
MD5 | 6233a7812c5e9a68700aed69122e7a86 |
|
BLAKE2b-256 | c5d8b11196b1567ca39a5efd48210f0db10c1404a5b3d5808bc1b85a200ebb22 |
Hashes for taichi-0.9.2-cp38-cp38-manylinux_2_27_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64fe6b0c7b278cea82bdcc928e1f08f685b8af63c233e6267f87165156952ac1 |
|
MD5 | 4bcec4c0ad65d029990467b893a22c88 |
|
BLAKE2b-256 | efa080f0501f5ba2c22dff4623d4120c245d8d67aafd5ea6901644102ee68cf7 |
Hashes for taichi-0.9.2-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5b42c5395bc53830cedadc856da9a3e2eea46da9a04388f8cfd4ebafe76b3fe |
|
MD5 | b667fc5a437864e5aa119bb5ca1305f4 |
|
BLAKE2b-256 | 9a63e5f69c12990e852e9c08adeed2934213a7e9ee93a51434214546179f7e10 |
Hashes for taichi-0.9.2-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d92fa99f56b2a59a494f9ffb9187c6fa88903e3622ccfc075408b2cbdf310a75 |
|
MD5 | 8069c541183532a53e85f70deedef324 |
|
BLAKE2b-256 | 77944df96d1f337d61a0671a32e4ac8d8996d0adeaef988a82085322921a10e6 |
Hashes for taichi-0.9.2-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa3cb7eb54729c385be12c8a15d17e213d65691cd3c2a7ff6529cf077197ede0 |
|
MD5 | fde91a6292e31834a4524eb9c5ea6947 |
|
BLAKE2b-256 | 9dce6856f27b0123cbce91d22201e218bd37ada83694a46c090b3b4b02fee059 |
Hashes for taichi-0.9.2-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9427eece58da6bdc748c0e6283550c590a14fd68d6d5dcc35f919b8ccbc70c0a |
|
MD5 | 63df7ef456f2ea4feee8fd1605c8c69b |
|
BLAKE2b-256 | 6768d08dc1ba9feb08db1a262f3c4593ddf73100fc7023f5b7290e6685ee6e83 |
Hashes for taichi-0.9.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ecfa56d442ffb598870c7c80504a41d581bd7d68ab95a974181077d4f562309 |
|
MD5 | 404e6d8f7e51dc25f1c30b56b3311248 |
|
BLAKE2b-256 | 44f12a0088f37ede12083d6fb118b38ffe80ac3daffe81267e061cdc32bfa0e0 |
Hashes for taichi-0.9.2-cp37-cp37m-manylinux_2_27_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e03c3b255b4ba75be10477b9efa7c333e652c2825dcb6024d4ded45ccdc28e0 |
|
MD5 | 11319db6802ea16345d5fe8a6f526083 |
|
BLAKE2b-256 | 8cac5d13787bcf9ecd4700a841c7583c40dd0804228e31dfa05c25ee709555e8 |
Hashes for taichi-0.9.2-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4be43ab00a8dcb749955d5ab8844cd9ba3d6be498204f09c202a634650a8a270 |
|
MD5 | 34c2b84b843c9afd21348e4343574290 |
|
BLAKE2b-256 | 2418be3689553205dd5c7bac4e7a2458fd5079c8678ea703c4c31bbac93c25c3 |
Hashes for taichi-0.9.2-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2060173146c9914ca8b63b8930cb06a545f544c3432daede8697936cebe9c93c |
|
MD5 | b7e18d79c7ce371ba87576d14ba54fb9 |
|
BLAKE2b-256 | 155055d9315775ddb48a0fe5e661db3438473281178064168c05fb51a98abd44 |
Hashes for taichi-0.9.2-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8b2d06f731994edab0ac15a499ead9148227e23e28bef6e5e4c6b520bd8bedc |
|
MD5 | 8ef55650d09d376a309269220fd62f49 |
|
BLAKE2b-256 | 532c1a8dcb78631327b6cdd9c0c2a5e4e9d4b36c0216d26a317c3fcd0660e96a |
Hashes for taichi-0.9.2-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1adaa8633e5c887381f12314bdc953d1fc6f986624898faad0eb89bdd9e6ccb |
|
MD5 | dc15defbe09aa18d3706198c97521918 |
|
BLAKE2b-256 | 9140c6fbe2299cfb9d01dc9e881092cc368c3d118ec9e1d5d1cfe47b6d43323f |
Hashes for taichi-0.9.2-cp36-cp36m-manylinux_2_27_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c717f3fe227fde73057ed88a2f09a9d4ee400eb34af9ab8bc2d53616484aeb60 |
|
MD5 | 941c6f6a53689d33d64e324633d2d76e |
|
BLAKE2b-256 | d81d17529c7a4cc6fab1a1a8d8035faebf7dd449ef0d956cb2a28cf4dd0d2ed9 |
Hashes for taichi-0.9.2-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4c9192d73dfc64f468202542137dd5fc956bd72600cd8147645c41da2a327f6 |
|
MD5 | cd3b1fff6a36e3c12c03a0574d533af9 |
|
BLAKE2b-256 | 7ba6c3b9110abb9f623b49df76c8326aa7f6b81dba28c46569de06f3b1116a7b |
Hashes for taichi-0.9.2-cp36-cp36m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9f9e7b7980cbd902a61912a5dd2027938dcbf88b84b61487770605eac682fae |
|
MD5 | 13fa4f8af9d597bf66cf50017f6f9bb3 |
|
BLAKE2b-256 | 69a76f04e136c49d592f4cffbc215dae4b4cc3add657f2b777563d399adc3252 |
Hashes for taichi-0.9.2-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 709579df2ed16d6da976c432d2e007a95f354f7c6398192d96f669aa3e10cf81 |
|
MD5 | 3d9983daba919f47c0cd0cf762b7a73c |
|
BLAKE2b-256 | 37d3b76cd82935971233ac71d31d5441c32530f5dc4d25fdc29ede186bb5fe4d |