Key Points for Installing GPU Version of TensorFlow on Deepin

Introduction

Although there are many tutorials on how to install TensorFlow on Ubuntu, there isn’t a single article explaining how to install TensorFlow on Deepin systems. Here I’ll explain the key points of the installation process.

Process

  • First, download the Nvidia Linux driver from the official website. If you can’t run it, you’ll need to modify the driver’s execution permissions using chmod u+x. For information on installing graphics drivers on Deepin, refer to this article: https://wiki.deepin.org/index.php?title=%E6%98%BE%E5%8D%A1
  • Install Docker-ce. You must follow the official installation guide; this is the only method to properly install the latest version of Docker: https://wiki.deepin.org/index.php?title=Docker
  • Download Nvidia-docker. Find the Ubuntu installation package and installation steps on the Nvidia-Docker page on GitHub and follow them.
  • Next, run docker run -it -p 8888:8888 tensorflow/tensorflow:latest-gpu. At this point, you can enter the official TensorFlow GPU version container. Open localhost:8888 to see the Jupyter page.

Pitfalls

When installing the Nvidia graphics driver, according to the installation software’s instructions, you need to close the Linux desktop system X server. At this point, you can use tty16 for terminal operations. However, if Deepin has already installed its own Nvidia driver, when stopping the lightdm service, Deepin closes both the X server and the monitor, making it impossible to display the tty16 screens. This issue prevents Nvidia driver installation. Even after manually uninstalling the official Deepin Nvidia driver through complex uninstallation commands, when switching to tty1~6 and closing the graphical interface, the tty screen still shuts down, resulting in a black screen and making it impossible to continue with driver uninstallation and reinstallation of the official Nvidia driver.

Solution

To avoid problems with Nvidia driver installation while maintaining a clean and scientific operation, you must install the official Nvidia Linux driver during the first installation of the Deepin system, before any graphics drivers are installed. First, press the shortcut “Ctrl+Alt+F2” to enter tty2, then enter sudo systemctl stop lightdm to stop the lightdm service. At this point, when the computer closes the X server, it won’t cause the monitor to shut down. Then run chmod u+x NVIDIA-Linux-x86_64-352.55.run to grant executable permissions, followed by sudo ./NVIDIA-Linux-x86_64-352.55.run to install the driver file. After restarting, you can use the official closed-source driver normally.

Follow-up

Using a GPU to run TensorFlow programs is very fast. Normal programs can speed up by more than 10 times, and some programs can speed up by 50 to 100 times, so using a GPU for TensorFlow programming is essential. Additionally, I’m not sure if it’s an issue with Deepin, Nvidia-Docker, or the driver, but after the computer goes into standby mode, it causes errors in the TensorFlow container. Therefore, don’t let the machine enter standby mode during training.

Built with Hugo
Theme Stack designed by Jimmy