Skip to content
klbudzin edited this page Sep 23, 2024 · 16 revisions

Install System Specific Dependencies

Using the terminal, install the required prerequisites

sudo apt-get update
sudo apt-get install build-essential gfortran git cmake autoconf automake git python3-distutils libpng-dev libtool clang-format pkg-config valgrind libxml2-dev

Install PETSc

PETSc can be built in two primary configurations, optimized/release and debug. In short, the debug build makes it easier to debug but is slower. The release/optimized build is faster to execute. Microsoft provides a more detailed overview of the differences. The framework requires that PETSc be configured and built with additional options/modules. Detailed instructions for installing PETSc are available at petsc.org, but an abbreviated guide is provided for convenience. Check petsc.org for additional configuration and compiler flags specific to your system.

  1. Clone PETSc git clone https://gitlab.com/petsc/petsc.git
    • To checkout a specific version or commit git checkout main
    • The latest version of PETSc that has been tested against ABLATE is listed on ablate.dev
  2. Configure PETSc to be built in both debug and optimized configurations
    1. Configure PETSc with the following options from the petsc directory to build the debug configuration. Visit the ABLATE wiki for OS specific commands. Run the following make command.

      # Configure debug PETSc
      ./configure PETSC_ARCH=arch-ablate-debug --download-mpich --download-fblaslapack --download-ctetgen --download-tetgen \
           --download-egads --download-fftw --download-hdf5 --download-metis \
           --download-ml --download-mumps --download-p4est \
           --download-parmetis --download-scalapack \
           --download-slepc --download-suitesparse  \
           --download-triangle --with-slepc --download-zlib --with-libpng --download-kokkos-commit=3.7.01 --download-opencascade --download-kokkos
      
      # Follow the on screen directions to make PETSc
    2. Configure PETSc with the following options from the petsc directory to build the release configuration. Run the following make command.

      # Configure opt PETSc
      ./configure PETSC_ARCH=arch-ablate-opt --download-mpich --download-fblaslapack --download-ctetgen --download-tetgen \
           --download-egads --download-fftw --download-hdf5 --download-metis \
           --download-ml --download-mumps --download-p4est \
           --download-parmetis --download-scalapack \
           --download-slepc --download-suitesparse \
           --download-triangle --with-slepc --download-zlib --with-libpng --download-opencascade \
           --download-kokkos-commit=3.7.01 --with-debugging=0 --download-kokkos
      
      # Follow the on screen directions to make PETSc
  3. Set up the environmental variables so that ABLATE can locate PETSc. The PETSC_DIR path should be the path to the downloaded PETSc files. This value is reported in the output of the configure command.
    # Add the following environment variables where PETSC_DIR and PETSC_ARCH are replaced with specified values from the configure command.  On most Linux versions add the following to the ~/.bashrc file.
    
    export PETSC_DIR="/path/to/petsc-install"

Install TensorFlow (Optional)

Some packages in ABLATE require that TensorFlow be available, specially the c library must be available. For most systems this is available as a download, but can be build from source when not available (such as m1 macOS). Follow the directions Build from source and Install TensorFlow for C for step-by-step directions. Specific condition should be paid to python and the python environment. On macOS virtualenv been shown to work.

Once TensorFlow is installed ablate must be reconfigured using cmake with the TENSORFLOW_DIR=/path/to/tensor/flow option. The directory should be the directory with the include and library directories. This can be set as an environmental variable (.bashrc, .profile, .zshrc, .etc) or passed to cmake configure directly -DENSORFLOW_DIR=/path/to/tensor/flow.

Build ABLATE

Follow the step-by-step guide on ablate.dev/content/installation/LocalInstall to download, configure, and build ABLATE locally.

NOTE: Installing the latest CMake manually on Ubuntu 20.04 LTS

Ubuntu 20.04 LTS has CMake 3.16.3 and PETSc requires CMake 3.18 or newer. The latest CMake can be installed globally as follows.

Download the latest CMake binary.

Then, create a dummy package so that the dependencies in apt are satisfied. (In other words, so that apt thinks you have CMake installed.) You can create a template equivs file with equivs-control cmake.ctl (per this tutorial). Then modify the file to state the following:

Section: misc
Priority: optional
Standards-Version: 3.9.2

Package: cmake
Version: 3.22.2
Provides: cmake
Description: cmake dummy package
 This package provides dpkg with the information that cmake is installed.

Then this can be built into a deb file and installed:

equivs-build cmake.ctl
sudo dpkg -i cmake_3.22.2_all.deb

Extract the CMake archive to /usr/local/stow/. Then CMake can be installed (modifying the CMake version number in the directory name as appropriate) via:

cd /usr/local/stow/
sudo stow cmake-3.22.2-linux-x86_64/

If you want to uninstall this version of CMake you can run the following:

cd /usr/local/stow/
sudo stow -D cmake-3.22.2-linux-x86_64/

The cmake-3.22.2-linux-x86_64/ directory will remain in /usr/local/stow/ but the symlinks to /usr/local/bin/ and other places will be removed.

You may run into a difficulty like this: For me (Ben Trettel), /usr/local/man/ was a symlink to basically an empty series of directories in /usr/local/share/man/, so I deleted the symlink and recreated those directories at /usr/local/man/.

Compiling PETSc with Ubuntu packages for BLAS and LAPACK

sudo apt install libblas-dev liblapack-dev
./configure PETSC_ARCH=arch-ablate-debug --download-mpich --download-ctetgen --download-tetgen \
   --download-egads --download-fftw --download-hdf5 --download-metis \
   --download-ml --download-mumps --download-p4est \
   --download-parmetis --download-scalapack \
   --download-slepc --download-suitesparse  \
   --download-triangle --with-slepc --download-zlib --with-libpng \
   --download-opencascade \
   --with-blas-lib=/usr/lib/x86_64-linux-gnu/blas/libblas.a \
   --with-lapack-lib=/usr/lib/x86_64-linux-gnu/lapack/liblapack.a \
   --download-kokkos