Difference between revisions of "Building on Ubuntu"

From GridPACK
Jump to: navigation, search
(Building and Testing GridPACK)
Line 1: Line 1:
This build was performed on a [https://www.virtualbox.org/ Virtual Box] instance running a clean install of [http://www.ubuntu.com/ Ubuntu Linux] 16.04 (LTS). Most of the [[Software_Required_to_Build_GridPACK|prerequisite software]] was installed using [http://www.ubuntu.com/ Ubuntu] packages. Any packages that needed to be built from source were installed in /usr/local/gridpack
+
GridPACK is relatively easy to build on Ubuntu Linux systems. This example was performed on a [https://www.virtualbox.org/ Virtual Box] instance running a clean install of [http://www.ubuntu.com/ Ubuntu Linux] 16.04 (LTS).  
  
[http://www.boost.org Boost] was installed like this
+
If you have no need to modify the GridPACK library itself, consider [[Ubuntu_Installation| installing the binary package]].  
  
  sudo apt-get install libboost-all-dev
+
A few basic development packages will be necessary. Install them with
  
This installed a C++ compiler and [http://www.open-mpi.org/ OpenMPI] compiler wrappers, as well as all of [http://www.boost.org/ Boost].  Other available packages were installed using
+
<pre>sudo apt-get install git build-essential devscripts equivs</pre>
  
  sudo apt-get install openmpi-bin make cmake git gfortran liblapack-dev doxygen
+
== Obtain GridPACK Source ==
  
The <code>doxygen</code> package can be skipped, since it installs a large number of dependencies.  A compatible ParMETIS package is available, so install that
+
In a convenient location, clone the GridPACK repository
  
  sudo apt-get install libmetis-dev libparmetis-dev
+
<pre>git clone https://github.com/GridOPTICS/GridPACK.git
 +
cd GridPACK
 +
git submodule update --init</pre>
  
The free GNU linear programming kit can be installed and used by GridPACK for optimization, if desired
+
== Install Required Packages ==
  
  sudo apt-get install glpk-utils  libglpk-dev
+
All the [https://www.gridpack.org/wiki/index.php/Software_Required_to_Build_GridPACK GridPACK prerequisites] packages can be installed using the packaging information in the source. Run this command in the top directory of the cloned repository:
  
== PETSc ==
+
<pre>sudo mk-build-deps -i</pre>
  
Ubuntu packages for [http://www.mcs.anl.gov/petsc/index.html PETSc] 3.6 were available.  These can be installed with
+
This will make and install a virtual package called <code>gridpack-build-deps</code> with all the dependencies needed to build GridPACK.  
  
  sudo apt-get petsc3.6-dev petsc-complex-3.6-dev
+
Alternatively, all required packages will be installed by [[Ubuntu_Installation| installing the GridPACK binary package]].
  
These are built with several optional packages, including Hypre, SuiteSparse, and MUMPS. SuperLU is also include, not SuperLU_DIST, which  will limit direct linear solver methods in parallel. Alternatively, [http://www.mcs.anl.gov/petsc/index.html PETSc] can be built from source.
+
== Build and Test GridPACK ==
  
== Global Arrays ==
+
Configure and build GridPACK using the recipe for <code>gridpackvm</code> in <code>example_configuration.sh</code>:
  
[http://hpc.pnl.gov/globalarrays/ Global Arrays] from SVN was configured, built, and installed as follows:
+
<pre>mkdir src/build
 +
cd src/build
 +
bash ../example_configuration.sh gridpackvm
 +
make
 +
make test</pre>
  
  svn co https://svn.pnl.gov/svn/hpctools/trunk/ga ga-trunk
+
Or, modify this configuration recipe to fit your needs:
  cd ga-trunk
 
  prefix="/usr/local/gridpack"
 
  ./configure \
 
      --enable-cxx \
 
      --enable-i4 \
 
      --disable-f77 \
 
      --with-mpi \
 
      --prefix="$prefix" \
 
      --with-blas=no \
 
      --with-lapack=no \
 
      --enable-shared=no \
 
      --enable-static=yes \
 
      MPICC=mpicc MPICXX=mpicxx MPIF77=mpif90 \
 
      MPIEXEC=mpiexec MPIRUN=mpirun
 
  make
 
  sudo make install
 
  
 +
<pre>CC=gcc
 +
CXX=g++
 +
export CC CXX
  
== Building and Testing GridPACK ==
+
cmake \
 +
    -D PETSC_DIR:STRING=&quot;/usr/lib/petscdir/3.6.2&quot; \
 +
    -D PETSC_ARCH:STRING=&quot;x86_64-linux-gnu-real&quot; \
 +
    -D PARMETIS_DIR:PATH=&quot;/usr&quot; \
 +
    -D GA_EXTRA_LIBS:STRING=&quot;-lscalapack-openmpi -lblacsCinit-openmpi -lblacs-openmpi -llapack -lblas -lgfortran&quot; \
 +
    -D MPI_CXX_COMPILER:STRING=&quot;mpicxx&quot; \
 +
    -D MPI_C_COMPILER:STRING=&quot;mpicc&quot; \
 +
    -D MPIEXEC:STRING=&quot;mpiexec&quot; \
 +
    -D MPIEXEC_MAX_NUMPROCS:STRING=&quot;2&quot; \
 +
    -D GRIDPACK_TEST_TIMEOUT:STRING=20 \
 +
    -D USE_GLPK:BOOL=ON \
 +
    -D GLPK_ROOT_DIR:PATH=&quot;/usr&quot; \
 +
    -D BUILD_SHARED_LIBS:BOOL=OFF \
 +
    -D CMAKE_INSTALL_PREFIX:PATH=&quot;$HOME/gridpack&quot; \
 +
    -D CMAKE_VERBOSE_MAKEFILE:BOOL=TRUE \
 +
    ..</pre>
  
GridPACK was configured and built as follows:  
+
Then, build and test GridPACK normally:
 +
'''
 +
make
 +
make test
 +
'''
  
  prefix="/usr/local/gridpack"
+
== Removing Required Software ==
  cmake -Wno-dev --debug-try-compile \
+
 
      -D PETSC_DIR:STRING="/usr/lib/petscdir/3.6.2" \
+
If no longer needed, the required packages can be removed using
      -D PETSC_ARCH:STRING="x86_64-linux-gnu-real" \
+
 
      -D GA_DIR:STRING="$prefix" \
+
 
      -D MPI_CXX_COMPILER:STRING="mpicxx" \
+
<pre>sudo apt-get purge gridpack-build-deps
      -D MPI_C_COMPILER:STRING="mpicc" \
+
sudo apt autoremove</pre>
      -D MPIEXEC:STRING="mpiexec" \
 
      -D MPIEXEC_MAX_NUMPROCS:STRING="2" \
 
      -D GRIDPACK_TEST_TIMEOUT:STRING=20 \
 
      -D USE_GLPK:BOOL=OFF \
 
      -D CMAKE_INSTALL_PREFIX:PATH="$prefix" \
 
      ..
 
    make
 
    make test
 

Revision as of 15:07, 5 January 2018

GridPACK is relatively easy to build on Ubuntu Linux systems. This example was performed on a Virtual Box instance running a clean install of Ubuntu Linux 16.04 (LTS).

If you have no need to modify the GridPACK library itself, consider installing the binary package.

A few basic development packages will be necessary. Install them with

sudo apt-get install git build-essential devscripts equivs

Obtain GridPACK Source

In a convenient location, clone the GridPACK repository

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

Install Required Packages

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.

Alternatively, all required packages will be installed by installing the GridPACK binary package.

Build and Test 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 \
    ..

Then, build and test GridPACK normally: make make test

Removing Required Software

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


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