diff --git a/examples/mpm_lagrangian_forces.py b/examples/mpm_lagrangian_forces.py index d73b3deba8f3a..7c8a844d92441 100644 --- a/examples/mpm_lagrangian_forces.py +++ b/examples/mpm_lagrangian_forces.py @@ -1,7 +1,7 @@ import taichi as ti import numpy as np -ti.init(arch=ti.gpu, kernel_profiler=True) +ti.init(arch=ti.gpu) dim = 2 quality = 1 # Use a larger integral number for higher quality diff --git a/python/taichi/lang/__init__.py b/python/taichi/lang/__init__.py index 5f1b50efa7eda..8c6c35c76973b 100644 --- a/python/taichi/lang/__init__.py +++ b/python/taichi/lang/__init__.py @@ -32,7 +32,6 @@ 'a.normalized()')(Matrix.normalized) cfg = default_cfg() -current_cfg = current_cfg() x86_64 = core.x64 x64 = core.x64 arm64 = core.arm64 diff --git a/python/taichi/misc/util.py b/python/taichi/misc/util.py index dc8bc1969af53..ac08ae4459250 100644 --- a/python/taichi/misc/util.py +++ b/python/taichi/misc/util.py @@ -278,6 +278,24 @@ def get_kernel_stats(): return ti_core.get_kernel_stats() +def print_async_stats(include_kernel_profiler=False): + import taichi as ti + if include_kernel_profiler: + ti.kernel_profiler_print() + print() + stat = ti.get_kernel_stats() + counters = stat.get_counters() + print('=======================') + print('Async benchmark metrics') + print('-----------------------') + print(f'Async mode: {ti.current_cfg().async_mode}') + print(f'Kernel time: {ti.kernel_profiler_total_time():.3f} s') + print(f'Tasks launched: {int(counters["launched_tasks"])}') + print(f'Instructions emitted: {int(counters["codegen_statements"])}') + print(f'Tasks compiled: {int(counters["codegen_offloaded_tasks"])}') + print('=======================') + + __all__ = [ 'vec', 'veci',