Skip to content

Instantly share code, notes, and snippets.

@frankcarey
Last active April 3, 2019 20:50
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 frankcarey/faf2b70132e429ef87226e632a594baa to your computer and use it in GitHub Desktop.
Save frankcarey/faf2b70132e429ef87226e632a594baa to your computer and use it in GitHub Desktop.

Context

While I first tried to install 18.10 since that was the newest, that was a really bad idea. Nvidia (drivers and nvidia-docerk) doesn't really like to play nicely with non-LTS versions. In addition, I tried the official NVIDIA and Tensorflow installation instructions and ran into a bunch of issues with both, even when reinstalling 18.04.. so this is what ended up working finally.

Make an 18.04.02 (current LTS) boot USB

See the official tutorial Basically:

  • download something that can make boot USB, Rufus for Windows is recommended in the tutorial.
  • Download Ubuntu, I found the torrent was a lot faster, so I downloaded qBittorrent and then used the torrent link for ubuntu.
  • Use Rufus to create the USB boot USB (select the ISO file you downloaded), it warned that I need to download a few more files related to linux and I approved it.
  • Eject the drive

Install Ubuntu from USB

  • move it to the computer you are going to install ubuntu on (with the power off)
  • Boot the computer: (you may need to enter the bios and ensure the USB is before windows or other things in the boot order sequence. I used ESC key to get to the boot screen.
  • I kept running into issues, so I ended up disabling secure boot in the BIOS, which didn't seem to fix the issue with keyboard and mouse locking up, but it does allow you to skip the step of signing things, so it might have been helpful in other ways.
  • You should end up in a temporary ubuntu desktop environment, so click on the link to install ubuntu.
  • I chose to resize the windows drive so that I can dual-boot into it if necessary.
  • Enable the installation of 3rd party drivers and enable the download of updates during the installation.
  • Once it completes,rReboot and remove the USB drive so you don't boot into it again.

Install NVIDIA drivers

  • Note: I tried the official instructions from tensorflow and nvidia and they both had issues related to the driver not woring at all, to the keyboard and mouse locking up, to not having the latest versions available, and dependencies not being available. This is what ended up working and I think it's the most supported. One issue was the actual version of ubuntu installed was 18.04.2, not 18.04.1 as was described in some of the install instructions.. other issues could be related the the kernal version installed.
  • As a fresh installation, I had NO nvidia drivers installed yet, but you can check what drivers are available with ubuntu-drivers devices and uninstall them with sudo apt-get remove --purge nvidia-*
  • Install the official graphics drivers PPA, which seems much better supported than the official nvidia repository ironically with sudo add-apt-repository ppa:graphics-drivers/ppa && sudo apt-get update
  • You should now see the latest drivers in ubuntu-drivers devices, currently this was nvidia-418
  • Install the new driver and add nvidia-settings, a GUI tool if you like. sudo apt-get install nvidia-driver-418 nvidia-settings
  • Reboot once it's done installing with sudo reboot now
  • Login and make sure that you are using the right driver and that your GPU is available with nvidia-smi

Install Docker

Install Nvidia-docker-2.0

  • Follow the official installation instructions for ubuntu

  • Make sure you restarted dockerd (docker daemon) with sudo pkill -SIGHUP dockerd

  • Confirm it works with with the local nvidia driver : docker run --runtime=nvidia --rm nvidia/cuda nvidia-smi

  • Confirm tensorflow is working with:

    docker run --runtime=nvidia -it --rm tensorflow/tensorflow:latest-gpu \
    python -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_normal([1000, 1000])))"
    
  • Disable sleep

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment