deviceQuery program is failing (Ubuntu 16.04, Cuda 8.0, nvidia-370)

I just installed cuda 8.0 and compiled the samples.
However when i’m trying to run “1_Utilities/deviceQuery/deviceQuery” it fails with the following message :

cudaGetDeviceCount returned 30
-> unknown error
Result = FAIL

When i run ‘nvidia-smi’ i get normal output, means the gpu is identified correctly.

For the same reason i also can’t run caffe tests :
first i get these warnings

E1110 13:11:53.653498 29632 common.cpp:102] Cannot create Cublas handle. Cublas won't be available.
E1110 13:11:53.656040 29632 common.cpp:109] Cannot create Curand generator. Curand won't be available.
E1110 13:11:53.656107 29632 common.cpp:129] Curand not available. Skipping setting the curand seed.

and later it fails with the message :

F1110 13:11:53.802338 29632 syncedmem.cpp:57] Check failed: error == cudaSuccess (30 vs. 0)  unknown error

My environment :
Ubuntu 16.04
GeForce 840M
driver nvidia-370 (nvidia library files are located under /usr/lib/nvidia-370)
cuda 8.0 (installed using the run file)

Your install is broken. It’s likely you didn’t follow the corect install instructions.

CUDA 8 runfile install doesn’t install a nvidia-370 driver

follow the instructions in the linux install guide carefully