Build NextFOAM-cfd on Ubuntu-22.04 with Intel oneAPI

Install Intel oneAPI and IntelMPI

Setup repository to install using apt

wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null 
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list 
apt update
apt install -y intel-basekit intel-hpckit

Setup the Intel Compiler and IntelMPI

To use an Intel oneAPI compiler and IntelMPI, environment variables are added in the /etc/bash.bashrc for all users. Append following lines at the end of /etc/bash.bashrc

source /opt/intel/oneapi/setvars.sh >& /dev/null
unset PYTHONPATH
export MPI_ROOT=$I_MPI_ROOT
export I_MPI_HYDRA_IFACE="enp5s0"

enp5s0 is the network interface name for the MPI communication. You can get the name using ifconfig command

$ ifconfig
enp5s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
    ether 04:92:26:d9:b7:0b  txqueuelen 1000  (Ethernet)
    RX packets 0  bytes 0 (0.0 B)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 0  bytes 0 (0.0 B)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    device memory 0xfd600000-fd61ffff

Build NextFOAM-cfd using Intel oneAPI

Install build environment

apt-get install -y build-essential flex zlib1g-dev libgmp-dev libmpfr-dev libboost-dev texinfo cmake

Clone NextFOAM-cfd and move sources to the top directory.

The top directory for NextFOAM-cfd installation is /opt/OpenFOAM. 2405 is the latest NextFOAM-cfd version. Modify the version number according to the distribution.

mkdir -p /opt/OpenFOAM
git clone https://github.com/nextfoam/nextfoam-cfd.git
mv nextfoam-cfd/NextFOAM-2405 /opt/OpenFOAM
mv nextfoam-cfd/ThirdParty-2405 /opt/OpenFOAM

Setup build parametersEdit /opt/OpenFOAM/NextFOAM-2405/etc/config.sh/settings for Intel oneAPI

vi /opt/OpenFOAM/NextFOAM-2405/etc/config.sh/settings

Linux)
WM_ARCH=linux

case "$(uname -m)" in
x86_64)
    if [ "$archOption" = 32 ]
    then
        export WM_ARCH_OPTION=32        # Propagate?
        export WM_COMPILER_ARCH=64      # 64-bit compiler, 32-bit target
    else
        WM_ARCH=linux64                 # 64-bit compiler/target
        export WM_COMPILER_LIB_ARCH=64  # Use lib64
        export WM_CC='icx' 
        export WM_CXX='icpx' 
        export WM_CFLAGS='-xCORE-AVX512 -O2 -m64 -fPIC'
        export WM_CXXFLAGS='-xCORE-AVX512 -O2 -m64 -fPIC'
    fi
    ;;

Edit /opt/OpenFOAM/NextFOAM-2405/etc/bashrc

vi /opt/OpenFOAM/NextFOAM-2405/etc/bashrc

export WM_PROJECT_VERSION=2405
export WM_COMPILER=Icx
export WM_MPLIB=INTELMPI
export WM_LABEL_SIZE=32
projectDIR="/opt/OpenFOAM/NextFOAM-$WM_PROJECT_VERSION"

Edit scotch compile parameters in the /opt/OpenFOAM/ThirdParty-2405/etc/makeFiles/scotch/Makefile.inc.Linux.shlib

vi /opt/OpenFOAM/ThirdParty-2405/etc/makeFiles/scotch/Makefile.inc.Linux.shlib

AR          = icx
ARFLAGS     = $(WM_CFLAGS) -shared -o
CCS         = icx
CCP         = mpicc
CCD         = $(CCP)
CFLAGS      = $(WM_CFLAGS) -fPIC -O3 \
    -UCOMMON_FILE_COMPRESS \
    -DCOMMON_RANDOM_FIXED_SEED \
    -DSCOTCH_DETERMINISTIC \
    -DSCOTCH_RENAME \
    -DIDXSIZE64 \
    -Drestrict=__restrict \
    -I$(MPI_ROOT)/include -L$(MPI_ROOT)/lib

Enable environment variables and dd fftw library path and compile

source /opt/OpenFOAM/NextFOAM-2405/etc/bashrc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$WM_THIRD_PARTY_DIR/platforms/linux64Icx/fftw-3.3.10/lib
cd /opt/OpenFOAM/NextFOAM-2405/
./Allwmake -j 

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다