This guide provides step-by-step instructions to get Lasagne up and running on Ubuntu 14.04 (and possibly others), including BLAS and CUDA support.
- C Ubuntu 14.04 Dev Tty Library Version
- C Ubuntu 14.04 Dev Tty Library Login
- C Ubuntu 14.04 Dev Tty Library Software
- Ubuntu 14.04 Download
If you run into trouble or have any suggestions for improvements, please let us know on the mailing list: https://groups.google.com/forum/#!forum/lasagne-users
Also let us know if you successfully used or adapted the steps for other versions of Ubuntu.
Also let us know if you successfully used or adapted the steps for other versions of Ubuntu.
Setting up a 32bit CEF/Chromium build on Ubuntu 14.04 - build steps. Download zlib1g-dev1.2.8.dfsg-1ubuntu1i386.deb for 14.04 LTS from Ubuntu Main repository. About; Contributors. Ubuntu 14.04 LTS (Trusty Tahr) Repository: Ubuntu Main i386 Official. Zlib is a library implementing the deflate compression method found in gzip and PKZIP. This package includes the development support files.
C Ubuntu 14.04 Dev Tty Library Version
Basics
This installs the bare minimum needed: A compiler, pip, numpy and scipy, Theano and Lasagne.
Prerequisites
![C Ubuntu 14.04 Dev Tty Library C Ubuntu 14.04 Dev Tty Library](/uploads/1/2/6/1/126191051/834142794.png)
Installing the prerequisites is fairly easy. Open a terminal and run:
Theano and Lasagne
Still in a terminal, run:
This will install the bleeding-edge versions of Theano and Lasagne for your user.Whenever you want to update to the latest version, just run the two commands again.
Testing
To test your installation, download Lasagne's MNIST example. We assume you want to put it into your home directory, in the subdirectory
code/mnist
. Still in a terminal, run:If everything was installed correctly, this will download the MNIST dataset (11 MiB) and train a simple network on it for 5 epochs. Including compilation, this should take between 1 and 5 minutes.
BLAS
BLAS (Basic Linear Algebra Subprograms) is a specification for a set of linear algebra building blocks that many other libraries depend on, including numpy and Theano. Several vendors and open-source projects provide optimized implementations of these routines. The installation instructions above already install a precompiled version of OpenBLAS that should be usable by Theano.
Testing
To test whether Theano can use OpenBLAS, download Theano's BLAS check and run it. We assume you want to put it in a temporary directory. Still in a terminal, run:
If everything works correctly, near the end of the output, it should say:
The execution time may be very different, the important point is
direct Theano binding to blas
.Self-compiled BLAS
For improved performance, you may want to compile OpenBLAS for your specific CPU architecture.The easiest way to do so is to use the source package of Ubuntu's OpenBLAS.The following commands should do the trick:
Run the test again, as described in the previous section. Most likely, performance will have improved.
For even better performance, you may want to try compiling OpenBLAS from the original source as described on http://www.openblas.net/. (Please feel free to extend this guide accordingly.)
![Dev Dev](/uploads/1/2/6/1/126191051/965152699.png)
If compilation fails, it's possible that your CPU architecture is newer than what Ubuntu's OpenBLAS supports. The easiest solution in this case is to specify an alternative architecture manually. To do so, you would need to edit another file:
Where it says
LANG=C debian/rules TARGET=custom build binary
, replace custom
with one of the architectures in the TargetList.txt
file, the latest one that your CPU supports. Then run the compilation again (fakeroot debian/rules custom
) and continue from there.Nvidia GPU support (CUDA)
To be able to train networks on an Nvidia GPU using CUDA, we will need to install the proprietary Nvidia driver and CUDA and adapt some configuration files.
Prerequisites
First we need to install another prerequisite:
Without this, the driver module cannot be compiled.
Driver and CUDA
C Ubuntu 14.04 Dev Tty Library Login
At https://developer.nvidia.com/cuda-downloads, choose the download for Linux > x86_64 > Ubuntu > 14.04 > deb (network).Save it somewhere locally, we assume
/tmp/cuda.deb
, and install it from a terminal:It is important to understand that this has not installed anything yet, it just added Nvidia's package repository to Ubuntu's repository list.Run the following command to update Ubuntu's package database with the new packages available:
Again, this didn't install anything.
There are two options how to proceed from here.
There are two options how to proceed from here.
Option A: Install everything at once
If you don't care, you can just install CUDA along with the examples and the latest driver using:
Option B: Install driver and toolkit separately
To have better control about what's installed when, you can use the repository to only install the latest driver.Run the following in a terminal to see all available Nvidia driver versions:
For example, this may produce:
Usually, you will want to install the latest driver. You need both the normal and the 'uvm' version. Here, it would be:
Now install the toolkit via the runfile from https://developer.nvidia.com/cuda-downloads, at Linux > x86_64 > Ubuntu > 14.04 > runfile (local).When it asks where to install the toolkit, accept the default location (
/usr/local/cuda-x.y
) and let it create the symlink (/usr/local/cuda
).You do not need to install the samples, and you must not install the driver.Note: When installing the CUDA toolkit via the runfile, never install the driver from the runfile. Always install it via
apt-get
as explained before, so the package manager knows. In the worst case, you may end up with an unbootable system otherwise!Configuration
Independently of whether you chose Option A or Option B above, there are a few configuration files we need to create or adapt now.
To make the CUDA compiler available to all users, adapt
/etc/environment
:Add
:/usr/local/cuda/bin
to the end of the list. If instead you want to make it available for the current user only, add export PATH=/usr/local/cuda/bin:'$PATH'
to the end of your ~/.profile
file.To make the libraries available to all users, run the following:
If instead you want to make it available for the current user only, add
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:'$LD_LIBRARY_PATH'
to the end of your ~/.profile
file.Finally, if you haven't done so since the driver installation, you will need to reboot your machine and cross fingers.This is required after every driver update, otherwise CUDA will stop working -- take care when you're maintaining a GPU server. Cooking games free online no download hidden object games.
Testing
For a first sanity check, run
nvidia-smi
from a terminal. It should display information about all supported GPU devices.To also try CUDA, compile a simple test program.
If everything worked, you've got a program you can run now:
It will produce output similar to the following:
If it doesn't, the driver may not have been loaded properly. This can often be fixed by running any CUDA program as root, such as the one we just compiled:
Afterwards it should also work as a normal user. To do this automatically on every boot, do the following:
GPU boost
More recent GPUs support a boosting mode with increased core frequency.It can be enabled as follows:
Where
0
is the device number, and <mem>,<core>
is a pair of frequencies to set (e.g., 3004,875
for a Tesla K40c). The highest supported frequencies for a device can be listed with:To enable boost automatically on every boot, place a shell script executing the correct commands in
/root/gpu_boost.sh
and add it to /etc/cron.d/cuda
as shown in the previous section.Adapt Theano configuration
To make Theano use CUDA automatically for all your scripts, all that's left to do is to create a configuration file in your home directory:
Testing
Again, we will use Theano's BLAS check to test the installation:
Near the end, it should say:
Again, the execution time varies wildly depending on the GPU (it could be over 10 seconds), the critical part is
on GPU
.cuDNN
Finally, for improved performance especially for ConvNets, you should install Nvidia's cuDNN library.After registering at https://developer.nvidia.com/cudnn, you can download it from https://developer.nvidia.com/rdp/cudnn-download.
You will obtain a .tar.gz file. Extract it directly into your CUDA installation:
And update the shared library cache:
Theano and Lasagne should now be able to use cuDNN. To check, run:
If everything is configured correctly, it will say something like:
C Ubuntu 14.04 Dev Tty Library Software
Otherwise you will receive an error message you can search for online.
For somewhat improved performance, you can adapt your
.theanorc
file to include some additional flags:Append the following lines: Traktor scratch download.
Ubuntu 14.04 Download
For more configuration options, consult the Theano documentation.