跳转至主要内容

taichi.profiler.scoped_profiler#

taichi.profiler.scoped_profiler.clear_scoped_profiler_info()#

Clear profiler’s records about time elapsed on the host tasks.

Call function imports from C++ : _ti_core.clear_profile_info()

taichi.profiler.scoped_profiler.print_scoped_profiler_info()#

Print time elapsed on the host tasks in a hierarchical format.

This profiler is automatically on.

Call function imports from C++ : _ti_core.print_profile_info()

Example:

>>> import taichi as ti
>>> ti.init(arch=ti.cpu)
>>> var = ti.field(ti.f32, shape=1)
>>> @ti.kernel
>>> def compute():
>>> var[0] = 1.0
>>> print("Setting var[0] =", var[0])
>>> compute()
>>> ti.profiler.print_scoped_profiler_info()