Manual Installation GCC/MPICH
Minimum System Requirements
In general, the following is required for MOOSE-based development:
GCC/Clang C++14 compliant compiler (GCC @ 5.1.0, Clang @ 3.5.1 or greater)
Note: Intel compilers are not supported.
Memory: 16 GBs (debug builds)
Processor: 64-bit x86
Cmake 3.4 or greater will be needed for building some of the optional packages distributed with PETSc that MOOSE requires. Unless your system is very old, one should be able to use their system's package manager (apt-get, yum, zypper, etc) to install a compatible version of Cmake. For older systems, you will need to obtain cmake source from http://www.cmake.org, and build it appropriately for your system.
A sane environment. This means having a clean, nothing but the bare minimum as far as available libraries go in your running environment. No additional LD_LIBRARY_PATHs, or other extra PATHs set. No strange UMASK settings. No odd aliases. This is such an important step, that we advise if possible, to create a separate account strictly for the use of these instructions. This document assumes an account called 'moose' has been created and is the account currently in use.
Lets try to make our environment as sane as possible, while setting up all the locations we will need.
bash --noprofile export PACKAGES_DIR=/some/path/with/write/access export STACK_SRC=`mktemp -d /tmp/moose_stack_src.XXXXXX` umask 022 mkdir -p $PACKAGES_DIR
What ever terminal you were in, while you performed the above commands, you MUST remain in that terminal, for the remainder of the instructions. If this terminal is closed, it will be necessary to START OVER.
We need a modern C++11 capable compiler. Our minimum requirements are: GCC 5.1.0, Clang 3.5.1. This section will focus on building a GCC 9.2.0 compiler stack.
What version of GCC do we have?
gcc --version gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4) Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
If your version is less than 5.1.0, you will need to build a newer version. If your version is at or greater than 5.1.0, you have the option of skipping the GCC section.
cd $STACK_SRC curl -L -O http://mirrors.concertpass.com/gcc/releases/gcc-9.2.0/gcc-9.2.0.tar.gz tar -xf gcc-9.2.0.tar.gz -C .
Obtain GCC pre-reqs:
cd $STACK_SRC/gcc-9.2.0 ./contrib/download_prerequisites
Configure, build and install GCC:
mkdir $STACK_SRC/gcc-build cd $STACK_SRC/gcc-build ../gcc-9.2.0/configure --prefix=$PACKAGES_DIR/gcc-9.2.0 \ --disable-multilib \ --enable-languages=c,c++,fortran,jit \ --enable-checking=release \ --enable-host-shared \ --with-pic make -j # (where # is the number of cores available) make install
Any errors during configure/make will need to be investigated on your own. Every operating system I have come across has its own nuances of getting stuff built. Normally any issues are going to be solved by installing the necessary development libraries using your system package manager (apt-get, yum, zypper, etc). Hint: I would search the internet for 'how to build GCC 9.2.0 on (insert the name/version of your operating system here)'
In order to utilize our newly built GCC 9.2.0 compiler, we need to set some variables:
export PATH=$PACKAGES_DIR/gcc-9.2.0/bin:$PATH export LD_LIBRARY_PATH=$PACKAGES_DIR/gcc-9.2.0/lib64:$PACKAGES_DIR/gcc-9.2.0/lib:$PACKAGES_DIR/gcc-9.2.0/lib/gcc/x86_64-pc-linux-gnu/9.2.0:$PACKAGES_DIR/gcc-9.2.0/libexec/gcc/x86_64-pc-linux-gnu/9.2.0:$LD_LIBRARY_PATH
Check and see if you already have an MPI wrapper available on your machine. One simple way of doing so, is to perform a
which on the three necessary MPI wrapper binaries:
which mpicc mpicxx mpif90 | wc -l
If the above command returns '3', then you may skip the MPICH section. However, if you ended up building your own GCC compiler above, you will want to NOT skip this step. With the reason being, it is generally best to build an MPI wrapper based on the compiler you plan to use.
Download MPICH 3.3
cd $STACK_SRC curl -L -O http://www.mpich.org/static/downloads/3.3/mpich-3.3.tar.gz tar -xf mpich-3.3.tar.gz -C .
Now we create an out-of-tree build location, configure, build, and install it
mkdir $STACK_SRC/mpich-3.3/gcc-build cd $STACK_SRC/mpich-3.3/gcc-build ../configure --prefix=$PACKAGES_DIR/mpich-3.3 \ --enable-shared \ --enable-sharedlibs=gcc \ --enable-fast=O2 \ --enable-debuginfo \ --enable-totalview \ --enable-two-level-namespace \ CC=gcc \ CXX=g++ \ FC=gfortran \ F77=gfortran \ F90='' \ CFLAGS='' \ CXXFLAGS='' \ FFLAGS='' \ FCFLAGS='' \ F90FLAGS='' \ F77FLAGS='' make -j # (where # is the number of cores available) make install
In order to utilize our newly built MPI wrapper, we need to set some variables:
export PATH=$PACKAGES_DIR/mpich-3.3/bin:$PATH export CC=mpicc export CXX=mpicxx export FC=mpif90 export F90=mpif90 export C_INCLUDE_PATH=$PACKAGES_DIR/mpich-3.3/include:$C_INCLUDE_PATH export CPLUS_INCLUDE_PATH=$PACKAGES_DIR/mpich-3.3/include:$CPLUS_INCLUDE_PATH export FPATH=$PACKAGES_DIR/mpich-3.3/include:$FPATH export MANPATH=$PACKAGES_DIR/mpich-3.3/share/man:$MANPATH export LD_LIBRARY_PATH=$PACKAGES_DIR/mpich-3.3/lib:$LD_LIBRARY_PATH
Download PETSc 3.11.4
cd $STACK_SRC curl -L -O http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.11.4.tar.gz tar -xf petsc-3.11.4.tar.gz -C .
Now we configure, build, and install it
cd $STACK_SRC/petsc-3.11.4 ./configure \ --prefix=$PACKAGES_DIR/petsc-3.11.4 \ --with-debugging=0 \ --with-ssl=0 \ --with-pic=1 \ --with-openmp=1 \ --with-mpi=1 \ --with-shared-libraries=1 \ --with-cxx-dialect=C++11 \ --with-fortran-bindings=0 \ --with-sowing=0 \ --download-hypre=1 \ --download-fblaslapack=1 \ --download-metis=1 \ --download-ptscotch=1 \ --download-parmetis=1 \ --download-superlu_dist=1 \ --download-scalapack=1 \ --download-mumps=1 \ --download-slepc=1 \ PETSC_DIR=`pwd` PETSC_ARCH=linux-opt
Once configure is done, we build PETSc
make PETSC_DIR=$STACK_SRC/petsc-3.11.4 PETSC_ARCH=linux-opt all
Everything good so far? PETSc should be asking to run more make commands
make PETSC_DIR=$STACK_SRC/petsc-3.11.4 PETSC_ARCH=linux-opt install
And now after the install, we can run some built-in tests
make PETSC_DIR=$PACKAGES_DIR/petsc-3.11.4 PETSC_ARCH="" test
Running the tests should produce some output like the following:
[moose@centos-8 petsc-3.11.4]$ make PETSC_DIR=$PACKAGES_DIR/petsc-3.11.4 PETSC_ARCH="" test Running test examples to verify correct installation Using PETSC_DIR=/opt/moose/petsc-3.11.4 and PETSC_ARCH= C/C++ example src/snes/examples/tutorials/ex19 run successfully with 1 MPI process C/C++ example src/snes/examples/tutorials/ex19 run successfully with 2 MPI processes Fortran example src/snes/examples/tutorials/ex5f run successfully with 1 MPI process Completed test examples =========================================
Peacock (an optional MOOSE GUI frontend) uses many libraries. The easiest way to obtain these libraries, is to install miniconda, along with several miniconda/pip packages.
cd $STACK_SRC curl -L -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh sh Miniconda3-latest-Linux-x86_64.sh -b -p $PACKAGES_DIR/miniconda PATH=$PACKAGES_DIR/miniconda/bin:$PATH conda install coverage \ reportlab \ mako \ numpy \ scipy \ scikit-learn \ h5py \ hdf5 \ scikit-image \ requests \ vtk \ pyyaml \ matplotlib \ pip \ lxml \ pyflakes \ pandas \ conda-build \ mock \ yaml \ pyqt \ swig --yes
Next, we need to use
pip to install additional libraries not supplied by conda:
PATH=$PACKAGES_DIR/miniconda/bin:$PATH pip install --no-cache-dir pybtex livereload daemonlite pylint lxml pylatexenc anytree
Now that everything has been installed, its time to wrap all these environment variables up, and throw them in a bash shell profile somewhere.
Append the following contents into a new file called
#!/bin/bash ### MOOSE Environment Profile # GCC 9.2.0 # MPICH 3.3 # PETSc 3.11.4 export PACKAGES_DIR=<what ever you exported initially during the Environment setup> export PATH=$PACKAGES_DIR/gcc-9.2.0/bin:$PACKAGES_DIR/mpich-3.3/bin:$PACKAGES_DIR/miniconda/bin:$PATH export LD_LIBRARY_PATH=$PACKAGES_DIR/gcc-9.2.0/lib64:$PACKAGES_DIR/gcc-9.2.0/lib:$PACKAGES_DIR/gcc-9.2.0/lib/gcc/x86_64-pc-linux-gnu/9.2.0:$PACKAGES_DIR/gcc-9.2.0/libexec/gcc/x86_64-pc-linux-gnu/9.2.0:$PACKAGES_DIR/mpich-3.3/lib:$LD_LIBRARY_PATH export C_INCLUDE_PATH=$PACKAGES_DIR/mpich-3.3/include:$C_INCLUDE_PATH export CPLUS_INCLUDE_PATH=$PACKAGES_DIR/mpich-3.3/include:$CPLUS_INCLUDE_PATH export FPATH=$PACKAGES_DIR/mpich-3.3/include:$FPATH export MANPATH=$PACKAGES_DIR/mpich-3.3/share/man:$MANPATH export PETSC_DIR=$PACKAGES_DIR/petsc-3.11.4 export CC=mpicc export CXX=mpicxx export FC=mpif90 export F90=mpif90
Thats it! Now you can either source this file manually each time you need to work on a MOOSE based application:
Or you can permanently have it loaded each time you open a terminal by adding the above
source command in your ~/.bash_profile (or ~/.bashrc which ever your system uses).
Whith everything finished, it is now safe to remove the temporary directory containing the source tree:
if [ -d "$STACK_SRC" ]; then rm -rf "$STACK_SRC"; fi
Compiler Stack Finished
With the compiler stack ready, you can proceed to Obtaining and Building MOOSE.