提交 60459bd7 编写于 作者: M Megvii Engine Team

fix(mge/pytest): remove sync in pytest teardown & add full_sync

GitOrigin-RevId: ee278a8ac10f841c15cf74e086c82af055e2dd7b
上级 c49427d1
......@@ -71,7 +71,7 @@ if sys.platform == "win32":
kernel32.SetErrorMode(old_error_mode)
from .core._imperative_rt.core2 import release_trace_apply_func, sync
from .core._imperative_rt.core2 import release_trace_apply_func, sync, full_sync
from .core._imperative_rt.utils import _set_fork_exec_path_for_timed_func
from .device import *
from .logger import enable_debug_log, get_logger, set_log_file, set_log_level
......
......@@ -736,6 +736,13 @@ void init_tensor(py::module m) {
py_task_q.wait_all_task_finish();
},
py::call_guard<py::gil_scoped_release>());
m.def("full_sync",
[]() {
interpreter_for_py->sync();
CompNode::sync_all();
py_task_q.wait_all_task_finish();
},
py::call_guard<py::gil_scoped_release>());
m.def("release_trace_apply_func", &release_trace_apply_func);
......
......@@ -6,7 +6,3 @@ import pytest
from megengine.core._imperative_rt.core2 import sync
sys.path.append(os.path.join(os.path.dirname(__file__), "helpers"))
def pytest_runtest_teardown():
sync()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册