We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0d61113 commit cb7050cCopy full SHA for cb7050c
python/tvm/__init__.py
@@ -18,6 +18,10 @@
18
"""TVM: Low level DSL/IR stack for tensor computation."""
19
from __future__ import absolute_import as _abs
20
21
+import multiprocessing
22
+import sys
23
+import traceback
24
+
25
from . import _pyversion
26
27
from . import tensor
@@ -59,3 +63,13 @@
59
63
60
64
# Contrib initializers
61
65
from .contrib import rocm as _rocm, nvcc as _nvcc, sdaccel as _sdaccel
66
67
+# Clean subprocesses when TVM is interrupted
68
+def tvm_excepthook(exctype, value, trbk):
69
+ print('\n'.join(traceback.format_exception(exctype, value, trbk)))
70
+ if hasattr(multiprocessing, 'active_children'):
71
+ # pylint: disable=not-callable
72
+ for p in multiprocessing.active_children():
73
+ p.terminate()
74
75
+sys.excepthook = tvm_excepthook
0 commit comments