Frequently asked questions¶
Q: Installing Taichi with
package not found.
A: Is your Python version >= 3.6, and 64-bit? See Troubleshooting.
Q: Do we have something like
A: No, but you may use
numpy.pi instead. Taichi is able to bake in these constants during JIT, so your kernels incur no runtime cost.
Q: How do I force an outermost loop to be serial, i.e. not parallelized?
A: Try this trick:
for _ in range(1): # I'm the outer-most loop! for i in range(100): # This loop will not be parallelized ...
Q: What’s the most convenient way to load images / textures into Taichi fields?
A: Simply use
Q: Can Taichi co-operate with other Python packages like
A: Yes, as long as that package provides an interface with
numpy, see Interacting with other Python packages.
Q: Can we dynamically create fields within kernel / after kernel invocation?
- A: Sorry, we don’t support it yet. Try allocating a large enough field
- in advance to walkaround.
Q: Shall we add some handy functions like
A: No, but we provide them in an extension library Taichi GLSL , install it using:
python -m pip install taichi_glsl
Q: How can I render 3D results without writing a ray tracer myself?
- A: You may export it with Export PLY files so that you could view it in Houdini or Blender.
- Or make use of the extension library Taichi THREE to render images and update to GUI in real-time. Or make use of our Blender addon Taichi Blend to update meshes to Blender and make physically-based animations.
Q: How do I declare a field with dynamic length?
- A: What you want may be the
dynamicSNode, a kind of sparse field, see Working with dynamic SNodes.
- Or simply allocate a dense field large enough, and another 0-D field
field_len[None]for length record. But in fact, the
dynamicSNode could be slower than the latter solution, due to the cost of maintaining the sparsity information.
Q: Can a user iterate over irregular topologies (e.g., graphs or tetrahedral meshes) instead of regular grids?
- A: These structures have to be represented using 1D arrays in Taichi. You can still iterate over them using
for i in xor
for i in range(n).
- However, at compile time, there’s little the Taichi compiler can do for you to optimize it. You can still tweak the data layout to get different runtime cache behaviors and performance numbers.