About Me

Labels

2017年3月27日 星期一

Build a Nvidia CUDA server with Ubuntu 16.04 in 4 steps

*First of all, if you start from a brand new server, I suggest to install Ubuntu 16.04 WITHOUT NVIDIA graphics cards first. This will prevent Ubuntu from automatically installing open-source NVIDIA driver Nouveau. Nouveau may cause issues like black screen, lightdm crash, ..., to name a few. It's highly possible that you will see NOTHING at the inital boot if you install Ubuntu 16.04 directly with NVIDIA cards.

Once you can login the Ubuntu server, install CUDA following the 4 steps below:

1. Disable Nouveau
If you are running Desktop version, enter the terminal screen by typing

*If apt-get cannot find nvidia driver
we need to add the ppa manually. The commands below are referred from here:
Although you can also install the drivers included in the CUDA toolkit. I suggest to install from Ubuntu ppa:

Because Ubuntu 16.04 has latest gcc 6, which is not supported by CUDA. The --override flag force the installer to ignore unsupported gcc version.

Once installation is done, you may notice there is a warning:
***WARNING: Incomplete installation! This installation did not install
the CUDA Driver. A driver of version at least 361.00 is required for
CUDA 8.0 functionality to work.
To install the driver using this installer, run the following command, replacing with the name of this run file:
sudo .run -silent -driver

Don't worry, we can ignore this message.

4. Downgrade gcc to 4.9
Finally, we need to downgrade the gcc/g++ version in Ubuntu to < 5.0. Somebody may suggest to remove check line in CUDA library's header file. Don't do this, it will cause compiler error. Downgrade the gcc with "update-alternatives":