Author: Saurabh Bodhe
Translator: Chen Zhendong
Proofreader: Che Qianzi
This article is approximately 1000 words, suggested reading time is 5 minutes.
This article discusses a tutorial on setting up a GPU-based TensorFlow platform using NVIDIA’s official tools.
“Building Deep Learning on Google Cloud Platform”I know that building a high-end deep learning system based on GPU is very expensive and not easy to obtain unless you…
https://hackernoon.com/deep-learning-with-google-cloud-platform-66ada9d7d029
Assuming you have a bare metal machine with a GPU, of course, if some configurations are preset, you can skip the following parts of the tutorial. Additionally, I assume you have an NVIDIA graphics card; we will only discuss how to configure TensorFlow in this tutorial, which is currently the most popular deep learning framework (kudos to Google!).Install CUDA DriversCUDA is a parallel computing platform developed by NVIDIA and is a prerequisite for building TensorFlow. However, as we will mention later, it is actually better to use a reverse engineering method, so we will return to this part later.Install TensorFlowOpen the terminal (if accessed remotely, use SSH). In any case, find the specific version of TensorFlow required for the application (if any), or if there are no such restrictions, you can use the TensorFlow 1.8.0 that I am currently using.pip install tensorflow-gpu==1.8.0When installing TensorFlow, we run the Python shell,pythonand in the Python shell, enter the following code:import tensorflow as tfBut at this point, we have not installed CUDA, and you will see an error similar to the following:ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directoryThe version 9.0, file name, or other errors depend on the TensorFlow version you choose. However, the purpose of doing this is to know which version of CUDA we need; in this case, it is 9.0. The correspondence between TF versions and CUDA versions in the official documentation is not very clear, so I have always felt that this reverse engineering method is better.Then, we will return to the installation of CUDA. Useexit()to exit the Python shell.Install CUDA Drivers (Trust me, this time it’s really installation)Go tohttps://developer.nvidia.com/cuda-toolkit-archive. Based on previous operations, select the version you need:Linux->x86_64->Ubuntu->16.04 (or 17.04)->deb (network)Download the corresponding .deb file and install CUDA according to NVIDIA’s official instructions. Once done, let’s check if everything is okay.Open the Python shell again and run the following code,import tensorflow as tfOf course, we are not done yet; this time you will see a slightly different error (if a similar error occurred before, refer to the fixes in the “Troubleshooting” section below)ImportError: libcudnn.so.7: cannot open shared object file: No such file or directoryWe also need a library called cuDNN provided by NVIDIA, which can use GPU acceleration for deep neural network computations. Note that the cuDNN version in this tutorial is 7.0.Openhttps://developer.nvidia.com/cudnnand register an account (free).After registering, log in tohttps://developer.nvidia.com/rdp/cudnn-archive.Select the cuDNN version you need and ensure you choose the corresponding CUDA version for that version. In this tutorial, we need to download the following version,Download cuDNN v7.0.5 (Dec 5, 2017), for CUDA 9.0SelectcuDNN v7.0.5 Library for Linuxand the .tgz file will start downloading. Store the file on your machine and extract it using the following command,tar -xzvf <CUDNN_TAR_FILENAME>Finally, extract a folder named “CUDA”, switch to that directory, and execute the following two commands,sudo cp lib64/* /usr/local/cuda/lib64/sudo cp include/cudnn.h /usr/local/cuda/include/This is complete (hopefully). Restart the Python shell, and this time you know what to do.If there are no errors this time, then you are good to go.To ensureTensorFlowcan detect the GPU, use the following code in thePython shell,tf.test.gpu_device_name()It will display all available GPUs. If this command may not work in older versions of TF, you can try the following command.nvidia-smiTroubleshootingIf all configurations are correct,nvidia-smican also be executed, butTensorFlowstill reports the same error, then it is likely that there is an issue with the environment variables. Execute the following commands to fix it:
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH}
export PATH=/usr/local/cuda/lib64:${PATH}
If the nvidia-smi command cannot be executed at all, CUDA is not installed correctly; reinstall and configure again to see if there is anything missed.Feel free to ask questions, suggestions, or criticism.Best wishes.
Original title:
Setting up your GPU machine to be Deep Learning ready
Original link:
https://hackernoon.com/setting-up-your-gpu-machine-to-be-deep-learning-ready-96b61a7df278
Editor: Yu TengkaiProofreader: Lin Yilin
Translator’s Bio
Chen Zhendong, with a low salary and many ideas, currently works in the software development department of Beijing Bank, responsible for building core systems, mainly focusing on Customer Information (CIF) models, third-party payment transactions, etc., and as a key member participated in the construction of the bank’s distributed and cloud computing platform. Enthusiastic about researching financial data architecture and statistical analysis methods, hoping to broaden work and learning ideas through more communication.
Translation Group Recruitment Information
Job Content:Accurately translate selected cutting-edge foreign articles into fluent Chinese. If you are a data science/statistics/computer major studying abroad, or working overseas in related fields, or have confidence in your foreign language skills, the Data Pie translation team welcomes you to join!
What You Can Gain:Improve your understanding of cutting-edge data science, enhance your awareness of foreign news sources, and friends overseas can stay connected with domestic technological applications. The Data Pie team’s background in academia and industry provides good development opportunities for volunteers.
Other Benefits:Collaborate and communicate with data science professionals from well-known companies, students from prestigious universities such as Peking University and Tsinghua University, and overseas.
Click at the end of the article “Read the Original” to join the Data Pie team~
Click “Read the Original” to embrace the organization