GridPACK on Ubuntu - wperkins/GridPACK GitHub Wiki

GridPACK on Ubuntu 16.04 LTS

GridPACK is relatively easy to build or install on an Ubuntu Linux system. Working packages for GridPACK prerequisites are available from standard repositories. Currently, the description below work only with Ubuntu 16.04 which is the current long term support (LTS) release. If you are installing Ubuntu on a system or virtual machine, download the 16.04 LTS Desktop distribution and follow the installation instructions.

GridPACK Binary Package Installation

If you do not need to modify the GridPACK source, e.g. just use the GridPACK example applications or build your own application, you can install the binary package from the GridPACK PPA. Add the PPA to your system, and install GridPACK with

sudo add-apt-repository ppa:wperkins/gridpack-ppa
sudo apt-get update
sudo apt-get install gridpack-dev

To use GridPACK, you will also need to install CMake:

sudo apt-get install cmake

Make sure your installation works by building and running one of the example applications, e.g. power flow:

mkdir tmpbuild
cd tmpbuild
cmake /usr/share/gridpack/example/powerflow
make
mpiexec -np 4 ./powerflow.x

Also, you can run the installed powerflow application on this same input:

mpiexec -np 4 /usr/bin/pf.x

GridPACK can be removed with

sudo apt-get purge gridpack-dev
sudo apt autoremove

Build GridPACK from Source

A few more packages will be necessary to build GridPACK from source. Install them with

sudo apt-get install git build-essential devscripts equivs

Clone the GridPACK source:

git clone https://github.com/GridOPTICS/GridPACK.git
cd GridPACK
git submodule update --init

All the GridPACK prerequisites packages can be installed using the packaging information in the source. Run this command in the top directory of the cloned repository:

sudo mk-build-deps -i

This will make and install a virtual package called gridpack-build-deps with all the dependencies needed to build GridPACK. Configure and build GridPACK using the recipe for gridpackvm in example_configuration.sh:

mkdir src/build
cd src/build
bash ../example_configuration.sh gridpackvm
make 
make test

Or, modify this configuration recipe to fit your needs:

CC=gcc
CXX=g++
export CC CXX

cmake \
    -D PETSC_DIR:STRING="/usr/lib/petscdir/3.6.2" \
    -D PETSC_ARCH:STRING="x86_64-linux-gnu-real" \
    -D PARMETIS_DIR:PATH="/usr" \
    -D GA_EXTRA_LIBS:STRING="-lscalapack-openmpi -lblacsCinit-openmpi -lblacs-openmpi -llapack -lblas -lgfortran" \
    -D MPI_CXX_COMPILER:STRING="mpicxx" \
    -D MPI_C_COMPILER:STRING="mpicc" \
    -D MPIEXEC:STRING="mpiexec" \
    -D MPIEXEC_MAX_NUMPROCS:STRING="2" \
    -D GRIDPACK_TEST_TIMEOUT:STRING=20 \
    -D USE_GLPK:BOOL=ON \
    -D GLPK_ROOT_DIR:PATH="/usr" \
    -D BUILD_SHARED_LIBS:BOOL=OFF \
    -D CMAKE_INSTALL_PREFIX:PATH="$HOME/gridpack" \
    -D CMAKE_VERBOSE_MAKEFILE:BOOL=TRUE \
    ..

If no longer needed, the required packages can be removed using

sudo apt-get purge gridpack-build-deps
sudo apt autoremove