Difference between revisions of "Building on Ubuntu"

From GridPACK
Jump to: navigation, search
 
(21 intermediate revisions by 2 users not shown)
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] 13.10. Exactly the same process was also followed for a clean install of [http://www.linuxmint.com/ Linux Mint] 15 on a  [https://www.virtualbox.org/ Virtual Box].
+
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://releases.ubuntu.com/16.04/ Ubuntu Linux 16.04 (LTS)]. Virtual Box is not required and this build should work on Linux systems using the Ubuntu operating system. If you have no need to modify the GridPACK library itself, consider [[Ubuntu_Installation| installing the binary package]]. <span style="color:red">'''You will need super user or sudo privileges for this installation'''</span>.
  
Most of the [[Software_Required_to_Build_GridPACK|prerequisite software]] was installed using [http://www.ubuntu.com/ Ubuntu] packages. [http://www.boost.org Boost] was installed like this
+
A few basic development packages will be necessary. Install them with
  
  sudo apt-get install libboost-all-dev
+
<pre>sudo apt-get install git build-essential devscripts equivs</pre>
  
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
 
  
  sudo apt-get install openmpi-bin make cmake subversion gfortran lapack-dev doxygen
+
== Install Required Packages ==
  
The <code>doxygen</code> package can be skipped, since it installs a large number of dependencies.  
+
Before installing the remaining packages, you ''must'' first download GridPACK onto your computer and put it in a convenient directory. Instructions for downloading GridPACK can be found [[Download_GridPACK| here]].  
  
== Building PETSc ==
+
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 GridPACK repository:
  
[http://www.mcs.anl.gov/petsc/index.html PETSc] version 3.4.3 was configured and built as follows:
+
<pre>sudo mk-build-deps -i</pre>
  
  prefix="$HOME/stuff"
+
This will make and install a virtual package called <code>gridpack-build-deps</code> with all the dependencies needed to build GridPACK.  
  PETSC_DIR="$prefix/petsc-3.4.3"
 
  export PETSC_DIR
 
  python ./config/configure.py \
 
      PETSC_ARCH=arch-linux2-complex-opt \
 
      --with-prefix="$prefix" \
 
      --with-mpi=1 \
 
      --with-cc=mpicc \
 
      --with-fc=mpif90 \
 
      --with-cxx=mpicxx \
 
      --with-c++-support=1 \
 
      --with-c-support=0 \
 
      --with-fortran=0 \
 
      --with-pthread=0 \
 
      --with-scalar-type=complex \
 
      --with-fortran-kernels=generic \
 
      --download-superlu_dist \
 
      --download-parmetis \
 
      --download-metis \
 
      --with-clanguage=c++ \
 
      --with-shared-libraries=0 \
 
      --with-dynamic-loading=0 \
 
      --with-x=0 \
 
      --with-mpirun=mpirun \
 
      --with-mpiexec=mpiexec \
 
      --with-debugging=0
 
  make PETSC_DIR="$prefix/petsc-3.4.3" PETSC_ARCH=arch-linux2-complex-opt all
 
  make PETSC_DIR="$prefix/petsc-3.4.3" PETSC_ARCH=arch-linux2-complex-opt test
 
  
ParMETIS was included in the build, so separate compilation was not necessary.
+
Alternatively, all required packages will be installed by [[Ubuntu_Installation| installing the GridPACK binary package]].
  
== Global Arrays ==
+
== Build and Test GridPACK ==
  
[http://hpc.pnl.gov/globalarrays/ Global Arrays] version 5.2 was configured, built, and installed as follows:
 
  
  prefix="$HOME/stuff"
+
Configure and build GridPACK using the recipe for <code>gridpackvm</code> in <code>example_configuration.sh</code>. From the top-most GridPACK source directory, do the following:
  ./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
 
  make install
 
  
 +
<pre>mkdir src/build
 +
cd src/build
 +
bash ../example_configuration.sh gridpackvm
 +
make
 +
make test</pre>
  
== Building and Testing GridPACK ==
+
Or, modify this configuration recipe to fit your needs:
  
GridPACK was configured and built as follows:
+
<pre>CC=gcc
 +
CXX=g++
 +
export CC CXX
  
  rm -f CMakeCache.txt
+
cmake \
  prefix="$HOME/stuff"
+
    -D PETSC_DIR:STRING=&quot;/usr/lib/petscdir/3.6.2&quot; \
  cmake -Wno-dev --debug-try-compile \
+
    -D PETSC_ARCH:STRING=&quot;x86_64-linux-gnu-real&quot; \
      -D PETSC_DIR:STRING="$prefix/petsc-3.4.3" \
+
    -D PARMETIS_DIR:PATH=&quot;/usr&quot; \
      -D PETSC_ARCH:STRING="arch-linux2-complex-opt" \
+
    -D GA_EXTRA_LIBS:STRING=&quot;-lscalapack-openmpi -lblacsCinit-openmpi -lblacs-openmpi -llapack -lblas -lgfortran&quot; \
      -D GA_DIR:STRING="$prefix" \
+
    -D MPI_CXX_COMPILER:STRING=&quot;mpicxx&quot; \
      -D MPI_CXX_COMPILER:STRING="mpicxx" \
+
    -D MPI_C_COMPILER:STRING=&quot;mpicc&quot; \
      -D MPI_C_COMPILER:STRING="mpicc" \
+
    -D MPIEXEC:STRING=&quot;mpiexec&quot; \
      -D MPIEXEC:STRING="mpiexec" \
+
    -D MPIEXEC_MAX_NUMPROCS:STRING=&quot;2&quot; \
      -D CMAKE_BUILD_TYPE:STRING="Debug" \
+
    -D GRIDPACK_TEST_TIMEOUT:STRING=60 \
      -D CMAKE_VERBOSE_MAKEFILE:BOOL=TRUE \
+
    -D USE_GLPK:BOOL=ON \
      ..
+
    -D GLPK_ROOT_DIR:PATH=&quot;/usr&quot; \
  make  
+
    -D BUILD_SHARED_LIBS:BOOL=OFF \
  make test
+
    -D CMAKE_INSTALL_PREFIX:PATH=&quot;$HOME/gridpack&quot; \
 +
    -D CMAKE_VERBOSE_MAKEFILE:BOOL=TRUE \
 +
    ..
 +
make</pre>
 +
 
 +
If compilation is successful, the [[How to Build GridPACK#Running Tests|unit tests]] and/or [[How to Build GridPACK#Running_the_Powerflow_Example.28s.29|example applications]] can be run. 
 +
 
 +
== Removing Required Software ==
 +
 
 +
If no longer needed, the required packages can be removed using
 +
 
 +
 
 +
<pre>sudo apt-get purge gridpack-build-deps
 +
sudo apt autoremove</pre>

Latest revision as of 15:09, 9 May 2019

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). Virtual Box is not required and this build should work on Linux systems using the Ubuntu operating system. If you have no need to modify the GridPACK library itself, consider installing the binary package. You will need super user or sudo privileges for this installation.

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

sudo apt-get install git build-essential devscripts equivs


Install Required Packages

Before installing the remaining packages, you must first download GridPACK onto your computer and put it in a convenient directory. Instructions for downloading GridPACK can be found here.

All the GridPACK prerequisites packages can be installed using the packaging information in the source. Run this command in the top directory of the GridPACK 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. From the top-most GridPACK source directory, do the following:

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=60 \
    -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 \
    ..
make

If compilation is successful, the unit tests and/or example applications can be run.

Removing Required Software

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


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