CUDA-capable GPU not installed

Hi,
I get bellow error when I try to execute a cuda based program in ubuntu 16.04. It successfully compiles and when tried to execute following error is generated.
“cudaSetDevice failed! Do you have a CUDA-capable GPU installed?”

Below is the screen shot of “nvidia-smi” command execution.
±----------------------------------------------------------------------------+
| NVIDIA-SMI 390.48 Driver Version: 390.48 |
|-------------------------------±---------------------±---------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce 940MX Off | 00000000:01:00.0 Off | N/A |
| N/A 51C P0 N/A / N/A | 164MiB / 2004MiB | 4% Default |
±------------------------------±---------------------±---------------------+

±----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 1144 G /usr/lib/xorg/Xorg 124MiB |
| 0 2104 G compiz 37MiB |
±----------------------------------------------------------------------------+

Below is the result after execution of “nvcc --version”
nvcc: NVIDIA ® Cuda compiler driver
Copyright © 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:07:56_CDT_2017
Cuda compilation tools, release 9.1, V9.1.85

I have been trying to resolve this re-installing both cuda and drivers. Nothing seems to work.
Does any one know a way to solve this problem.