Coder Social home page Coder Social logo

lij131 / taichi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from taichi-dev/taichi

0.0 0.0 0.0 43.15 MB

Productive & portable high-performance programming in Python.

Home Page: https://docs.taichi.graphics

License: MIT License

CMake 0.72% Python 33.05% C++ 64.17% C 0.72% Cuda 0.43% Makefile 0.02% Shell 0.37% GLSL 0.44% PowerShell 0.09%

taichi's Introduction


Latest Release downloads CI Docker Cloud Build Status Python Codecov Status

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.

...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 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

Contact us

You can also join our community from Slack or WeChat. Drop us a message at [email protected] first, and we'll follow up.

Reference

Demos

Lectures & talks

Citations

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

taichi's People

Contributors

aekul avatar ailzhang avatar amesingflank avatar archibate avatar bachili avatar billxu2000 avatar bobcao3 avatar erizmr avatar fantasyvr avatar frostming avatar g1n0st avatar ghuau-innopeak avatar hanke98 avatar k-ye avatar leonz5288 avatar lin-hitonami avatar ljcc0930 avatar mzmzm avatar pgzxb avatar qiao-bo avatar rexwangcc avatar rullec avatar sjwsl avatar squarefk avatar strongoier avatar taichi-gardener avatar th3charlie avatar xumingkuan avatar yolo2themoon avatar yuanming-hu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.