Perhaps as a last resort you could use nvidia-smi --gpu-reset -i <ID>
to reset specific processes associated with the GPU ID. In Jupyter notebook you should be able call it by using the os
library. Nevertheless, the documentation of nvidia-smi
states that the GPU reset is not guaranteed to work in all cases.
You may want to visit this other post before doing anything with this command-line tool: What does the command "nvidia-smi --gpu-reset" do?