Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanming-hu committed Dec 17, 2019
1 parent c97c87b commit 02f5bfd
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions docs/hello.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ Taichi is an embedded domain-specific language (DSL) in Python.
It pretends to be a plain Python package, although heavy engineering has been done to make this happen.

This design decision virtually makes every Python programmer capable of writing Taichi programs, after minimal learning efforts.
You can also reuse the package management system, Python IDEs, and existing Python pcakges.
You can also reuse the package management system, Python IDEs, and existing Python packages.

Portability
-----------------
By default, Taichi supports both CPUs and NVIDIA GPUs.

Taichi supports both CPUs and NVIDIA GPUs.

.. code-block:: python
Expand Down Expand Up @@ -100,15 +101,15 @@ You can also define Taichi **functions** with ``ti.func``, which can be called a

.. note::

**Taichi-scope v.s. Python-scope**: everything decorated by ``ti.kernel`` and ``ti.func`` is in Taichi-scope, which will be compiled by the Taichi compiler.
Code outside the Taichi-scopes are just normal Python code.
**Taichi-scope v.s. Python-scope**: everything decorated with ``ti.kernel`` and ``ti.func`` is in Taichi-scope, which will be compiled by the Taichi compiler.
Code outside the Taichi-scopes is simply native Python code.

.. warning::

Taichi kernels must be called in the Python-scope. I.e., **nested Taichi kernels are not supported**.
Nested functions that are allowed. **Recursive functions are not supported for now**.

Taichi functions can be called in Taichi-scope only.
Taichi functions can only be called in Taichi-scope.

For those who came from the world of CUDA, ``ti.func`` corresponds to ``__device__``, and ``ti.kernel`` corresponds to ``__global__``.

Expand Down Expand Up @@ -149,7 +150,7 @@ In the fractal code above, ``for i, j in pixels`` loops over all the pixel coord
Interacting with Python
------------------------

Everything outside Taichi-scope (``ti.func`` and ``ti.kernel``) is simply Python. You can use your favourite Python packages (e.g. ``numpy``, ``pytorch``, ``matplotlib``) with Taichi.
Everything outside Taichi-scope (``ti.func`` and ``ti.kernel``) is simply Python. You can use your favorite Python packages (e.g. ``numpy``, ``pytorch``, ``matplotlib``) with Taichi.

In Python-scope, you can access Taichi tensors using plain indexing syntax, and helper functions such as ``from_numpy`` and ``to_torch``:

Expand Down

0 comments on commit 02f5bfd

Please sign in to comment.