Closing/resetting a device then re-using within a notebook

Hi There !

i’m sorry if this been asked many times (i’m on it since yesterday and crawled on google since then :x )

I’m trying to vaccum clean VRAM on a small cuda device within a notebook, and then re-using it (reloading a model in it right after resetting it) but unfortunately i got this error each time :

RuntimeError: CUDA error: invalid argument

to be more detailed here is what I do :

device = numba.cuda.get_current_device()
device.reset()
torch.cuda.is_available()
numba.cuda.detect()

which gives me :

Found 1 CUDA devices
id 0    'GeForce GTX 1080 Ti'                              [SUPPORTED]
                      Compute Capability: 6.1
                      PCI Device ID: 0
                      PCI Bus ID: 1
                      Watchdog: Enabled
                      FP32/FP64 Performance Ratio: 32
Summary:
	1/1 devices are supported

then I do :

cuda.select_device(0)

and try to load again my model in it but got the

RuntimeError: CUDA error: invalid argument

So is it possible to reset a device and re-use within a notebook process ?