Compiling OpenFOAM-7 with Third-Party-7 with Intel MPI on CentOS 7

Step 1: Create a Directory git clone OpenFOAM-7 and Third-Party-7

# mkdir -p /usr/local/OpenFOAM
# cd OpenFOAM
# git clone https://github.com/OpenFOAM/OpenFOAM-7.git
# git clone https://github.com/OpenFOAM/ThirdParty-7.git

Step 2a: Load Intel Compilers. I loaded the Intel Parallel Cluster Suite 2018

# source /usr/local/intel/2018u3/bin/compilervars.sh intel64
# source /usr/local/intel/2018u3/mkl/bin/mklvars.sh intel64
# source /usr/local/intel/2018u3/impi/2018.3.222/bin64/mpivars.sh intel64
# source /usr/local/intel/2018u3/parallel_studio_xe_2018/bin/psxevars.sh intel64
# export MPI_ROOT=/usr/local/intel/2018u3/impi/2018.3.222/intel64

Step 2b: Create softlink for include64 and lib64 for Intel MPI

# cd /usr/local/intel/2018u3/impi/2018.3.222/intel64
# ln -s include include64
# ln -s lib lib64

Step 3: Edit the OpenFOAM bashrc

# vim /usr/local/OpenFOAM/OpenFOAM-7/etc/bashrc
......
export FOAM_INST_DIR=$HOME/$WM_PROJECT
.....
#- Compiler:
# WM_COMPILER = Gcc | Gcc48 ... Gcc62 | Clang | Icc
export WM_COMPILER=Icc
.....
#- MPI implementation:
# WM_MPLIB = SYSTEMOPENMPI | OPENMPI | SYSTEMMPI | MPICH | MPICH-GM | HPMPI
# | MPI | FJMPI | QSMPI | SGIMPI | INTELMPI
export WM_MPLIB=INTELMPI
.....

Step 4: Edit the ThirdParty-7 scotch_6.0.6 Packages

$ cd /usr/local/OpenFOAM/ThirdParty-7/scotch_6.0.9/src
$ vim /usr/local/OpenFOAM/ThirdParty-7/scotch_6.0.9/src/Makefile.inc
AR = icc
...
CCS = icc
CCP = mpicc
...
CFLAGS = $(WM_CFLAGS) -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_RANDOM_FIXED_SEED -
DSCOTCH_RENAME -Drestrict=__restrict -I$(MPI_ROOT)/include64 -L$(MPI_ROOT)/lib64

Step 5: Go back to OpenFOAM source directory

# cd /usr/local/OpenFOAM/OpenFOAM-7
# ./Allwmake -j 16 | tee Allwmake.log

Step 6: Testing the OpenFOAM

# ./usr/local/OpenFOAM/OpenFOAM-7/bin/foamInstallationTest

 

Compiling OpenFOAM-5.0 with Intel-MPI

Minimum Requirements version

  1. gcc: 4.8.5
  2. cmake: 3.3 (required for ParaView and CGAL build)
  3. boost: 1.48 (required for CGAL build)
  4. fftw: 3.3.7 (optional – required for FFT-related functionality)
  5. Qt: 4.8 (optional – required for ParaView build)

I’m using Intel-16.0.4 and Intel-MPI-5.1.3.258

Step 1a: Download and Unpacking Sources

# wget -O - http://dl.openfoam.org/source/5-0 | tar xvz
# wget -O - http://dl.openfoam.org/third-party/5-0 | tar xvz

Step 1b:  Rename the Directory

# mv OpenFOAM-5.x-version-5.0 OpenFOAM-5.0
# mv ThirdParty-5.x-version-5.0 ThirdParty-5.0

Step 2: Initiate Intel and Intel-MPI Environment and source OpenFOAM-5.0 bashrc

source /usr/local/intel/bin/compilervars.sh intel64
source /usr/local/intel/parallel_studio_xe_2016.4.072/bin/psxevars.sh intel64
source /usr/local/intel/impi/5.1.3.258/bin64/mpivars.sh intel64
source /usr/local/intel/mkl/bin/mklvars.sh intel64
source /usr/local/OpenFOAM/OpenFOAM-5.0/etc/bashrc
export MPI_ROOT=/usr/local/intel/impi/5.1.3.258/intel64

Step 3: Make sure your CentOS-7 Environment have the following base packages

# yum install gcc-c++ gcc-gfortran gmp flex flex-devel boost zlib zlib-devel qt4 qt4-devel

Step 4: Edit the OpenFOAM  internal bashrc

# vim /usr/local/OpenFOAM/OpenFOAM-5.0/etc/bashrc

Line 35,36

export WM_PROJECT=OpenFOAM
export WM_PROJECT_VERSION=5.0

Line 45

FOAM_INST_DIR=/usr/local/$WM_PROJECT

Line 60

export WM_COMPILER_TYPE=system

Line 65

export WM_COMPILER=Icc

Line 88

export WM_MPLIB=INTELMPI

Step 5: Compile OpenFOAM

# ./Allwmake -update -j