I had recently some trouble making my pc (ivybridge) use the onboard gpu (intel igpu HD4000) for normal screen display usage, while i run my CUDA programs for computations on the discrete Nvidia GT 640 i have on my machine. The problem was that under iGPU display, CUDA would be unable to spot the nvidia card, and the nvidia drivers would not load at all.
Keep in mind that there are confirmed issues (mostly about concurrency) when using the nvidia windows drivers for display devices, and also want to use CUDA. Those issues can get overridden when you use the Intel gpu as display (thus loading only a minimal part of said Nvidia drivers) and are on many occasions non-existent with nvidia drivers for linux distributions.
After getting in a lot of trouble with bad software like virtu mvp, i found the solution to be really simple, but nowhere to be found.
I post it here in hope that it helps. Please post any comments to make the answers more complete, even if it fails for some pc configurations, so we can clarify the instructions for a wider range of scenarios.