CUDA deviceQuery fails on Ubuntu 18.04: cudaGetDeviceCount returned 101

OS: Ubuntu 18.04.3
GPU: NVIDIA Quadro P2000

Installing GPU driver and CUDA worked last week. This week CUDA no longer works. The deviceQuery script fails with the following error:

./deviceQuery Starting...

 CUDA Device Query (Runtime API) version (CUDART static linking)

cudaGetDeviceCount returned 101
-> invalid device ordinal
Result = FAIL

I believe Ubuntu installed some system updates this week which could perhaps have caused the problem?

More system information:

$ uname -m
x86_64

$ lspci | grep -i nvidia
01:00.0 VGA compatible controller: NVIDIA Corporation GP107GLM [Quadro P2000 Mobile] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GP107GL High Definition Audio Controller (rev a1)

$ gcc --version
gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ uname -r
5.0.0-36-generic

$ sudo apt-get install linux-headers-$(uname -r)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
linux-headers-5.0.0-36-generic is already the newest version (5.0.0-36.39~18.04.1).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

OS: Ubuntu 20.04.6 LTS"
GPU: NVIDIA GeForce GTX 1070
jag@Aigen:~/codes/cuda-samples-master/bin/x86_64/linux/release$ ./bandwidthTest

[CUDA Bandwidth Test] - Starting…
Running on…
cudaGetDeviceProperties returned 802
→ system not yet initialized
CUDA error at bandwidthTest.cu:256 code=802(cudaErrorSystemNotReady) “cudaSetDevice(currentDevice)”