Getting the nvidia-346 drivers to cooperate with CUDA on Linux Mint

UPDATE: As of March 17th, Nvidia’s repository has been updated to support the 346 driver, alongside the release of the Cuda 7 toolkit.

——————————————————————————–

I recently discovered that FFmpeg added support for the NVENC encoder and thought it would be interesting to play around with. Turns out, that ended up taking a lot more work than I anticipated and it wasn’t FFmpeg’s fault. The beginning of my trouble is that NVENC support was only added to the Linux driver in version 346.16. However, the Ubuntu/Mint repository’s newest offering is 331.113. Fortunately, the xorg-edgers ppa has newer drivers available (refer to the launchpad page), so that turns out to not be much of an issue.

$ sudo apt-add-repository ppa:xorg-edgers/ppa && sudo apt-get update
$ sudo apt-get install nvidia-346 nvidia-346-dev nvidia-346-uvm libcuda1-346 nvidia-libopencl1-346 nvidia-icd-346

Now for the CUDA installation. The download page has two options: a standalone installer and a package repository.

For whatever reason, I tried the standalone installer first (currently toolkit version 6.5.14). I’m not going to go into too much detail, because it didn’t work (if you just want to know what did work, then skip the next bit). It installed fine though. I went into the samples and found 1_Utilities/deviceQuery, a suitable program to test my installation. It compiled fine. Then, this happened:

$ ./deviceQuery
./deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
cudaGetDeviceCount returned 35
-> CUDA driver version is insufficient for CUDA runtime version
Result = FAIL

Well, that doesn’t really make sense. The installer is bundled with driver version 340.29, which I declined to install. But, a newer driver is supposed to be fine. What gives? I also tried toolkit version 6.5.19 to no avail. Next, I thought that since I have a sample compiled, I just need the runtime, so I removed the toolkit. That didn’t help either.

$ ./deviceQuery
./deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
cudaGetDeviceCount returned 30
-> unknown error
Result = FAIL

Hooray! An even more ambiguous error. Fine, time to try the repository instead. Repositories always make things easy, right?

Continue reading