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

**URL:** <https://numba.discourse.group/t/closing-resetting-a-device-then-re-using-within-a-notebook/1049>\
**Category:** Support: What is this error message?\
**Created:** [December 2, 2021, 1:58pm UTC](https://numba.discourse.group/t/closing-resetting-a-device-then-re-using-within-a-notebook/1049 "2021-12-02T13:58:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![crasse](https://avatars.discourse-cdn.com/v4/letter/c/ea666f/32.png) [@crasse](https://numba.discourse.group/u/crasse)\
**Post date:** [December 2, 2021, 1:58pm UTC](https://numba.discourse.group/t/closing-resetting-a-device-then-re-using-within-a-notebook/1049/1 "2021-12-02T13:58:02Z")

</div>

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 :

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

```

which gives me :

```auto
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 ?
