Install NVIDIA CUDA 9.1 on Ubuntu 17.10

DO NOT use the package from NVIDIA (they are for Ubuntu 17.04).

If you install it, nvidia-smi complains Failed to initialize NVML: Driver/library version mismatch. Reboot, you will get stuck with a black screen and some green words flashing.

Solution: Upgrade the OS to 18.04 and use package from Ubuntu, older version only have CUDA 8 https://packages.ubuntu.com/bionic/devel/nvidia-cuda-toolkit