Multiple cuda version after installing graphic driver on ubuntu 18.04

I have problem regarding my CUDA. Somehow after I install graphic driver either from software & updates or from terminal I got CUDA installed directly with my graphic driver. This is fine by me but the problem is when I checked with nvidia-smi it shows I have cuda 10.2 installed but when I checked with nvcc --version. it says I have cuda 9.1 so which one should I follow to install CUDnn ? I am using a fresh installation of ubuntu 18.04 so I believe there should not be any CUDA before unless linux can connect to my windows since I am using dual boot.

Thank you for your time reading this.

Everything’s alright with your installation, the output of nvidia-smi is just misleading. The ‘cuda version’ displayed by it has nothing to do with the cuda version actually installed but is only saying ‘this driver is compatible with cuda versions up to 10.2’. While cuda 10.2 isn’t even released yet.

Thank you for the explanation

I was perplexed by the same for a couple of nights.