Driver 396.37 + GeForce MX150 + 4.15.0-33-generic doesn't work

I have an HP Envy with a GeForce MX150. I was able to get an earlier version of the nVidia driver working; glmark2 would report about double the score of the nouveau driver that comes with Kubuntu by default.

Then I tried to install CUDA 9.2 and had lots of problems. (I read that MX150 won’t work with anything before 9.2 so couldn’t use an earlier version.) 9.2 supposedly needed a later version of the driver, so I installed the latest driver, then ran the deb file cuda-repo-ubuntu1710-9-2-local_9.2.148-1_amd64.deb. The program crashed and seemed to have a conflict with the version of the driver already there. So I removed the old driver, removed whatever CUDA stuff was partially installed by the failed installation, then reran the deb file, which appeared to install its preferred version (396.37) and seemed to be happy.

It seems that CUDA now works for pure computation. Sample programs like 0_Simple/matrixMul report that they pass. But any program that attempts to open a graphics window, such as 5_Simulations/nbody, crashes as soon as the window pops up, with the message

CUDA error at bodysystemcuda_impl.h:183 code=30(cudaErrorUnknown) “cudaGraphicsGLRegisterBuffer(&m_pGRes[i], m_pbo[i], cudaGraphicsMapFlagsNone)”

Furthermore, glmark2 now reports horrendous scores (around 200, vs. 4600 for the first 390 driver I installed, or 1700 for the CPU’s integrated graphics).

This may have been due to a mismatch between CUDA and the driver. The CUDA deb installer installed its own version of the driver but the distro-installed driver was still around. I went through the steps I outlined in and now it works (both by getting good glmark2 scores and having graphics CUDA apps like nbody work.

So either 396.37 was bad and 396.54 fixed the bug, or the old installation was faulty. Either way, it works now.