Skip to content

Ubuntu Installation

Pete Schultz edited this page May 4, 2023 · 15 revisions

This page provides instructions for installing PetaVision on Ubuntu 16.04, beginning with a clean installation of Ubuntu. You will need administrator privileges to run sudo.

Required packages

sudo apt-get install build-essential 
sudo apt-get install flex
sudo apt-get install bison 
sudo apt-get install cmake 
sudo apt-get install cmake-curses-gui
sudo apt-get install gcc 
sudo apt-get install g++ 
sudo apt-get install git 

Optional (but strongly suggested) packages

# Open MPI for parallelism in OpenPV
sudo apt-get install libopenmpi-dev openmpi-bin 

# lua for writing more complex parameter files
sudo apt-get install lua5.2 

# Tools for drawing network diagrams from parameter files
sudo apt-get install npm nodejs-legacy # Needed by tool for drawing diagrams of params files.
sudo npm install -g phantomjs     # Needed by tool for drawing diagrams of params files.
sudo npm install -g [email protected] Needed by tool for drawing diagrams of params files.

Note: as of this writing (July 2017), the most recent version of mermaid, 7.0.3, has a bug in drawing arrowheads. Accordingly, be sure to specify the version 7.0.0.

CUDA/cuDNN (Optional)

Our GPU acceleration depends on CUDA and cuDNN. While it is possible to build and run PetaVision without CUDA, performance will not be nearly as good.

To download CUDA, go to https://developer.nvidia.com/cuda-downloads. Click the RUN file for your architecture and your version of Ubuntu. Note the location.

The version of the NVIDIA driver installed by CUDA may be behind the most recent driver version released by NVIDIA. If you want to use a more recent driver, you will need to install CUDA first, along with the driver that CUDA installs, and then upgrade the NVIDIA driver.
If you want to use the most recent NVIDIA driver, go to http://www.nvidia.com/Download/index.aspx?lang=en-us and select your video card. Download the linux RUN file. Note the location.

NVIDIA drivers cannot be installed while the X window system is running. Here's how to install the drivers.

Enter a virtual console (usually by pressing control-alt-F1 or control-alt-fn-F1). Log into an account with admin privileges.

sudo service lightdm stop
chmod u+x path/to/cuda.run
sudo path/to/cuda.run

Follow the onscreen instructions. We have seen the warning "The distribution-provided pre-install script failed!" but it does not seem to cause problems if you continue.

When it asks if you want to install NVIDIA driver, select yes. Add a symbolic link to /usr/local/cuda when asked.

If you now want to upgrade the NVIDIA driver to a version downloaded above.

cd path/to/driver.run
chmod u+x path/to/driver.run
./path/to/driver.run

Follow the instructions on the screen. When asked to uninstall the existing driver (installed by cuda), select yes. When asked to update your Xorg, select yes. This will use this driver as your GUI display.

Reboot.

Run nvidia-smi and make sure you see your video card.

Next you will need to download the cuDNN Deep Neural Network Library, which provides additional speed-up in computing the convolutions we use to compute input to post-synaptic layers.

To download cuDNN, go to https://developer.nvidia.com/cuDNN and click Download. If you haven't already registered with NVIDIA Developer you will need to do so, and then wait for email confirmation. Once registered, log into NVIDIA Developer and download the cuDNN Library for Linux. (Alternatively, if you have access to NMC's compneuro, grab it from /nh/compneuro/Data/cuDNN)

Unpack the .tgz file with the command

tar -xzf /path/to/downloaded/file -C /path/to/desired/cudnn/location

If you omit the -C /path/to/desired/cudnn/location option, tar will expand into the current working directory. This command will create a directory /path/to/desired/cudnn/location/cuda; when running cmake or ccmake (see below), you will need to set CUDNN_PATH to the full path to this directory.

Checking Out and Installing OpenPV

To build OpenPV and run the system tests, please see this page.

Analysis tools

We have provided some tools for working with PetaVision output files, in GNU Octave and Python versions.

Ubuntu comes with Python installed by default, although 18.04 and older versions have Python version 2 by default. We recommend upgrading to version 3.

To use the Python tools, you will need to add PetaVision to the PYTHONPATH environment variable.

export PYTHONPATH="${PYTHONPATH}:/path/to/source/OpenPV/python

For more details see the Python PV Tools wiki.

If you would prefer to use GNU Octave, install Octave and needed packages as follows:

sudo apt-get install octave octave-image octave-parallel
echo "addpath('/path/to/OpenPV/source/mlab/util/')" >> ~/.octaverc
echo "pkg load image parallel" >> ~/.octaverc # loads specified packages when starting octave.