ARCHER logo ARCHER banner

The ARCHER Service is now closed and has been superseded by ARCHER2.

  • ARCHER homepage
  • About ARCHER
    • About ARCHER
    • News & Events
    • Calendar
    • Blog Articles
    • Hardware
    • Software
    • Service Policies
    • Service Reports
    • Partners
    • People
    • Media Gallery
  • Get Access
    • Getting Access
    • TA Form and Notes
    • kAU Calculator
    • Cost of Access
  • User Support
    • User Support
    • Helpdesk
    • Frequently Asked Questions
    • ARCHER App
  • Documentation
    • User Guides & Documentation
    • Essential Skills
    • Quick Start Guide
    • ARCHER User Guide
    • ARCHER Best Practice Guide
    • Scientific Software Packages
    • UK Research Data Facility Guide
    • Knights Landing Guide
    • Data Management Guide
    • SAFE User Guide
    • ARCHER Troubleshooting Guide
    • ARCHER White Papers
    • Screencast Videos
  • Service Status
    • Detailed Service Status
    • Maintenance
  • Training
    • Upcoming Courses
    • Online Training
    • Driving Test
    • Course Registration
    • Course Descriptions
    • Virtual Tutorials and Webinars
    • Locations
    • Training personnel
    • Past Course Materials Repository
    • Feedback
  • Community
    • ARCHER Community
    • ARCHER Benchmarks
    • ARCHER KNL Performance Reports
    • Cray CoE for ARCHER
    • Embedded CSE
    • ARCHER Champions
    • ARCHER Scientific Consortia
    • HPC Scientific Advisory Committee
    • ARCHER for Early Career Researchers
  • Industry
    • Information for Industry
  • Outreach
    • Outreach (on EPCC Website)

You are here:

  • ARCHER
  • User Guides & Documentation
  • Essential Skills
  • Quick Start Guide
  • ARCHER User Guide
  • ARCHER Best Practice Guide
  • Scientific Software Packages
  • UK Research Data Facility Guide
  • Knights Landing Guide
  • Data Management Guide
  • SAFE User Guide
  • ARCHER Troubleshooting Guide
  • ARCHER White Papers
  • Screencast Videos

Contact Us

support@archer.ac.uk

Twitter Feed

Tweets by @ARCHER_HPC

ISO 9001 Certified

ISO 27001 Certified

Compiling OpenFOAM 16.12 on ARCHER

This page outlines the procedure we used for building OpenFOAM 16.12 on ARCHER. We downloaded the OpenFOAM-1612+ and ThirdParty-1612+ sources from the website and unpacked them on the /work filesystem on ARCHER.

Modifications

To build OpenFOAM we needed to make some small modifications to the configuration files. Firstly, we change the following line in etc/bashrc:

Set this to the location of your OpenFOAM directory
FOAM_INST_DIR=

Add a file, in the etc directory, named prefs.sh, with the following entries:

export WM_COMPILER=Gcc
export WM_MPLIB=CRAY-MPICH

We ensured that the following was set in etc/config.sh/CGAL:

boost_version=boost-system
cgal_version=CGAL-4.9

export BOOST_ARCH_PATH=/work/y07/y07/cse/boost/1.60_MPI/GNU/boost
export CGAL_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cgal_version

We ensured that the following was set in etc/config.sh/FFTW:

fftw_version=fftw-system

We added the following in to etc/config.sh/mpi before the existing MPICH) entry:

 CRAY-MPICH)
    export FOAM_MPI=cray-mpich
    export MPI_ARCH_PATH=$MPICH_DIR
    _foamAddLib     $MPI_ARCH_PATH/lib
    ;;

We added the following in to etc/config.sh/settings after the case "$WM_COMPILER_TYPE" in section:

if [ "$FOAM_MPI:$WM_COMPILER" = "cray-mpich:Gcc" ]
then
    WM_CC="cc"
    WM_CXX="CC"
fi 

Next we changed the c and c++ files in wmake/rules/linuxGcc replacing gcc with cc and g++ with CC.

The same changes were made in the wmake/rules/linux64Gcc directory.

Some changes were also necessary in ThirdParty-16.12+ directory. We updated ThirdParty-16.12+/etc/wmakeFiles/scotch/Makefile.inc.i686_pc_linux2.shlib-OpenFOAM replacing gcc with cc and mpicc with cc.

We also had to change the build rules in ThirdParty-16.12+/etc/tools/ThirdPartyFunctions to make sure too many processes were not being used. We had issues with errors like this, caused by make trying to use as many cores as the machine has available for compilation (which is not compatible with the process limits users have on login or compile nodes):

Error: Problem invoking pkg-config.
sh: fork: Resource temporarily unavailable
....
Error invoking pkg-config!
make[2]: *** Waiting for unfinished jobs....

Therefore, we change export WM_NCOMPPROCS in ThirdParty-16.12+/etc/tools/ThirdPartyFunctions to be export WM_NCOMPPROCS=8 to fix the number of processes the build process could use, allowing the scotch library to be built.

Finally, one source file needed to be changed to fix an issue with a clash between C and C++ MPI library definitions. We updated OpenFOAM-v1612+/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C, changing this:

extern "C"
{
    #include 
    #include 
    #include "ptscotch.h"
}

To this:

#include 

extern "C"
{
    #include 
    #include "ptscotch.h"
}

Build OpenFOAM

We used the following modules and environment variables when building:

module load PrgEnv-gnu
module load zlib
module load boost/1.60
module load cmake/3.2.3
module load make
module load cray-tpsl
module load fftw
export WM_64=ON
export CRAYPE_LINK_TYPE=dynamic

To build OpenFOAM you then need to source to etc/bashrc in the OpenFOAM directory:

source etc/bashrc

And then run Allwmake from the OpenFOAM directory:

./Allwmake

Copyright © Design and Content 2013-2019 EPCC. All rights reserved.

EPSRC NERC EPCC