Follow these instructions to build a basic framework stack on Linux.
which cmake cmake --version
If a path returns, you have CMake. CMake version 3.6 or greater is recommended. These instructions have not been tested with a version earlier than 3.6.
Next we need to have a complete and sane environment. Copy the following to the end of your ~/.bash_profile:
# Compiler Variables export CC=mpicc export CXX=mpicxx export F77=mpif77 export FC=mpif90 # Library location export PACKAGES_DIR=/opt/moose # Helper variables export GCC_HOME=$PACKAGES_DIR/gcc_6.2.0 export CLANG_HOME=$PACKAGES_DIR/clang_3.9.0 export MPI_HOME=$PACKAGES_DIR/mpich/mpich_3.2 export PETSC_DIR=$PACKAGES_DIR/petsc/mpich_petsc-3.7.5/clang-opt # PATH export PATH=$GCC_HOME/bin:$MPI_HOME/bin:$CLANG_HOME/bin:$PATH # LD_LIBRARY_PATH export LD_LIBRARY_PATH=$GCC_HOME/lib:$GCC_HOME/lib64:$GCC_HOME/lib/gcc/x86_64-pc-linux-gnu/6.2.0:$GCC_HOME/libexec/gcc/x86_64-pc-linux-gnu/6.2.0:$CLANG_HOME/lib/$LD_LIBRARY_PATH # JOB Count (the number of cores available on this machine) export MOOSE_JOBS=4 # Peacock specific (optional) if [ -d $PACKAGES_DIR/miniconda ]; then export PATH=$PACKAGES_DIR/miniconda/bin:$PATH export QT_API='pyside' fi
Now close all of your open terminals and re-open them. This will allow the above information to be present in your environment.
Next make sure you have an area setup to download packages and a place to build packages that need to be built. We recommend using a ~/Downloads folder for your downloads and ~/projects/src, for your build directory. Create the build directory now:
mkdir -p ~/projects/src
In order to build a modern GNU compiler (C++11 compatible), we will need a basic one. On the Linux platform, this is normally already available to you. You can verify this by performing two
which commands and verifying if anything returns:
which gcc which g++
If nothing returns from either of those commands, you will need to first install a basic compiler (bootstrapping) before we can begin building modern compiler. Unfortunately, that is beyond the scope of this document, as every flavor of Linux has a different means of going about this process. Search the internets for 'how to install GCC on [HTML_REMOVED]'.
Download the following tarball: gcc-6.2.0.tar.gz. Note, this is a modified version of GCC. Basically, its GCC with the prereqs included in the tarball. If that is a concern to you (that this tarball is not a true GNU GCC tarball), then please proceed to the gnu.org web site and obtain a true copy of the gcc 6.2 tarball and perform the prereq steps as listed in their HOWTO. Again, the only difference with our tarball copy, is that we have performed the 'prereqs' steps, and then re-packaged the tarball. This is the same tarball that is used when building GCC in our redistributable package.
Extract the tarball, configure and build GCC
cd ~/projects/src tar -xf ~/Downloads/gcc-6.2.0.tar.gz -C . mkdir ~/projects/src/gcc-build cd ~/projects/src/gcc-build unset CC unset CXX unset FC unset F90 unset F77 ../gcc-6.2.0/configure --prefix=$GCC_HOME --disable-multilib --enable-languages=c,c++,fortran --enable-lto make -j $MOOSE_JOBS sudo make install
Verify you have correctly built/installed GCC by performing the following command:
If the above command does not return
/opt/moose/gcc_6.2.0/bin/g++ then something went wrong and you should not proceed until this is fixed. Otherwise it will be a wast of time...
Clang is our preferred compiler. It was necessary to build the GCC compiler so we have a Fortran compiler. There are many components that go into the building of the LLVM compiler suite. It is important the following be completed in a very specific order.
Download all the necessary bits:
Extract and move the downloaded tarballs in the very precise and following order (copying and pasting this entire code block is recommended!):
cd ~/projects/src tar -xf ~/Downloads/llvm-3.9.0.src.tar.xz -C . tar -xf ~/Downloads/cfe-3.9.0.src.tar.xz -C .; mv cfe-3.9.0.src llvm-3.9.0.src/tools/clang tar -xf ~/Downloads/clang-tools-extra-3.9.0.src.tar.xz -C .; mv clang-tools-extra-3.9.0.src llvm-3.9.0.src/tools/clang/tools/extra tar -xf ~/Downloads/compiler-rt-3.9.0.src.tar.xz -C .; mv compiler-rt-3.9.0.src llvm-3.9.0.src/projects/compiler-rt tar -xf ~/Downloads/libcxx-3.9.0.src.tar.xz -C .; mv libcxx-3.9.0.src llvm-3.9.0.src/projects/libcxx tar -xf ~/Downloads/libcxxabi-3.9.0.src.tar.xz -C .; mv libcxxabi-3.9.0.src llvm-3.9.0.src/projects/libcxxabi tar -xf ~/Downloads/openmp-3.9.0.src.tar.xz -C .; mv openmp-3.9.0.src llvm-3.9.0.src/projects/openmp
With all the packages downloaded and moved to their proper locations, we can configure LLVM:
mkdir ~/projects/src/llvm-build cd ~/projects/src/llvm-build cmake -DCMAKE_C_COMPILER=$GCC_HOME/bin/gcc \ -DCMAKE_CXX_COMPILER=$GCC_HOME/bin/g++ \ -DGCC_INSTALL_PREFIX=$GCC_HOME \ -DCMAKE_CXX_LINK_FLAGS="-L$GCC_HOME/lib64 -Wl,-rpath,$GCC_HOME/lib64" \ -DCMAKE_INSTALL_PREFIX=$CLANG_HOME \ -DCMAKE_INSTALL_RPATH:STRING=$CLANG_HOME/lib \ -DLLVM_ENABLE_ASSERTIONS=ON \ -DCMAKE_BUILD_TYPE="Release" \ -DPYTHON_EXECUTABLE=`which python2.7` \ -DLLVM_TARGETS_TO_BUILD="X86" \ ../llvm-3.9.0.src
As long as no problems were detected during configure, proceed to building LLVM:
cd ~/projects/src/llvm-build make -j $MOOSE_JOBS
Sill no problems? Then proceed to installing LLVM:
cd ~/projects/src/llvm-build sudo make install
Verify you have correctly built/installed Clang by performing the following command:
If the above command does not return
/opt/moose/clang_3.9.0/bin/clang then something went wrong and you should not proceed until this is fixed. Otherwise it will be a wast of time...
We recommend compiling and using MPICH for your MPI needs.
Download mpich-3.2. Once downloaded, perform the following:
cd ~/projects/src tar -xf ~/Downloads/mpich-3.2.tar.gz -C . mkdir ~/projects/src/mpich-3.2/clang-opt cd ~/projects/src/mpich-3.2/clang-opt ../configure --prefix=$MPI_HOME --enable-shared --enable-sharedlibs=clang --enable-fast=03 \ --enable-debuginfo --enable-totalview --enable-two-level-namespace CC=clang CXX=clang++ \ FC=gfortran F77=gfortran F90='' CFLAGS='' CXXFLAGS='' FFLAGS='' FCFLAGS='' F90FLAGS='' F77FLAGS='' make -j $MOOSE_JOBS sudo make install
Verify you have correctly built/installed MPICH by performing the following command:
If the above command does not return
/opt/moose/mpich/mpich_3.2/bin/mpicc then something went wrong and you should not proceed until this is fixed. Otherwise it will be a wast of time...
PETSc is our preferred linear and nonlinear solver package for MOOSE. If you are on a Linux system avoid getting a package distribution of PETSc because it may not come configured the way we want. Specifically it will most likely NOT be compiled with HYPRE support and will likely be tied to a different MPI installation.
Download petsc-3.7.5.tar.gz. Once downloaded, perform the following:
tar -xf ~/Downloads/petsc-3.7.5.tar.gz -C ~/projects/src cd ~/projects/src/petsc-3.7.5
./configure \ --prefix=$PETSC_DIR \ --download-hypre=1 \ --with-ssl=0 \ --with-debugging=no \ --with-pic=1 \ --with-shared-libraries=1 \ --with-cc=mpicc \ --with-cxx=mpicxx \ --with-fc=mpif90 \ --download-fblaslapack=1 \ --download-metis=1 \ --download-parmetis=1 \ --download-superlu_dist=1 \ --download-mumps=1 \ --download-scalapack=1 \ CC=mpicc CXX=mpicxx FC=mpif90 F77=mpif77 F90=mpif90 \ CFLAGS='-fPIC -fopenmp' \ CXXFLAGS='-fPIC -fopenmp' \ FFLAGS='-fPIC -fopenmp' \ FCFLAGS='-fPIC -fopenmp' \ F90FLAGS='-fPIC -fopenmp' \ F77FLAGS='-fPIC -fopenmp' \ PETSC_DIR=`pwd`
Note: If you follow these instructions, know that your Python environment will change. Only follow step 6, if you would like to use Peacock, the MOOSE GUI.
Download the Miniconda installer and install it:
cd ~/projects/src curl -L -O http://mooseframework.org/source_packages/Miniconda2-4.3.11-Linux-x86_64.sh sudo -E bash Miniconda2-4.3.11-Linux-x86_64.sh -b -p $PACKAGES_DIR/miniconda export PATH=$PACKAGES_DIR/miniconda/bin:$PATH
Install the following conda applications:
sudo -E conda update conda sudo -E conda install -c idaholab python=2.7 matplotlib pandas numpy scikit-image mock scipy coverage yaml pyyaml pyqt pyflakes vtk=7.1.0 --yes
Close any running terminals (really just the one you were performing all of the above instructions from) and re-open them. This allow everything we just did, do be available for use.
That's it! We recommend that you browse your $PACKAGE_DIR directory and make sure that you see each of the library directories in there (GCC, clang, mpich, PETSc and miniconda if you choose to do Step 6). If not then you've probably done something wrong. Take a look back at the directions above and see what steps you may have missed. Otherwise you are set to continue on with Step #2 in the Getting Started Instructions