Skip to main content

Probability and Cumulative Dice Sums

Notes on Setting up a Titan V under Ubuntu 17.04

I recently purchased a Titan V GPU to use for machine and deep learning, and in the process of installing the latest Nvidia driver's hosed my Ubuntu 16.04 install. I was overdue for a fresh install of Linux, anyway, so I decided to upgrade some of my drives at the same time. Here are some of my notes for the process I went through to get the Titan V working perfectly with TensorFlow 1.5 under Ubuntu 17.04.

Old install:
Ubuntu 16.04
EVGA GeForce GTX Titan SuperClocked 6GB
2TB Seagate NAS HDD
+ additional drives

New install:
Ubuntu 17.04
Titan V 12GB
/ partition on a 250GB Samsung 840 Pro SSD (had an extra around)
/home partition on a new 1TB Crucial MX500 SSD
New WD Blue 4TB HDD
+ additional drives

You'll need to install Linux in legacy mode, not UEFI, in order to use Nvidia's proprietary drivers for the Titan V. Note that Linux will cheerfully boot in UEFI mode, but will not load any proprietary drivers (including Nvidia's). You'll need proprietary drivers for TensorFlow.

You may also need to disable fast boot.

Keep a wired mouse handy, as your wireless mouse may decide to stop working until Linux is installed and updated. This occurred with my Logitech MX Master.

Create an Ubuntu 17.04 live install USB - https://help.ubuntu.com/community/Installation/FromUSBStick

Boot from your live Ubuntu USB with the BIOS in legacy mode.

I selected the Samsung 850 Pro as my / and the Crucial MX500 as /home. You'll need to "create" and "add" if they're unformatted.

Allow 3rd party/proprietary drivers.

Install!

Reboot, login to default Ubuntu (logging in to Unity may hang; it did on my system). The Titan V is not configured yet.

Update Ubuntu:
sudo apt-get update
sudo apt-get upgrade

I recommend installing the latest kernel.
apt-get install linux-generic linux-headers-generic linux-image-generic

I recommend installing the KDE/Plasma desktop, as I could not get the Unity desktop to work.
apt-get install plasma-desktop dolphin konsole

Download and install Nvidia's 387.34_1.0-1 driver - http://www.nvidia.com/download/driverResults.aspx/128019/en-us
sudo dpkg -i nvidia-driver-local-repo-ubuntu1704-387.34_1.0-1_amd64.deb

The Titan V is still not configured, but should be after the next step.

Download and install CUDA 9.0 - https://developer.nvidia.com/cuda-90-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1704&target_type=deblocal
sudo dpkg -i uda-repo-ubuntu1704-9-0-local_9.0.176-1_amd64.deb
apt-get install cuda-9-0

Add the following two lines to your .bash_profile:

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

Reboot; the Titan V should be working and configured.

I recommend installing git.

apt-get install git

You'll need to install pip for Python for TensorFlow.

apt-get install python-pip (for Python 2)
apt-get install python3-pip (for Python 3)

We'll need cuDNN for TensorFlow.

Download cuDNN v7.0.5 (Dec 5, 2017), for CUDA 9.0

You'll need to create a (free) Nvidia developer account.

https://developer.nvidia.com/rdp/cudnn-download

This is how I installed cuDNN.
tar xzf cudnn-9.0-linux-x64-v7.tgz
cd cuda
sudo cp NVIDIA_SLA_cuDNN_Support.txt /usr/local/cuda-9.0
sudo cp include/cudnn.h /usr/local/cuda-9.0/targets/x86_64-linux/include
sudo cp lib64/libcudnn_static.a /usr/local/cuda-9.0/targets/x86_64-linux/lib
sudo cp lib64/libcudnn.so.7.0.5 /usr/local/cuda-9.0/targets/x86_64-linux/lib
cd /usr/local/cuda-9.0/targets/x86_64-linux/lib
sudo ln -s libcudnn.so.7.0.5 libcudnn.so.7
sudo ln -s libcudnn.so.7 libcudnn.so
cd

Let's install TensorFlow! We'll want the nightly.

sudo -H pip install tf-nightly-gpu (Python 2)
sudo -H pip3 install tf-nightly-gpu (Python 3)

TensorFlow should now be working!

$ python (or python3)
...
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
Hello, TensorFlow!
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> print(sess.run(a + b))
42
>>>

See also - https://www.tensorflow.org/versions/r0.12/get_started/os_setup

If you also want to install the latest Julia.
git clone https://github.com/JuliaLang/julia
cd julia
sudo apt-get install m4 cmake gfortran clang libopenblas-base libopenblas-dev
make -j 4

Enjoy!

Comments

Popular posts from this blog

Mixed Models in R - Bigger, Faster, Stronger

When you start doing more advanced sports analytics you'll eventually starting working with what are known as hierarchical, nested or mixed effects models . These are models that contain both fixed and random effects . There are multiple ways of defining fixed vs random random effects , but one way I find particularly useful is that random effects are being "predicted" rather than "estimated", and this in turn involves some "shrinkage" towards the mean. Here's some R code for NCAA ice hockey power rankings using a nested Poisson model (which can be found in my hockey GitHub repository ): model <- gs ~ year+field+d_div+o_div+game_length+(1|offense)+(1|defense)+(1|game_id) fit <- glmer(model, data=g, verbose=TRUE, family=poisson(link=log) ) The fixed effects are year , field (home/away/neutral), d_div (NCAA division of the defense), o_div (NCAA division of the offense) and game_length (number of overtime

A Bayes' Solution to Monty Hall

For any problem involving conditional probabilities one of your greatest allies is Bayes' Theorem . Bayes' Theorem says that for two events A and B, the probability of A given B is related to the probability of B given A in a specific way. Standard notation: probability of A given B is written \( \Pr(A \mid B) \) probability of B is written \( \Pr(B) \) Bayes' Theorem: Using the notation above, Bayes' Theorem can be written:  \[ \Pr(A \mid B) = \frac{\Pr(B \mid A)\times \Pr(A)}{\Pr(B)} \] Let's apply Bayes' Theorem to the Monty Hall problem . If you recall, we're told that behind three doors there are two goats and one car, all randomly placed. We initially choose a door, and then Monty, who knows what's behind the doors, always shows us a goat behind one of the remaining doors. He can always do this as there are two goats; if we chose the car initially, Monty picks one of the two doors with a goat behind it at random. Assume we pick Door 1 an