How to make Tensorflow work on RTX 20XX series GPUs

Once you’ve done that, you can install it by running:sudo sh cuda_10.0.130_410.48_linux.runand following the command prompts.Make sure to not install the drivers suggested by the CUDA installer.Once it has finished installing, we need to make sure that CUDA is in your environment variables by executing:export PATH=$PATH:/usr/local/cuda-10.0/binexport LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64echo 'PATH=$PATH:/usr/local/cuda-10.0/bin' >> ~/.bash_profileecho 'LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64' >> ~/.bash_profileYou can verify that it works by running:nvcc -VIf it’s working properly, you should see something likenvcc: NVIDIA (R) Cuda compiler driverCopyright (c) 2005-2018 NVIDIA CorporationBuilt on Sat_Aug_25_21:08:01_CDT_2018Cuda compilation tools, release 10.0, V10.0.130Now, we need to install cuDNN 7.3.For this step, you need to create a free NVIDIA developer account.Once you’ve done that, you need to download the Runtime and Developer library for Ubuntu 16.04 from the download page..Select:cuDNN Runtime Library for Ubuntu16.04 (Deb)cuDNN Developer Library for Ubuntu16.04 (Deb)Once you’ve downloaded those, you can install the .deb files by using dpkg.sudo dpkg -i libcudnn7_7.3.0.29–1+cuda10.0_amd64.debsudo dpkg -i libcudnn7-dev_7.3.0.29–1+cuda10.0_amd64.debTo check you’ve installed it correctly, you can run the following script written by Sherlock on Stackoverflow.function lib_installed() { /sbin/ldconfig -N -v $(sed 's/:/ /' <<< $LD_LIBRARY_PATH) 2>/dev/null | grep $1; }function check() { lib_installed $1 && echo "$1 is installed" || echo "ERROR: $1 is NOT installed"; }check libcudnn2..Installing BazelThis can easily be done by running:curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -sudo apt-get install bazel3..Building TensorflowWe will now build our custom Tensorflow distribution from source..If you’re using another operating system, you can refer to the Tensorflow guide.Clone the Tensorflow Github repository:git clone https://github.com/tensorflow/tensorflow.gitcd tensorflowgit checkout r1.11Next, we need to configure our Tensorflow build tool by running:./configureI selected:XLA JIT support: YesCUDA support: YesCUDA SDK version: 10.0NCCL version: 1.3And either no when possible to the rest, otherwise the default option.Finally, in order to build Tensorflow, run:./bazel-bin/tensorflow/tools/pip_package/build_pip_package ./tensorflow_pkgThis will likely take quite some time, so grab some popcorn, and watch a movie..(if somebody asks, tell them you’re working, and that Kasper says it’s a very important step in installing Tensorflow)When the movie is finished, and Bazel is finished building Tensorflow, you can run the following in your virtual environment to install Tensorflow with CUDA support.pip install ./tensorflow_pkg/tensorflow-1.11.0-cp36-cp36m-linux_x86_64.whlAnd you’re finished.Now, all there’s left is to enjoy your fresh Tensorflow installation.You can verify everything works by running the following script.from tensorflow.python.client import device_libdef get_devices(): return [x.name for x in device_lib.list_local_devices()]print (get_devices())And you can learn more about Tensorflow by reading the Introduction to Tensorflow essay.Cover image from tensorflow.org.. More details

Leave a Reply