Building GridPACK from source gives you full control over compiler flags, dependency versions, and optional features such as the Python interface and progress-ranks runtime for Global Arrays. GridPACK has been built and tested on Linux (Ubuntu, RHEL, CentOS, Debian), macOS, and HPC clusters. The process involves installing three external libraries — Boost, Global Arrays, and PETSc — and then configuring and compiling GridPACK itself with CMake.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/GridOPTICS/GridPACK/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before you begin, make sure the following tools are available on your system:| Requirement | Minimum version | Notes |
|---|---|---|
| CMake | 3.22 | Required by src/CMakeLists.txt |
| GCC (GNU compiler) | Any recent version | C++ support required; Fortran optional |
| MPI | Any | OpenMPI or MPICH; provides mpicc, mpicxx, mpiexec |
apt-get install openmpi-bin openmpi-common libopenmpi-dev. On macOS, use brew install open-mpi.
Using the convenience scripts
Install external dependencies
Run the dependency script from the top-level GridPACK directory. It downloads and builds Boost 1.81.0, Global Arrays 5.9, and PETSc (3.20.6), placing everything under After the script completes, source the generated environment file to configure library paths:
external-dependencies/:Build GridPACK
Run the GridPACK build script. By default it builds GridPACK with shared libraries and the Python interface:To build without the Python interface, edit the top of After a successful run, two directories are created under
install_gridpack.sh and set:src/:src/build/— application executables and test inputssrc/install/— installed libraries, headers, and Python packages
Manual build
If the scripts do not work on your platform, build each dependency by hand and then configure GridPACK with CMake.Clone the repository and initialize submodules
The
git submodule update --init command is required when building from a Git clone. If you are building from a release tarball, the submodules are already included.Install Boost 1.78.0
GridPACK requires Boost built with the Edit the generated Then build and install:A successful install creates
mpi, serialization, random, filesystem, and system libraries.project-config.jam and add this line to enable MPI support:To build Boost as shared libraries (required if you plan to build GridPACK with shared libraries or the Python interface), use
link=shared instead of link=static.include/ and lib/ subdirectories inside install_for_gridpack/.Install Global Arrays 5.8
Global Arrays (GA) provides the one-sided communication layer used by GridPACK.To build GA as shared libraries, add
--with-mpi-ts selects the MPI two-sided runtime, which is the simplest and most portable option. For large-scale runs (more than ~12 processes), consider switching to the progress-ranks runtime (--with-mpi-pr). See the Section3-ConfigureBuild docs for details.--enable-shared to the configure command.Install PETSc 3.16.4
PETSc provides the parallel linear algebra and solver infrastructure used throughout GridPACK.
--download-f2cblaslapack is not needed if your system has a compatible BLAS/LAPACK. --download-cmake is not needed if CMake 3.18.1 or newer is available. To build PETSc as shared libraries, add --with-shared-libraries=1.Configure GridPACK with CMake
Create a build directory under Create a file named Key CMake variables:
Make the script executable and run it:
GridPACK/src/ and run CMake with paths to the installed dependencies. It is best practice to put the CMake invocation in a shell script so it can be re-run and edited easily.build.sh with the following content, adjusting the paths to match your installation directories:| Variable | Description |
|---|---|
GA_DIR | Path to the Global Arrays install prefix |
BOOST_ROOT | Path to the Boost install prefix |
PETSC_DIR | Path to the PETSc install prefix |
MPI_CXX_COMPILER | MPI C++ wrapper (typically mpicxx) |
MPI_C_COMPILER | MPI C wrapper (typically mpicc) |
MPIEXEC | MPI launch command (typically mpiexec or mpirun) |
CMAKE_INSTALL_PREFIX | Directory where GridPACK will be installed |
CMAKE_BUILD_TYPE | Debug, Release, or RelWithDebInfo |
BUILD_SHARED_LIBS | Set to YES to build shared libraries instead of static |
If you installed PETSc without
--prefix, it writes files to $PETSC_DIR/$PETSC_ARCH. In that case, add -D PETSC_ARCH=<your-arch-name> to the CMake command.Compile and install
src/install/ contains the GridPACK libraries and headers, and src/build/ contains the application executables.Shared vs. static libraries
By default, GridPACK builds static libraries. To build shared libraries — required for the Python interface — add-D BUILD_SHARED_LIBS=YES to the CMake command and ensure that Boost, GA, and PETSc were also built as shared libraries. Building with shared libraries is what the convenience scripts and Docker image use.
Next steps
What is GridPACK
Learn about GridPACK’s capabilities, supported formats, and framework architecture.
Power flow application
Run your first power flow simulation using a PSS/E RAW file as input.