Installing Nvidia driver and toolkit in Ubuntu 16.04 with tooklit samples

Pre-requisite:

  • Make sure you gcc, g++ in your machine
  • CUDA based graphics card

Installation:

Get Cuda 8.0 from Nvidia:

 

Unzip:

  • Unzip cudnn-8.0-linux-x64-v5.1.tgz
  • You will get the file as cuda_8.0.44_linux-run

Execution:

Run $ bash ./cuda_8.0.44_linux-run


Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 367.48?
(y)es/(n)o/(q)uit: y
Do you want to install the OpenGL libraries?
(y)es/(n)o/(q)uit [ default is yes ]: y
Do you want to run nvidia-xconfig?
This will update the system X configuration file so that the NVIDIA X driver
is used. The pre-existing X configuration file will be backed up.
This option should not be used on systems that require a custom
X configuration, such as systems with multiple GPU vendors.
(y)es/(n)o/(q)uit [ default is no ]: y
Install the CUDA 8.0 Toolkit?
(y)es/(n)o/(q)uit: y
Enter Toolkit Location
[ default is /usr/local/cuda-8.0 ]: /usr/local/cuda
Cannot install toolkit in /usr/local/cuda.
Enter Toolkit Location
[ default is /usr/local/cuda-8.0 ]:
Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: y
Install the CUDA 8.0 Samples?
(y)es/(n)o/(q)uit: y
Enter CUDA Samples Location
[ default is /home/ubuntu ]: /mnt/avkash/cuda-samples
Installing the NVIDIA display driver…
Error: unsupported compiler: 5.4.1. Use –override to override this check.
Installing the CUDA Samples in /mnt/avkash/cuda-samples …
sh: 1: /usr/local/cuda-8.0/bin/cuda-install-samples-8.0.sh: not found
chown: failed to get attributes of ‘/mnt/avkash/cuda-samples’: No such file or directory
===========
= Summary =
===========
Driver: Installed
Toolkit: Installation Failed. Using unsupported Compiler.
Samples: Installed in /mnt/avkash/cuda-samples
To uninstall the NVIDIA Driver, run nvidia-uninstall
Logfile is /tmp/cuda_install_6246.log

 

Problem:

  • The problem is that due to compiler issue the installation did not work.
  • Looking the log you will see the gcc/g++ compiler are 5.4.x however over 5.3 are not supported.

Solution is to downgrade gcc/g++ to 4.9

Solution: https://aichamp.wordpress.com/2016/11/10/downgrading-gcc-from-5-4-to-4-9-in-ubuntu-16-04/

Try again:

Do you accept the previously read EULA?
accept/decline/quit: accept
Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 367.48?
(y)es/(n)o/(q)uit: n
Install the CUDA 8.0 Toolkit?
(y)es/(n)o/(q)uit: y
Enter Toolkit Location
[ default is /usr/local/cuda-8.0 ]:
Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: y
Install the CUDA 8.0 Samples?
(y)es/(n)o/(q)uit: y
Enter CUDA Samples Location
[ default is /home/ubuntu ]: /mnt/avkash/cuda-samples
Installing the CUDA Toolkit in /usr/local/cuda-8.0 …
Installing the CUDA Samples in /mnt/avkash/cuda-samples …
Copying samples to /mnt/avkash/cuda-samples/NVIDIA_CUDA-8.0_Samples now…
Finished copying samples.
===========
= Summary =
===========
Driver: Not Selected
Toolkit: Installed in /usr/local/cuda-8.0
Samples: Installed in /mnt/avkash/cuda-samples
Please make sure that
– PATH includes /usr/local/cuda-8.0/bin
– LD_LIBRARY_PATH includes /usr/local/cuda-8.0/lib64, or, add /usr/local/cuda-8.0/lib64 to /etc/ld.so.conf and run ldconfig as root
To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-8.0/bin
Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-8.0/doc/pdf for detailed information on setting up CUDA.
***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 <CudaInstaller> with the name of this run file:
sudo <CudaInstaller>.run -silent -driver

 

Cuda Samples:

Compilation:

  • $/mnt/avkash/cuda-samples/NVIDIA_CUDA-8.0_Samples/1_Utilities/deviceQuery$ make

Listing:

  • $/mnt/avkash/cuda-samples/NVIDIA_CUDA-8.0_Samples/1_Utilities/deviceQuery$ ll
    total 640
    drwxr-xr-x 2 root root 4096 Nov 21 01:24 ./
    drwxr-xr-x 7 root root 4096 Nov 21 01:17 ../
    -rwxr-xr-x 1 root root 581960 Nov 21 01:24 deviceQuery*
    -rw-r–r– 1 root root 12174 Nov 21 01:17 deviceQuery.cpp
    -rw-r–r– 1 root root 21264 Nov 21 01:24 deviceQuery.o
    -rw-r–r– 1 root root 9077 Nov 21 01:17 Makefile
    -rw-r–r– 1 root root 1737 Nov 21 01:17 NsightEclipse.xml
    -rw-r–r– 1 root root 168 Nov 21 01:17 readme.txt

Execution:

  • $/mnt/avkash/cuda-samples/NVIDIA_CUDA-8.0_Samples/1_Utilities/deviceQuery$ ./deviceQuery
    ./deviceQuery Starting…
    CUDA Device Query (Runtime API) version (CUDART static linking)
    Detected 1 CUDA Capable device(s)
    Device 0: “GRID K520”
    CUDA Driver Version / Runtime Version 8.0 / 8.0
    CUDA Capability Major/Minor version number: 3.0
    Total amount of global memory: 4036 MBytes (4232052736 bytes)
    ( 8) Multiprocessors, (192) CUDA Cores/MP: 1536 CUDA Cores
    GPU Max Clock rate: 797 MHz (0.80 GHz)
    Memory Clock rate: 2500 Mhz
    Memory Bus Width: 256-bit
    L2 Cache Size: 524288 bytes
    Maximum Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536, 65536), 3D=(4096, 4096, 4096)
    Maximum Layered 1D Texture Size, (num) layers 1D=(16384), 2048 layers
    Maximum Layered 2D Texture Size, (num) layers 2D=(16384, 16384), 2048 layers
    Total amount of constant memory: 65536 bytes
    Total amount of shared memory per block: 49152 bytes
    Total number of registers available per block: 65536
    Warp size: 32
    Maximum number of threads per multiprocessor: 2048
    Maximum number of threads per block: 1024
    Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
    Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535)
    Maximum memory pitch: 2147483647 bytes
    Texture alignment: 512 bytes
    Concurrent copy and kernel execution: Yes with 2 copy engine(s)
    Run time limit on kernels: No
    Integrated GPU sharing Host Memory: No
    Support host page-locked memory mapping: Yes
    Alignment requirement for Surfaces: Yes
    Device has ECC support: Disabled
    Device supports Unified Addressing (UVA): Yes
    Device PCI Domain ID / Bus ID / location ID: 0 / 0 / 3
    Compute Mode:
    < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
    deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 8.0, CUDA Runtime Version = 8.0, NumDevs = 1, Device0 = GRID K520
    Result = PASS

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s