User:Jeblad/TensorFlow

To make an efficient environment for development it might be necessary to tweak and adapt the setup. That imply diverging versions for the various libraries, and even libraries that should not be defined on the computer as such. To make this possible either virtualenv or vagrant can be used. To make this possible either virtualenv or vagrant can be used. CUDA and TensorFlow is no different in this respect.

Virtualenv on main computer
Of some reason you want to run the CUDA and/or TensorFlow on the bare metal. Especially note that PCI passthrough must work vor Vagrant to be used, and if it does not work then this is the option of choice.

Environment at main computer
Installation of CUDA:


 * 1) Open "System Settings"
 * 2) Open "Software and Updates"
 * 3) Open "Additional Drivers"
 * 4) Select one of the Nvidia Drivers and click "Apply Changes"
 * 5) Reboot the system.
 * 6) Open a terminal window and type  . This will identify the graphics card.

CUDA
Pre-install actions:

Installation Instructions:

Post-install actions: Add the following to, but note the versioning, it must match the names in use!

Note the, it will generate a double colon, and that is a bit dangerous. Later on that will create a warning.

Install cuDNN, note this is behind a member wall: Add to your build and link process by adding -I to your compile line and -L -lcudnn to your link line, or simply put it into the cuda folder.

Samples
The samples are found at  if the install is the usual deb-package for Ubuntu. It is although created for "nvidia-367" and not "nvidia-375" which is the latest as of this wring (10:38, 8 May 2017 (UTC)). To update the code (preferably on a local copy) do a

and then a simple.

Failing to update the samples will give a missing.

virtualenv
Install

It is not quite clear if this should be a python 3 specific version, I have no problem with it so far.

Now create a working directory, typically something like, and create the   for the directory, and then activate

Note that this only works with python 2, not with python 3!

TensorFlow
Do a.

Play it safe and setup both python 2.7 and 3.5?

Assuming there is a gpu in the machine

Fill in the blanks

Virtualization of PCI hardware for Vagrant
Your PC must satisfy the following:
 * 1) Your motherboard has an IOMMU unit.
 * 2) Your CPU supports the IOMMU.
 * 3) The IOMMU is enabled in the BIOS.
 * 4) The VM must run with VT-x/AMD-V and nested paging enabled.
 * 5) Your Linux kernel was compiled with IOMMU support. The PCI stub driver is required as well.
 * 6) Your Linux kernel recognizes and uses the IOMMU unit. Search for DMAR and PCI-DMA in kernel boot log.

Environment at host
Now edit the  and add new limits for memory and cpus.

Environment at client
There are additional notes for CUDA at Ubuntus help pages.

CUDA
Pre-install actions:

Installation Instructions:

I put the deb in my vagrant dir on the host, and then referred i as  inside the client.

Post-install actions: Add the following to, but note the versioning, it must match the names in use!

Install cuDNN, note this is behind a member wall: Add to your build and link process by adding -I to your compile line and -L -lcudnn to your link line.

TensorFlow
Play it safe and setup both python 2.7 and 3.5?

Manual testing
Open the interactive shell with  and run