sudo ubuntu-drivers autoinstall
sudo apt install nvidia-cuda-toolkit gcc-6
Install Anaconda
refer to https://www.pugetsystems.com/labs/hpc/Install-TensorFlow-with-GPU-Support-the-Easy-Way-on-Ubuntu-18-04-without-installing-CUDA-1170/
bash Anaconda3-5.1.0-Linux-x86_64.sh
source ~/.bashrc
python --version
# to show the python version
conda update conda
conda update anaconda
conda update python
conda update --all # type 'y', when requred
conda create --name tf-gpu
# Create a Python "virtual environment" for TensorFlow usingconda
source activate tf-gpu
# You can see that my shell prompt is now preceded by the the name of the environment
conda install tensorflow-gpu
# install TensorFlow with GPU acceleration and all of the dependencies.
conda install ipykernel # Create a Jupyter Notebook Kernel for the TensorFlow Environment
python -m ipykernel install --user --name tf-gpu --display-name "TensorFlow-GPU" # create the Jupyter kernel