Why does my
package not found when installing Taichi?#
You may have a Python interpreter with an unsupported version. Currently, Taichi only supports Python 3.6/3.7/3.8 (64-bit) . For more information about installation related issues, please check Installation Troubleshooting.
Does Taichi provide built-in constants such as
There is no built-in constant such as
pi. We recommended using
A solution is to add an additional ghost loop with only one iteration outside the loop you want to serialize.
for _ in range(1): # This "ghost" loop will be "parallelized", but with only one thread. Therefore, the containing loop below is serialized. for i in range(100): # The loop you want to serialize ...
One feasible solution is
Can Taichi interact with other Python packages such as
Yes, Taichi supports various popular Python packages. Please check out Interacting with other Python packages.
dynamic SNode supports variable-length fields. It acts similarly to
std::vector in C++ or
list in Python.
An alternative solution is to allocate a large enough
dense field, with a corresponding 0-D field
field_len[None] tracking its length. In practice, programs allocating memory using
SNodes may be less efficient than using
dense SNodes, due to dynamic data structure
These structures have to be decomposed into 1D Taichi fields. For example, when representing a graph, you can allocate two fields, one for the vertices and the other for the edges. You can then traverse the elements using
for v in vertices or
for v in range(n).