Ubuntu 16.04 "Invalid Device Ordinal" Error

I’ve checked that my system is using the installed nvidia driver.

NVRM version: NVIDIA UNIX x86_64 Kernel Module 367.27
Cuda Toolkit Version: 8.0

I’ve searched a lot and tried somethings, but not able to work it out. Help asap!

You shouldn’t be using 367.27, that is a very old driver. CUDA 8 shipped with 367.44 or newer.

Beyond that, don’t you think it makes sense to explain under what circumstances you get the error?

I tried installing that, but it gave me error that the system doesn’t support it.