taichi.tools.util

Module Contents

Functions

core_veci(*args)

core_vec(*args)

warning(msg, warning_type=UserWarning, stacklevel=1)

Print warning message

deprecated(old, new, warning_type=DeprecationWarning)

Mark an API as deprecated.

obsolete(old, new)

Mark an API as obsolete. Usage:

get_traceback(stacklevel=1)

set_gdb_trigger(on=True)

print_profile_info()

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

clear_profile_info()

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

dump_dot(filepath=None, rankdir=None, embed_states_threshold=0)

dot_to_pdf(dot, filepath)

get_kernel_stats()

taichi.tools.util.core_veci(*args)
taichi.tools.util.core_vec(*args)
taichi.tools.util.warning(msg, warning_type=UserWarning, stacklevel=1)

Print warning message

Parameters
  • msg (str) – massage to print.

  • warning_type (builtin warning type) – type of warning.

  • stacklevel (int) – warning stack level from the caller.

taichi.tools.util.deprecated(old, new, warning_type=DeprecationWarning)

Mark an API as deprecated.

Parameters
  • old (str) – old method.

  • new (str) – new method.

  • warning_type (builtin warning type) – type of warning.

Example:

>>> @deprecated('ti.sqr(x)', 'x**2')
>>> def sqr(x):
>>>     return x**2
Returns

Decorated fuction with warning message

taichi.tools.util.obsolete(old, new)

Mark an API as obsolete. Usage:

sqr = obsolete(‘ti.sqr(x)’, ‘x**2’)

taichi.tools.util.get_traceback(stacklevel=1)
taichi.tools.util.set_gdb_trigger(on=True)
taichi.tools.util.print_profile_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.print_profile_info()
taichi.tools.util.clear_profile_info()

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

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

taichi.tools.util.dump_dot(filepath=None, rankdir=None, embed_states_threshold=0)
taichi.tools.util.dot_to_pdf(dot, filepath)
taichi.tools.util.get_kernel_stats()