Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactor] Rename tools.util to tools.async_utils and hide functions inside #4201

Merged
merged 2 commits into from
Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions python/taichi/tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .async_utils import *
from .image import imdisplay, imread, imresize, imshow, imwrite
from .np2ply import PLYWriter
from .util import *
# Don't import taichi_logo here which will cause circular import.
# If you need it, just import from taichi.tools.patterns
from .video import VideoManager
Expand All @@ -13,7 +13,4 @@
'imresize',
'imshow',
'imwrite',
'dump_dot',
'dot_to_pdf',
'get_kernel_stats',
]
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ def dot_to_pdf(dot, filepath):

def get_kernel_stats():
return _ti_core.get_kernel_stats()


__all__ = []
3 changes: 2 additions & 1 deletion tests/python/test_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ def inc():
inc()

ti.sync()
assert ti.get_kernel_stats().get_counters()['launched_tasks_list_gen'] <= 2
assert ti.tools.async_utils.get_kernel_stats().get_counters(
)['launched_tasks_list_gen'] <= 2
5 changes: 2 additions & 3 deletions tests/python/test_sfg.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import numpy as np
import pytest

import taichi as ti

Expand All @@ -26,7 +25,7 @@ def init_xy():
init_xy()
ti.sync()

stats = ti.get_kernel_stats()
stats = ti.tools.async_utils.get_kernel_stats()
stats.clear()

@ti.kernel
Expand Down Expand Up @@ -86,7 +85,7 @@ def scatter():
x.from_numpy(xnp)
ti.sync()

stats = ti.get_kernel_stats()
stats = ti.tools.async_utils.get_kernel_stats()
stats.clear()

for _ in range(5):
Expand Down