Building and Executing PetaVision - PetaVision/OpenPV GitHub Wiki
This page describes how to configure, compile, and test OpenPV after all of the dependencies are met. To install dependencies, please see the installation page for your system:
Downloading and Building OpenPV
Downloading the OpenPV Repository:
To download the OpenPV repository, run the following command:
git clone -b develop https://github.com/PetaVision/OpenPV.git
The above command creates the directory OpenPV, downloads the git repository into it, and switches into the develop branch. We recommend working from the develop branch because this branch will have the most up-to-date features and bugfixes.
Building (Simplest Method):
After downloading the repository, run the following commands:
mkdir build-OpenPV
cd build-OpenPV
cmake ../OpenPV
make
# Some build options to the above cmake command:
# If CUDA is installed but you don't want CUDA support
cmake -DPV_USE_CUDA:Bool=OFF ../OpenPV
# Debug build (Release is the default)
# Use this option to make use of line debuggers like gdb or lldb.
cmake -DCMAKE_BUILD_TYPE:String=Debug ../OpenPV
Customizing the Build/Troubleshooting
ccmake provides a command-line gui for editing the cmake variables.
ccmake ../OpenPV #(From the build directory)
-
Press
cto configure. You may see errors or warnings; if so, presseto exit this screen. -
Ccmake will display the cmake variables along with any values it was able to automatically populate.
-
If any errors occured during configuration, fix the corresponding cmake variables
-
(Point cmake to the necessary library locations, turn off features if their dependencies don't exist on the system, etc.)
-
Relevant cmake variables are listed below.
-
For more information on using these variables, please see the descriptions page.
-
To change a variable, select and press return.
-
Press
cagain to reconfigure (If new variables are generated, presscagain). -
If configuration is complete, press
gto generate the makefile.
Relevant cmake variables:
CMAKE_BUILD_TYPE: Set to Release for a production run, Debug to add debug flags.
CUDNN_PATH: If you are using cuDNN, set this string to the absolute path of the directory containing cuDNN (both the header file and the library). If you are not using cuDNN, this variable is ignored.
PV_BUILD_TEST: Default ON. Leave on to compile OpenPV with the system tests.
PV_BUILD_SHARED: Turn off.
PV_DIR: This should be the absolute path to the src directory inside OpenPV.
PV_MPI_OPTIONS_EXTRA: Options to pass to the mpi executable when
running multi-process system tests. For example, set this option to
--oversubscribe to run the tests that use more MPI processes than
your system allows by default.
PV_OPENMP_FLAG: If you are using OpenMP and are on a Linux
system using gcc, set this to -fopenmp. If you are using OpenMP on a
Mac, set this to the argument that clang needs to compile with OpenMP. If
you followed the instructions on the macOS Installation
page, set this variable to -fopenmp=libomp.
PV_SYSTEM_TEST_THREADS: Leave blank if compiling without OPENMP. Set something small to run system tests quickly (1-4).
PV_USE_CUDA: If you have NVIDIA CUDA installed and want to use GPU acceleration, turn this on; otherwise turn it off.
PV_USE_LUA: If you have liblua 5.2 or later (the library, not the executable), turn this on to be able to pass a lua script as PetaVision input.
PV_USE_MPI: If you have Open MPI installed and want to use MPI parallelization, turn this on. Otherwise, turn it off.
PV_USE_OPENMP: If you have OpenMP installed and want to use thread parallelization, turn this on. Otherwise, turn it off.
Building and Running the Tests
Once the makefile has been generated with cmake/ccmake, run make in the build directory.
make
# make -j[n] to compile in parallel over n threads
To run the system tests
ctest
# ctest -j[n] to run n tests in parallel
Building OpenPV With a Custom Project
- By default, cmake will build only the core library and the system tests.
- If you would like to compile your project with OpenPV, instructions can be found here.