Solve cuInit: CUDA_ERROR_UNKNOWN: unkown error

Cryptography and Machine Learning enthusiast and paranoid about performance without sacrificing readability.
Steps
Enable the following services in
systemd:nvidia-suspend.servicenvidia-resume.servicenvidia-hibernate.service
Enable via sudo systemctl enable <service name>.
Create a file named
/etc/modprobe.d/nvidia-suspend.conf.Add the following line to the file:
options nvidia NVreg_PreserveVideoMemoryAllocations=1Reboot
This shall prevent the cuInit: CUDA_ERROR_UNKNOWN: unknown error.
If that does not work
Execute the following:
sudo modprobe -r nvidia_uvm # or: sudo rmmod nvidia_uvm
sudo modprobe nvidia_uvm




