Skip to content

Commit

Permalink
nit
Browse files Browse the repository at this point in the history
  • Loading branch information
archibate committed Jul 31, 2020
1 parent 35d5450 commit 1e86b20
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
22 changes: 11 additions & 11 deletions docs/hello.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,13 @@ Running the Taichi code below (``python3 fractal.py`` or ``ti example fractal``)
Let's dive into this simple Taichi program.


import taichi as ti
-------------------

Taichi is a domain-specific language (DSL) embedded in Python. To make Taichi as easy to use as a Python package,
we have done heavy engineering with this goal in mind - letting every Python programmer write Taichi programs with
minimal learning effort. You can even use your favorite Python package management system, Python IDEs and other
Python packages in conjunction with Taichi.


Portability
-----------

Expand Down Expand Up @@ -109,27 +106,30 @@ Tensors
-------

Taichi is a data-oriented programming language where dense or spatially-sparse tensors are the first-class citizens.

See :ref:`sparse` for more details on sparse tensors.
See :ref:`scalar_tensor` for more details on tensors.

In the code above, ``pixels = ti.var(dt=ti.f32, shape=(n * 2, n))`` allocates a 2D dense tensor named ``pixels`` of
size ``(640, 320)`` and element data type ``ti.f32`` (i.e. ``float`` in C).


Functions and kernels
---------------------

Computation resides in Taichi **kernels**, which is defined with the decorator ``@ti.kernel``.
Computation resides in Taichi **kernels** and Taichi **functions**.

Taichi **kernels** are defined with the decorator ``@ti.kernel``.
Kernel arguments must be type-hinted (if any).
The language used in Taichi kernels and functions looks exactly like Python, yet the Taichi frontend compiler converts it
into a language that is **compiled, statically-typed, lexically-scoped, parallel and differentiable**.

Taichi **functions** are defined with the decorator ``@ti.func``.
They can be called by Taichi kernels and other Taichi functions.
They can be called by Taichi kernels or other Taichi functions.

The language used in Taichi kernels and functions looks exactly like Python, yet the Taichi frontend compiler converts it into a language that is **compiled, statically-typed, lexically-scoped, parallel and differentiable**.

.. note::

**Taichi-scopes v.s. Python-scopes**: everything decorated with ``@ti.kernel`` and ``@ti.func`` is in Taichi-scope and hence will be compiled by the Taichi compiler.
**Taichi-scopes v.s. Python-scopes**:

Everything decorated with ``@ti.kernel`` and ``@ti.func`` is in Taichi-scope
and hence will be compiled by the Taichi compiler.

Everything else is in Python-scopes. They are simply Python native code.

Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ The Taichi Programming Language
meta
layout
sparse
offset
differentiable_programming
odop
compilation
offset
syntax_sugars


Expand Down
2 changes: 1 addition & 1 deletion docs/syntax.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Kernel arguments must be type-hinted:
.. code-block:: python
@ti.kernel
def my_kernel(x: ti.i32, y: ti.f64):
def my_kernel(x: ti.i32, y: ti.f32):
print(x + y)
my_kernel(2, 3.3) # prints: 5.3
Expand Down
4 changes: 2 additions & 2 deletions docs/type.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ Type promotion
Binary operations on different types will give you a promoted type, following the C programming language convention, e.g.:

- ``i32 + f32 = f32`` (integer + float = float)
- ``i32 + i64 = i64`` (less-bits + more-bits = lamore-bits)
- ``i32 + i64 = i64`` (less-bits + more-bits = more-bits)

Basically it will try to choose the least precise type to contain the result value.
Basically it will try to choose the more precise type to contain the result value.


.. _default_precisions:
Expand Down

0 comments on commit 1e86b20

Please sign in to comment.