Skip to content

Commit

Permalink
[misc] Update documentations after the examples directory changed (#3587
Browse files Browse the repository at this point in the history
)

* [misc] Update the documentation after the examples directory changed

* update path of laplace.py

* revert readme.md

* endline
  • Loading branch information
Velaciela committed Nov 22, 2021
1 parent 9c8f0eb commit 78fba54
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 23 deletions.
8 changes: 4 additions & 4 deletions docs/lang/articles/advanced/differentiable_programming.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ print('dy/dx =', x.grad[None], ' at x =', x[None])
A common problem in physical simulation is that it's usually easy to compute
energy but hard to compute force on every particle,
e.g [Bond bending (and torsion) in molecular dynamics](https://github.com/victoriacity/taichimd/blob/5a44841cc8dfe5eb97de51f1d46f1bede1cc9936/taichimd/interaction.py#L190-L220)
and [FEM with hyperelastic energy functions](https://github.com/taichi-dev/taichi/blob/master/examples/simulation/fem128.py).
and [FEM with hyperelastic energy functions](https://github.com/taichi-dev/taichi/blob/master/python/taichi/examples/simulation/fem128.py).
Recall that we can differentiate
(negative) potential energy to get forces: `F_i = -dU / dx_i`. So once you have coded
a kernel that computes the potential energy, you may use Taichi's autodiff
system to obtain the derivatives and then `F_i` on each particle.

Take
[examples/simulation/ad_gravity.py](https://github.com/taichi-dev/taichi/blob/master/examples/simulation/ad_gravity.py)
[examples/simulation/ad_gravity.py](https://github.com/taichi-dev/taichi/blob/master/python/taichi/examples/simulation/ad_gravity.py)
as an example:

```python
Expand Down Expand Up @@ -158,9 +158,9 @@ start up.

:::tip
See
[examples/simulation/mpm_lagrangian_forces.py](https://github.com/taichi-dev/taichi/blob/master/examples/simulation/mpm_lagrangian_forces.py)
[examples/simulation/mpm_lagrangian_forces.py](https://github.com/taichi-dev/taichi/blob/master/python/taichi/examples/simulation/mpm_lagrangian_forces.py)
and
[examples/simulation/fem99.py](https://github.com/taichi-dev/taichi/blob/master/examples/simulation/fem99.py)
[examples/simulation/fem99.py](https://github.com/taichi-dev/taichi/blob/master/python/taichi/examples/simulation/fem99.py)
for examples on using autodiff-based force evaluation MPM and FEM.
:::

Expand Down
2 changes: 1 addition & 1 deletion docs/lang/articles/advanced/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ the target architecture. Nevertheless, for Ninjas who strive for the last few %
of performance, we also provide some APIs to allow developers fine-tune their
applications. For example, specifying a suitable `ti.block_dim` could yield an almost
3x performance boost in
[examples/mpm3d.py](https://github.com/taichi-dev/taichi/blob/master/examples/mpm3d.py).
[examples/mpm3d.py](https://github.com/taichi-dev/taichi/blob/master/python/taichi/examples/mpm3d.py).

:::note
For **performance profiling** utilities, please see [Profiler section of the Contribution Guide](../misc/profiler.md).
Expand Down
2 changes: 1 addition & 1 deletion docs/lang/articles/advanced/sparse.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ block2 = block1.pointer(ti.ij, 4)
block3 = block2.pointer(ti.ij, 4)
block3.dense(ti.ij, 4).place(x)
```
[[Full source code of this animation]](https://github.com/taichi-dev/taichi/blob/master/examples/features/sparse/taichi_sparse.py)
[[Full source code of this animation]](https://github.com/taichi-dev/taichi/blob/master/python/taichi/examples/features/sparse/taichi_sparse.py)

Intuitively, a sparse grid in Taichi allows you to use memory space more wisely, since only tree nodes involved in computation are allocated.
Now, let's take a step back and think about *why we need sparse grids, how to define them in Taichi, and how to compute on these data structures*.
Expand Down
4 changes: 2 additions & 2 deletions docs/lang/articles/advanced/sparse_matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,5 +184,5 @@ print(f">>>> Computation was successful?: {isSuccess}")
## Examples

Please have a look at our two demos for more information:
+ [Stable fluid](https://github.com/taichi-dev/taichi/blob/master/examples/simulation/stable_fluid.py): A 2D fluid simulation using a sparse Laplacian matrix to solve Poisson's pressure equation.
+ [Implicit mass spring](https://github.com/taichi-dev/taichi/blob/master/examples/simulation/implicit_mass_spring.py): A 2D cloth simulation demo using sparse matrices to solve the linear systems.
+ [Stable fluid](https://github.com/taichi-dev/taichi/blob/master/python/taichi/examples/simulation/stable_fluid.py): A 2D fluid simulation using a sparse Laplacian matrix to solve Poisson's pressure equation.
+ [Implicit mass spring](https://github.com/taichi-dev/taichi/blob/master/python/taichi/examples/simulation/implicit_mass_spring.py): A 2D cloth simulation demo using sparse matrices to solve the linear systems.
2 changes: 1 addition & 1 deletion docs/lang/articles/contribution/contributor_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ Frequently used tags:
- `[Refactor]`: code refactoring;
- `[CLI]`: commandline interfaces, e.g., the `ti` command;
- `[Doc]`: documentation under [docs/](https://github.com/taichi-dev/taichi/blob/master/docs/);
- `[Example]`: examples under [examples/](https://github.com/taichi-dev/taichi/blob/master/examples/);
- `[Example]`: examples under [examples/](https://github.com/taichi-dev/taichi/blob/master/python/taichi/examples/);
- `[Test]`: tests under [tests/](https://github.com/taichi-dev/taichi/blob/master/tests/);
- `[Linux]`: Linux platform;
- `[Mac]`: macOS platform;
Expand Down
2 changes: 1 addition & 1 deletion docs/lang/articles/contribution/dev_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ See [development mode](https://setuptools.pypa.io/en/stable/userguide/developmen
:::

2. Check out the `examples` folder for runnable examples. Run them with commands
like `python3 examples/simulation/mpm128.py`.
like `python3 python/taichi/examples/simulation/mpm128.py`.

3. Execute `python3 -m taichi test` to run all the tests. It may take
up to 5 minutes to run all tests.
Expand Down
2 changes: 1 addition & 1 deletion docs/lang/articles/misc/export_kernels.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Linux. In the future, we will support macOS and Windows.
Use `ti.core.start_recording` in the Taichi program you want to export.

Suppose you want to export
[examples/mpm88.py](https://github.com/taichi-dev/taichi/blob/master/examples/mpm88.py),
[examples/mpm88.py](https://github.com/taichi-dev/taichi/blob/master/python/taichi/examples/mpm88.py),
here is the workflow:

### Export YAML
Expand Down
4 changes: 2 additions & 2 deletions docs/lang/articles/misc/ggui.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ You also need to install the Vulkan environment: [https://vulkan.lunarg.com/sdk/

A new UI system has been added to Taichi in version `v0.8.0`. The new GUI system uses GPU for rendering, enabling it to be much faster and to render 3d scenes. For these reasons, this new system is sometimes referred to as GGUI. This doc describes the APIs provided.

Apart from this doc, a good way of getting familiarized with GGUI is to look at the examples. Please checkout the examples provided in [`examples/ggui_examples`](https://github.com/taichi-dev/taichi/tree/master/examples/ggui_examples).
Apart from this doc, a good way of getting familiarized with GGUI is to look at the examples. Please checkout the examples provided in [`examples/ggui_examples`](https://github.com/taichi-dev/taichi/tree/master/python/taichi/examples/ggui_examples).

## Creating a window

Expand Down Expand Up @@ -145,7 +145,7 @@ To check if a specific key is currently pressed:



Here is an input processing example in GGUI version [`mpm128`](https://github.com/taichi-dev/taichi/blob/master/examples/ggui_examples/mpm128_ggui.py):
Here is an input processing example in GGUI version [`mpm128`](https://github.com/taichi-dev/taichi/blob/master/python/taichi/examples/ggui_examples/mpm128_ggui.py):

```python
while window.running:
Expand Down
16 changes: 8 additions & 8 deletions misc/examples.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# More examples

<a href="https://github.com/taichi-dev/taichi/blob/master/examples/simulation/mpm_lagrangian_forces.py"><img src="https://github.com/taichi-dev/public_files/raw/master/taichi/lagrangian.gif" height="192px"></a>
<a href="https://github.com/taichi-dev/taichi/blob/master/examples/features/sparse/taichi_sparse.py"><img src="https://github.com/taichi-dev/public_files/raw/master/taichi/sparse_grids.gif" height="192px"></a>
<a href="https://github.com/taichi-dev/taichi/blob/master/examples/simulation/pbf2d.py"><img src="https://github.com/taichi-dev/public_files/raw/master/taichi/pbf.gif" height="192px"></a>
<a href="https://github.com/taichi-dev/taichi/blob/master/examples/simulation/game_of_life.py"><img src="https://github.com/taichi-dev/public_files/raw/master/taichi/game_of_life.gif" height="192px"></a>
<a href="https://github.com/taichi-dev/taichi/blob/master/python/taichi/examples/simulation/mpm_lagrangian_forces.py"><img src="https://github.com/taichi-dev/public_files/raw/master/taichi/lagrangian.gif" height="192px"></a>
<a href="https://github.com/taichi-dev/taichi/blob/master/python/taichi/examples/features/sparse/taichi_sparse.py"><img src="https://github.com/taichi-dev/public_files/raw/master/taichi/sparse_grids.gif" height="192px"></a>
<a href="https://github.com/taichi-dev/taichi/blob/master/python/taichi/examples/simulation/pbf2d.py"><img src="https://github.com/taichi-dev/public_files/raw/master/taichi/pbf.gif" height="192px"></a>
<a href="https://github.com/taichi-dev/taichi/blob/master/python/taichi/examples/simulation/game_of_life.py"><img src="https://github.com/taichi-dev/public_files/raw/master/taichi/game_of_life.gif" height="192px"></a>

<a href="https://github.com/taichi-dev/taichi/blob/master/examples/simulation/fem128.py"><img src="https://github.com/taichi-dev/public_files/raw/master/taichi/fem128.gif" height="192px"></a>
<a href="https://github.com/taichi-dev/taichi/blob/master/examples/simulation/mass_spring_3d.py"><img src="https://github.com/taichi-dev/public_files/raw/master/taichi/mass_spring_3d.gif" height="192px"></a>
<a href="https://github.com/taichi-dev/taichi/blob/master/examples/algorithm/mciso_advanced.py"><img src="https://github.com/taichi-dev/public_files/raw/master/taichi/mciso.gif" height="192px"></a>
<a href="https://github.com/taichi-dev/taichi/blob/master/examples/simulation/mpm3d.py"><img src="https://github.com/taichi-dev/public_files/raw/master/taichi/mpm3d.gif" height="192px"></a>
<a href="https://github.com/taichi-dev/taichi/blob/master/python/taichi/examples/simulation/fem128.py"><img src="https://github.com/taichi-dev/public_files/raw/master/taichi/fem128.gif" height="192px"></a>
<a href="https://github.com/taichi-dev/taichi/blob/master/python/taichi/examples/simulation/mass_spring_3d.py"><img src="https://github.com/taichi-dev/public_files/raw/master/taichi/mass_spring_3d.gif" height="192px"></a>
<a href="https://github.com/taichi-dev/taichi/blob/master/python/taichi/examples/algorithm/mciso_advanced.py"><img src="https://github.com/taichi-dev/public_files/raw/master/taichi/mciso.gif" height="192px"></a>
<a href="https://github.com/taichi-dev/taichi/blob/master/python/taichi/examples/simulation/mpm3d.py"><img src="https://github.com/taichi-dev/public_files/raw/master/taichi/mpm3d.gif" height="192px"></a>
2 changes: 1 addition & 1 deletion misc/windows_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def set_env(**kwargs):
r'msbuild /p:Configuration=RelWithDebInfo /p:Platform=x64 /m taichi.sln')
os.chdir(repo_dir)
execute_cmd('%PYTHON% -c "import taichi"')
execute_cmd('%PYTHON% examples/laplace.py')
execute_cmd('%PYTHON% python/taichi/examples/algorithm/laplace.py')
execute_cmd('%PYTHON% bin/taichi test')
os.chdir(os.path.join(repo_dir, 'python'))
execute_cmd('%PYTHON% build.py try_upload')
2 changes: 1 addition & 1 deletion python/taichi/diagnose.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def try_print(tag, expr):
ti_laplace = subprocess.check_output(
[executable, '-m', 'taichi', 'example', 'minimal'])
except Exception as e:
print(f'`examples/laplace.py` failed: {e}')
print(f'`python/taichi/examples/algorithm/laplace.py` failed: {e}')
else:
print(f'{ti_laplace.decode()}')

Expand Down

0 comments on commit 78fba54

Please sign in to comment.