Skip to content
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: 5 additions & 0 deletions numba_cuda/numba/cuda/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,11 @@ def close():
Explicitly clears all contexts in the current thread, and destroys all
contexts if the current thread is the main thread.
"""
# Must clear memsys object in case it has been used already
from .memory_management import rtsys

rtsys.close()

devices.reset()


Expand Down
8 changes: 8 additions & 0 deletions numba_cuda/numba/cuda/memory_management/nrt.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,18 @@ def __new__(cls, *args, **kwargs):

def __init__(self):
"""Initialize memsys module and variable"""
self._reset()

def _reset(self):
"""Reset to the uninitialized state"""
self._memsys_module = None
self._memsys = None
self._initialized = False

def close(self):
"""Close and reset"""
self._reset()

def _compile_memsys_module(self):
"""
Compile memsys.cu and create a module from it in the current context
Expand Down
Loading