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 (if requried only). You can check first. If it is there, it should be something like this.

# ls -l /usr/local/intel/2018u3/impi/2018.3.222/intel64/include64
# lrwxrwxrwx 1 root hpccentrifyusers 7 Aug  9  2019 /usr/local/intel/2018u3/impi/2018.3.222/intel64/include64 -> include

If not there, you may want to do this.

# 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=/usr/local/$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

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

Step 6: Testing the OpenFOAM

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.