It has come to my attention that Nvidia recently released a new video driver that is causing widespread problems. 397.31 seems to cause the GPU to become inaccessible to both CUDA and OpenCL programs after a while, and can only be reset by rebooting the computer. It's likely this affects all BOINC projects and not just PrimeGrid. Indeed, it probably affects all GPU programs, even those that don't run under BOINC. There's a newer, hotfix driver 397.55 which seems to correct the problem. I strongly recommend either upgrading to 397.55 or rolling back to a driver earlier than 397.31.
More information can be found here.
My lucky number is 75898524288+1