If PyTorch with its CUDA runtime was working and suddenly stopped, an unwanted driver update might have been executed by your OS, which might have broken the installation (as @KFrank also mentioned).
I usually disable Ubuntu’s driver updates for CUDA/NVIDIA, since it has already broken my installation a couple of times without any warning.
The best advice I would have at this time would be to check for all NVIDIA driver installations, remove different versions, and stick to the latest one.