Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pjspillai/84f01e366d7b1a6d1dfd7246da925c12 to your computer and use it in GitHub Desktop.
Save pjspillai/84f01e366d7b1a6d1dfd7246da925c12 to your computer and use it in GitHub Desktop.
Opencv 3.3, Ubuntu 16.04, Cuda 9.1 Installation Quick Checks
Download NVIDIA and CUDA drivers from here (.run files)
https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1604&target_type=runfilelocal
http://www.nvidia.com/content/DriverDownload-March2009/confirmation.php?url=/XFree86/Linux-x86_64/390.25/NVIDIA-Linux-x86_64-390.25.run&lang=us&type=TITAN
disable nouveau
disable XServer
rm /tmp .X* files
sudo init 3
then run cuda
Install opencv
https://medium.com/@debugvn/installing-opencv-3-3-0-on-ubuntu-16-04-lts-7db376f93961
opencv cuda error:
Change these files accordingly: OpenCVDetectCUDA.cmake, FindCUDA.cmake as per the link below
https://stackoverflow.com/questions/46584000/cmake-error-variables-are-set-to-notfound
In,
opencv-3.3.0\modules\cudev\include\opencv2\cudev\common.hpp
Add #include <cuda_fp16.h>
In OpenCVDetectCUDA.cmake, change :
CUDA_ARCH_BIN : 2.0 3.0 3.5 3.7 5.0 5.2 6.0 6.1
to :
CUDA_ARCH_BIN : 6.0 6.1
-----------
Tensorflow
1.6 works with cuda 9.1 and above
1.4 works with cuda 8.0
Download NVIDIA and CUDA drivers from here (.run files)
https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1604&target_type=runfilelocal
http://www.nvidia.com/content/DriverDownload-March2009/confirmation.php?url=/XFree86/Linux-x86_64/390.25/NVIDIA-Linux-x86_64-390.25.run&lang=us&type=TITAN
disable nouveau
disable XServer
rm /tmp .X* filesuname -r
sudo update-initramfs -u [update initramfs]
sudo init 3
then run cuda
sudo killall /usr/bin/X
Build gcc 5.3.1 (when a pre-existing gcc is present)
cd gcc 5.3.1
sudo apt-get install build-essential
./contrib/download_prerequisites
mkdir build && cd build
../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
ubuntu-drivers devices [ this will print all available drivers]
CUDA Installation
sudo update-grub && uname -r [to check the kernel being used] If it's wrong, then log out, and enter advanced system setup, select 'linux-headers-4.4.0-128-generic' at login. We are going to install cuda on this kernel image
sudo service lightdm stop
Download NVIDIA driver and run it [NVIDIA-Linux-x86_64-390.48.run]
Download cuda_*.run and chmod it [cuda_9.1.85_387.26_linux.run]
uname -r : will give tyou the kernel images available. We are going to use 4.4.0.128
provide path to kernel image while installing cuda
sudo ./cuda_9.1.85_387.26_linux.run
Select 'YES' for all (including nvidia-xconfig, OpenGL..)
This will replace nvidia 390 by 387
export PATH=/usr/local/cuda-9.1/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.1/lib64{LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
echo -e "/usr/local/cuda-9.1/lib64" > /etc/ld.so.conf.d/cuda.conf
sudo ldconfig
sudo reboot now
which nvcc [this should display /usr/local/cuda-9.1/bin/nvcc]
nvcc -V [should print 9.1]
nvidia-smi [387.26]
sudo nvidia-xconfig
If the output is negative for nouveau, then all is well with your installation.
lsmod | grep nouveau
Ubuntu login loop after driver installation:
chown ppillai:ppillai .Xauthority
sudo mokutil --disable-validation
This will ask for pwd: Type verkada31
-----
Restart XServer
sudo nvidia-xconfig [this will initialize the NVIDIA X Server :) :) Almost there..]
You can check the X-Server conf file contents contents : cat /etc/X11/xorg.conf
Also set linux-headers-4.4.0-128-generic as the default grub login (instead of manually selecting it everytime)
sudo
apt install -y -f linux-headers-$(uname -r)
sudo cp /etc/default/grub /etc/default/grub.bak
sudo -H gedit /etc/default/grub
GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 3.13.0-53-generic"
sudo update-grub
----
Latest guide
----
sudo apt-get install gedit-plugins
sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator
https://github.com/heethesh/Install-TensorFlow-OpenCV-GPU-Ubuntu-17.10
building bazel using this:
tensorflow/tools/pip_package:build_pip_package --action_env="LD_LIBRARY_PATH=${LD_LIBRARY_PATH}"
Install opencv
https://medium.com/@debugvn/installing-opencv-3-3-0-on-ubuntu-16-04-lts-7db376f93961
opencv cuda error:
Change these files accordingly: OpenCVDetectCUDA.cmake, FindCUDA.cmake as per the link below
https://stackoverflow.com/questions/46584000/cmake-error-variables-are-set-to-notfound
In,
opencv-3.3.0\modules\cudev\include\opencv2\cudev\common.hpp
Add #include <cuda_fp16.h>
In OpenCVDetectCUDA.cmake, change :
CUDA_ARCH_BIN : 2.0 3.0 3.5 3.7 5.0 5.2 6.0 6.1
to :
CUDA_ARCH_BIN : 6.0 6.1
-----------
Tensorflow
1.6 works with cuda 9.1 and above
1.4 works with cuda 8.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment