All Projects → nathtest → Tutorial Ubuntu 18.04 Install Nvidia Driver And Cuda And Cudnn And Build Tensorflow For Gpu

nathtest / Tutorial Ubuntu 18.04 Install Nvidia Driver And Cuda And Cudnn And Build Tensorflow For Gpu

Licence: apache-2.0
Ubuntu 18.04 How to install Nvidia driver + CUDA + CUDNN + build tensorflow for gpu step by step command line

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects

Projects that are alternatives of or similar to Tutorial Ubuntu 18.04 Install Nvidia Driver And Cuda And Cudnn And Build Tensorflow For Gpu

tensorflow-builds
Tensorflow binaries and Docker images compiled with GPU support and CPU optimizations.
Stars: ✭ 15 (-83.52%)
Mutual labels:  bazel, nvidia, cudnn
Tensorflow Object Detection Tutorial
The purpose of this tutorial is to learn how to install and prepare TensorFlow framework to train your own convolutional neural network object detection classifier for multiple objects, starting from scratch
Stars: ✭ 113 (+24.18%)
Mutual labels:  tutorial, cudnn, cuda
Simple Sh Datascience
A collection of Bash scripts and Dockerfiles to install data science Tool, Lib and application
Stars: ✭ 32 (-64.84%)
Mutual labels:  cudnn, ubuntu, cuda
Ethereum nvidia miner
💰 USB flash drive ISO image for Ethereum, Zcash and Monero mining with NVIDIA graphics cards and Ubuntu GNU/Linux (headless)
Stars: ✭ 772 (+748.35%)
Mutual labels:  nvidia, ubuntu, cuda
Golang Docker Build Tutorial
A template project to create a minimal Docker image for a Go application
Stars: ✭ 36 (-60.44%)
Mutual labels:  build, tutorial
Cuda
Experiments with CUDA and Rust
Stars: ✭ 31 (-65.93%)
Mutual labels:  nvidia, cuda
Nvidia libs test
Tests and benchmarks for cudnn (and in the future, other nvidia libraries)
Stars: ✭ 36 (-60.44%)
Mutual labels:  cudnn, cuda
Bazel and compilecommands
Add compile_commands.json to your C++ Bazel Project
Stars: ✭ 62 (-31.87%)
Mutual labels:  bazel, compile
Arraymancer
A fast, ergonomic and portable tensor library in Nim with a deep learning focus for CPU, GPU and embedded devices via OpenMP, Cuda and OpenCL backends
Stars: ✭ 793 (+771.43%)
Mutual labels:  cudnn, cuda
Singularity Tutorial
Tutorial for using Singularity containers
Stars: ✭ 46 (-49.45%)
Mutual labels:  cudnn, cuda
Rebar3
Erlang build tool that makes it easy to compile and test Erlang applications and releases.
Stars: ✭ 1,295 (+1323.08%)
Mutual labels:  build, compile
Cub
Cooperative primitives for CUDA C++.
Stars: ✭ 883 (+870.33%)
Mutual labels:  nvidia, cuda
Imagenet Classifier Tensorflow
Image recognition and classification using Convolutional Neural Networks with TensorFlow
Stars: ✭ 13 (-85.71%)
Mutual labels:  cudnn, cuda
C cpp project framework
CMake build system( framework) with kconfig support for C/CPP projects
Stars: ✭ 26 (-71.43%)
Mutual labels:  build, compile
Aurora
Minimal Deep Learning library is written in Python/Cython/C++ and Numpy/CUDA/cuDNN.
Stars: ✭ 90 (-1.1%)
Mutual labels:  cudnn, cuda
Optix Path Tracer
OptiX Path Tracer
Stars: ✭ 60 (-34.07%)
Mutual labels:  nvidia, cuda
Build Deep Learning Env With Tensorflow Python Opencv
Tutorial on how to build your own research envirorment for Deep Learning with OpenCV, Python, Tensorfow
Stars: ✭ 66 (-27.47%)
Mutual labels:  tutorial, cuda
Parenchyma
An extensible HPC framework for CUDA, OpenCL and native CPU.
Stars: ✭ 71 (-21.98%)
Mutual labels:  nvidia, cuda
Cuda Design Patterns
Some CUDA design patterns and a bit of template magic for CUDA
Stars: ✭ 78 (-14.29%)
Mutual labels:  bazel, cuda
Tf Coriander
OpenCL 1.2 implementation for Tensorflow
Stars: ✭ 775 (+751.65%)
Mutual labels:  nvidia, ubuntu

Ubuntu-18.04 Install Nvidia driver and CUDA and CUDNN and build Tensorflow for gpu

Ubuntu 18.04 Tutorial : How to install Nvidia driver + CUDA + CUDNN + build tensorflow for gpu step by step command line

Thoses steps allowed me to build tensorflow for gpu with a comptute capabilities of 3.0 on a laptop with a GeForce 740m and Ubuntu 18.04.

Install neccesary library :

   sudo apt-get install openjdk-8-jdk git python-dev python3-dev python-numpy python3-numpy python-six python3-six build-essential python-pip python3-pip python-virtualenv swig python-wheel python3-wheel libcurl3-dev libcupti-dev
    

If libcurl3-dev package is not found use:

   sudo apt-get install libcurl4-openssl-dev
    

Install nvidia driver

Add graphics drivers to your source list :

    sudo add-apt-repository ppa:graphics-drivers/ppa
    sudo apt update
    sudo apt upgrade
   

Check what driver will be installed :

    ubuntu-drivers devices

Auto install latest driver (it will do everything blacklist drivers nouveau , create nvidia daemon , ect ...) :

 sudo ubuntu-drivers autoinstall

Then reboot your machine :

 sudo reboot

If you boot without any kernel crash you're ok but you can check the correct install of the driver :

lsmod | grep nvidia

or

   nvidia-smi

Install cuda

Download cuda_your_cuda_version.run on https://developer.nvidia.com/cuda-toolkit and install it:

     cd Downloads/
     sudo sh cuda_9.0.176_384.81_linux.run --override --silent --toolkit
   

If everything is ok you should see a cuda folder in /usr/local/ .

Download linux cudnn_your_version on https://developer.nvidia.com/cudnn and install it:

     tar -xzvf cudnn-9.0-linux-x64-v7.1.tgz 
     sudo cp cuda/include/cudnn.h /usr/local/cuda/include
     sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
     sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
   
   

Check if you have correctly copied cudnn in /usr/local/cuda/lib64/.

Now you must add some path to your /.bashrc :

     gedit ~/.bashrc
   

Add those line at the end of your /.bashrc :

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"
export CUDA_HOME=/usr/local/cuda

Now reload your terminal config :

    source ~/.bashrc
    sudo ldconfig

Check if the path are correctly installed :

    echo $CUDA_HOME

Build tensorflow with Bazel

Install gcc 4.8 (only version of gcc that can currently compile tensorflow) :

    sudo apt-get install gcc-4.8 g++-4.8
    sudo apt-get update
   

If gcc-4.8 package is not found you can try to add :

    sudo add-apt-repository ppa:ubuntu-toolchain-r/test
    sudo apt-get update
    sudo apt-get install gcc-4.8 g++-4.8
  

Install bazel :

 sudo apt install curl
 echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
 curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
 sudo apt-get update
 sudo apt-get install bazel
 sudo apt-get upgrade bazel
   

Download tensorflow and choose what branch you want :

     cd ~
     git clone https://github.com/tensorflow/tensorflow
     cd ~/tensorflow
     git checkout r1.8
     cd ~/tensorflow
  

Create configuration file for tensorflow build :

    ./configure
  

Say no to most query just specify the python version you want , yes to jemalloc and specify correct path to gcc-4.8.

Please specify the location of python. [Default is /usr/bin/python]: /usr/bin/python3
Do you wish to build TensorFlow with jemalloc as malloc support? [Y/n]: Y
Do you wish to build TensorFlow with Google Cloud Platform support? [Y/n]: N
Do you wish to build TensorFlow with Hadoop File System support? [Y/n]: N
Do you wish to build TensorFlow with Amazon S3 File System support? [Y/n]: N
Do you wish to build TensorFlow with Apache Kafka Platform support? [y/N]: N
Do you wish to build TensorFlow with XLA JIT support? [y/N]: N
Do you wish to build TensorFlow with GDR support? [y/N]: N
Do you wish to build TensorFlow with VERBS support? [y/N]: N
Do you wish to build TensorFlow with OpenCL SYCL support? [y/N]: N
Do you wish to build TensorFlow with CUDA support? [y/N]: Y
Please specify the CUDA SDK version you want to use, e.g. 7.0. [Leave empty to default to CUDA 9.0]: 9.0
Please specify the location where CUDA 9.1 toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: /usr/local/cuda
Please specify the cuDNN version you want to use. [Leave empty to default to cuDNN 7.0]: 7.1
Please specify the location where cuDNN 7 library is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: /usr/local/cuda
Do you wish to build TensorFlow with TensorRT support? [y/N]: N
Please note that each additional compute capability significantly increases your build time and binary size. [Default is: 5.0] 3.0
Do you want to use clang as CUDA compiler? [y/N]: N
Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]: /usr/bin/gcc-4.8
Do you wish to build TensorFlow with MPI support? [y/N]: N
Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native]: -march=native
Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]:N

Build tensorflow with bazel :

sudo bazel build --config=opt --config=cuda --action_env="/usr/local/cuda/lib64" //tensorflow/tools/pip_package:build_pip_package
    

Create .whl for pip install :

   bazel-bin/tensorflow/tools/pip_package/build_pip_package tensorflow_pkg
   cd tensorflow_pkg/
   sudo pip3 install tensorflow-<name_of_generated_file>.whl 
  

Let me know if you find some quicker way to build tensorflow or if you found some mistakes.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].