From d5498265281a9549b7b19e20e91b2438cbd05a1f Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Tue, 20 Apr 2021 16:24:06 +0200
Subject: [PATCH] CONFIG: adjust intel compiler and mpi settings (#2056)

- largely as per patch from Jong-Gwan (Jason) Do

NB: the intel-one setup adds in paths for intelmpi.
    Its mpicc version does not harmonize with the OpenFOAM
    system openmpi setup (using mpicc --showme:link).

    Needs adjustment, or use intelmpi instead.

- update name mappings for newer gcc, clang versions
---
 etc/bashrc                                |  2 +-
 etc/config.csh/compiler                   | 38 ++++++++++++++--
 etc/config.csh/mpi                        | 53 +++++++++++++++--------
 etc/config.sh/compiler                    | 34 +++++++++++++--
 etc/config.sh/mpi                         | 53 +++++++++++++++++------
 etc/cshrc                                 |  4 +-
 wmake/rules/General/Icc/openmp            |  2 +-
 wmake/rules/General/Icx/c                 | 10 +++++
 wmake/rules/General/Icx/c++               | 24 ++++++++++
 wmake/rules/General/Icx/link-c            |  5 +++
 wmake/rules/General/Icx/link-c++          | 11 +++++
 wmake/rules/General/Icx/openmp            |  5 +++
 wmake/rules/General/mplib-x86_64-INTELMPI | 16 +++++--
 wmake/rules/linux64Icc/c                  |  4 +-
 wmake/rules/linux64Icc/c++                |  4 +-
 wmake/rules/linux64Icc/c++Prof            |  2 +-
 wmake/rules/linux64Icc/cProf              |  2 +-
 wmake/rules/linux64Icx/c                  | 15 +++++++
 wmake/rules/linux64Icx/c++                | 17 ++++++++
 wmake/rules/linux64Icx/c++Debug           |  2 +
 wmake/rules/linux64Icx/c++Opt             |  2 +
 wmake/rules/linux64Icx/c++OptKNL          |  4 ++
 wmake/rules/linux64Icx/c++Prof            |  2 +
 wmake/rules/linux64Icx/cDebug             |  2 +
 wmake/rules/linux64Icx/cOpt               |  2 +
 wmake/rules/linux64Icx/cOptKNL            |  2 +
 wmake/rules/linux64Icx/cProf              |  2 +
 wmake/rules/linux64Icx/general            | 13 ++++++
 wmake/rules/linux64Icx/mplibHPMPI         |  1 +
 wmake/rules/linux64Icx/mplibINTELMPI      |  1 +
 wmake/rules/linuxIA64Icc/c++Opt           |  1 -
 wmake/rules/solaris64Gcc/c++Debug         |  2 +-
 32 files changed, 286 insertions(+), 51 deletions(-)
 create mode 100644 wmake/rules/General/Icx/c
 create mode 100644 wmake/rules/General/Icx/c++
 create mode 100644 wmake/rules/General/Icx/link-c
 create mode 100644 wmake/rules/General/Icx/link-c++
 create mode 100644 wmake/rules/General/Icx/openmp
 create mode 100644 wmake/rules/linux64Icx/c
 create mode 100644 wmake/rules/linux64Icx/c++
 create mode 100644 wmake/rules/linux64Icx/c++Debug
 create mode 100644 wmake/rules/linux64Icx/c++Opt
 create mode 100644 wmake/rules/linux64Icx/c++OptKNL
 create mode 100644 wmake/rules/linux64Icx/c++Prof
 create mode 100644 wmake/rules/linux64Icx/cDebug
 create mode 100644 wmake/rules/linux64Icx/cOpt
 create mode 100644 wmake/rules/linux64Icx/cOptKNL
 create mode 100644 wmake/rules/linux64Icx/cProf
 create mode 100644 wmake/rules/linux64Icx/general
 create mode 100644 wmake/rules/linux64Icx/mplibHPMPI
 create mode 100644 wmake/rules/linux64Icx/mplibINTELMPI

diff --git a/etc/bashrc b/etc/bashrc
index ab79b9ad74a..e8857b474d4 100644
--- a/etc/bashrc
+++ b/etc/bashrc
@@ -66,7 +66,7 @@ export WM_PROJECT_VERSION=com
 export WM_COMPILER_TYPE=system
 
 # [WM_COMPILER] - Compiler:
-# = Gcc | Clang | Icc | Cray | Amd | Arm | Pgi | Fujitsu |
+# = Gcc | Clang | Icc | Icx | Cray | Amd | Arm | Pgi | Fujitsu |
 #   Gcc<digits> | Clang<digits>
 export WM_COMPILER=Gcc
 
diff --git a/etc/config.csh/compiler b/etc/config.csh/compiler
index 4754d598a33..43ebc558252 100644
--- a/etc/config.csh/compiler
+++ b/etc/config.csh/compiler
@@ -6,7 +6,7 @@
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 #     Copyright (C) 2016 OpenFOAM Foundation
-#     Copyright (C) 2016-2020 OpenCFD Ltd.
+#     Copyright (C) 2016-2021 OpenCFD Ltd.
 #------------------------------------------------------------------------------
 # License
 #     This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@@ -23,11 +23,36 @@
 #     The default values for gcc/clang are not a recommendation,
 #     but typically correspond to the minimum usable version.
 #
+#     I_MPI_CC, I_MPI_CXX environment variables may be defined for the
+#     Intel mpicc/mpicxx wrappers
+#
+#------------------------------------------------------------------------------
+
+# Initial mpi/compiler associations
+switch ("$WM_COMPILER")
+case Icc*:
+    setenv I_MPI_CC icc
+    setenv I_MPI_CXX icpc
+    breaksw
+case Icx*:
+    setenv I_MPI_CC icx
+    setenv I_MPI_CXX icpx
+    breaksw
+case Gcc*:
+    switch ("$WM_MPLIB")
+    case INTELMPI*:
+        setenv I_MPI_CC gcc
+        setenv I_MPI_CXX g++
+        breaksw
+    endsw
+    breaksw
+endsw
+
 #------------------------------------------------------------------------------
 
 switch ("$WM_COMPILER_TYPE")
 case ThirdParty:
-    # Default versions (CLANG, GCC, GMP, MPFR, MPC) - override as necessary
+    # Default/minimum versions (compiler, GMP, MPFR, MPC) - override as needed
 
     set default_clang_version=llvm-3.7.1
     set default_gcc_version=gcc-4.8.5
@@ -44,6 +69,9 @@ case ThirdParty:
     case Gcc:
         set gcc_version="$default_gcc_version"
         breaksw
+    case Gcc103*:
+        set gcc_version=gcc-10.3.0
+        breaksw
     case Gcc102*:
         set gcc_version=gcc-10.2.0
         breaksw
@@ -128,8 +156,11 @@ case ThirdParty:
     case Clang:
         set clang_version="$default_clang_version"
         breaksw
+    case Clang111*:
+        set clang_version=llvm-11.1.0
+        breaksw
     case Clang110*:
-        set clang_version=llvm-11.0.0
+        set clang_version=llvm-11.0.1
         breaksw
     case Clang100*:
         set clang_version=llvm-10.0.1
@@ -184,6 +215,7 @@ UNKNOWN_COMPILER
     breaksw
 endsw
 
+#------------------------------------------------------------------------------
 
 unset default_gcc_version default_clang_version
 unset default_gmp_version default_mpfr_version default_mpc_version
diff --git a/etc/config.csh/mpi b/etc/config.csh/mpi
index 83cc770c7ef..4942b58efdd 100644
--- a/etc/config.csh/mpi
+++ b/etc/config.csh/mpi
@@ -21,9 +21,6 @@
 #     For USERMPI, the user is responsible for supplying an appropriate
 #     wmake/rules/General/mplibUSERMPI file and managing all settings
 #
-#     For INTELMPI, note that the (I_MPI_CC, I_MPI_CCX) environment variables
-#     define the underlying compiler to be used
-#
 # User adjustments are controlled by these types of files:
 #     - config.csh/prefs.fjmpi
 #     - config.csh/prefs.intelmpi
@@ -42,6 +39,9 @@
 #     but are not permitted to unset it.
 #
 # Environment
+#     I_MPI_CC, I_MPI_CXX environment variables define the compiler
+#     to be used the Intel mpicc/mpicxx wrappers
+#
 #     MPI_BUFFER_SIZE overrides 'mpiBufferSize' (controlDict entry).
 #     Eg,  setenv MPI_BUFFER_SIZE 20000000
 #
@@ -81,7 +81,9 @@ case SYSTEMOPENMPI:
         unset libDir
     endif
 
-    # TDB: extra openmpi major qualifier on name?
+    #-
+    # TBD: extra (major) version qualifier on name?
+    #-
     ## if ( "$FOAM_MPI" == "sys-openmpi" ) then
     ##     set _foamMpiVersion=`echo "$MPI_ARCH_PATH" | sed -e 's/^.*mpi//'`
     ##     switch ("$_foamMpiVersion")
@@ -321,6 +323,7 @@ case SGIMPI:
 
 
 case INTELMPI*:
+    setenv FOAM_MPI intelmpi
     _foamEtc -config prefs.intelmpi  ## Optional adjustments
 
     if ( $?I_MPI_ROOT ) then
@@ -340,26 +343,38 @@ case INTELMPI*:
             setenv MPI_ARCH_PATH "${MPI_ARCH_PATH:h}"
         endif
 
-        # Subdir name is FOAM_MPI name
-        setenv FOAM_MPI "${MPI_ARCH_PATH:t}"
-
-        # If subdir is version number only, prefix with 'impi-'
-        switch ("$FOAM_MPI")
-        case [0-9]*:
-            setenv FOAM_MPI "impi-$FOAM_MPI"
-            breaksw
-        endsw
-
+        #-
+        # TBD: extra version qualifier on name?
+        #      eg, when subdir is version number only
+        #-
+        ## if ( "$FOAM_MPI" == "intelmpi" ) then
+        ##     set _foamMpiVersion="${MPI_ARCH_PATH:t}"
+        ##     switch ("$_foamMpiVersion")
+        ##     case [1-9]*:
+        ##         setenv FOAM_MPI "intelmpi-${_foamMpiVersion}"
+        ##         breaksw
+        ##     endsw
+        ## endif
     else
         echo "${_foamMpiWarning}invalid $WM_MPLIB directory"
         echo "    => ${MPI_ARCH_PATH}"
-        echo "Please set I_MPI_ROOT or MPI_ROOT correctly."
+        echo "Please set I_MPI_ROOT (or MPI_ROOT) correctly."
     endif
 
-    _foamAddPath    "$MPI_ARCH_PATH"/intel64/bin
-    _foamAddLib     "$MPI_ARCH_PATH"/intel64/lib
-    breaksw
-
+    # With/without "intel64/" directory - handled here and in mpi rules
+
+    # Path, lib-path may have been set prior to call
+    if (1) then
+        if ( -d "$MPI_ARCH_PATH"/intel64/lib ) then
+            _foamAddPath "$MPI_ARCH_PATH"/intel64/bin
+            _foamAddLib "$MPI_ARCH_PATH"/intel64/lib
+            _foamAddLib "$MPI_ARCH_PATH"/intel64/lib/release
+        else if ( -d "$MPI_ARCH_PATH"/lib ) then
+            _foamAddPath "$MPI_ARCH_PATH"/bin
+            _foamAddLib "$MPI_ARCH_PATH"/lib
+            _foamAddLib "$MPI_ARCH_PATH"/lib/release
+        endif
+    endif
 endsw
 
 
diff --git a/etc/config.sh/compiler b/etc/config.sh/compiler
index 0beeb89be1b..07dabda36f5 100644
--- a/etc/config.sh/compiler
+++ b/etc/config.sh/compiler
@@ -6,7 +6,7 @@
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 #     Copyright (C) 2011-2016 OpenFOAM Foundation
-#     Copyright (C) 2016-2020 OpenCFD Ltd.
+#     Copyright (C) 2016-2021 OpenCFD Ltd.
 #------------------------------------------------------------------------------
 # License
 #     This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@@ -23,11 +23,36 @@
 #     The default values for gcc/clang are not a recommendation,
 #     but typically correspond to the minimum usable version.
 #
+#     I_MPI_CC, I_MPI_CXX environment variables may be defined for the
+#     Intel mpicc/mpicxx wrappers
+#
+#------------------------------------------------------------------------------
+
+# Initial mpi/compiler associations
+case "$WM_COMPILER" in
+Icc*)
+    export I_MPI_CC=icc
+    export I_MPI_CXX=icpc
+    ;;
+Icx*)
+    export I_MPI_CC=icx
+    export I_MPI_CXX=icpx
+    ;;
+Gcc*)
+    case "$WM_MPLIB" in
+    INTELMPI*)
+        export I_MPI_CC=gcc
+        export I_MPI_CXX=g++
+        ;;
+    esac
+    ;;
+esac
+
 #------------------------------------------------------------------------------
 
 case "$WM_COMPILER_TYPE" in
 ThirdParty)
-    # Default versions (CLANG, GCC, GMP, MPFR, MPC) - override as necessary
+    # Default/minimum versions (compiler, GMP, MPFR, MPC) - override as needed
 
     default_clang_version=llvm-3.7.1
     default_gcc_version=gcc-4.8.5
@@ -45,6 +70,7 @@ ThirdParty)
 
     case "$WM_COMPILER" in
     Gcc)    gcc_version="$default_gcc_version" ;;
+    Gcc103*) gcc_version=gcc-10.3.0 ;;
     Gcc102*) gcc_version=gcc-10.2.0 ;;
     Gcc101*) gcc_version=gcc-10.1.0 ;;
     Gcc93*) gcc_version=gcc-9.3.0 ;;
@@ -74,7 +100,8 @@ ThirdParty)
     Gcc48*) gcc_version=gcc-4.8.5 ;;
 
     Clang)    clang_version="$default_clang_version" ;;
-    Clang110*) clang_version=llvm-11.0.0 ;;
+    Clang111*) clang_version=llvm-11.1.0 ;;
+    Clang110*) clang_version=llvm-11.0.1 ;;
     Clang100*) clang_version=llvm-10.0.1 ;;
     Clang90*) clang_version=llvm-9.0.1 ;;
     Clang80*) clang_version=llvm-8.0.1 ;;
@@ -107,6 +134,7 @@ UNKNOWN_COMPILER
     ;;
 esac
 
+#------------------------------------------------------------------------------
 
 unset default_gcc_version default_clang_version
 unset default_gmp_version default_mpfr_version default_mpc_version
diff --git a/etc/config.sh/mpi b/etc/config.sh/mpi
index 04e6219a0f3..90885f64236 100644
--- a/etc/config.sh/mpi
+++ b/etc/config.sh/mpi
@@ -21,9 +21,6 @@
 #     For USERMPI, the user is responsible for supplying an appropriate
 #     wmake/rules/General/mplibUSERMPI file and managing all settings
 #
-#     For INTELMPI, note that the (I_MPI_CC, I_MPI_CCX) environment variables
-#     define the underlying compiler to be used
-#
 # User adjustments are controlled by these types of files:
 #     - config.sh/prefs.fjmpi
 #     - config.sh/prefs.intelmpi
@@ -40,6 +37,9 @@
 #     All pre-v2012 names (without the 'prefs.' prefix) are ignored.
 #
 # Environment
+#     I_MPI_CC, I_MPI_CXX environment variables define the compiler
+#     to be used the Intel mpicc/mpicxx wrappers
+#
 #     MPI_BUFFER_SIZE overrides 'mpiBufferSize' (controlDict entry).
 #     Eg,  export MPI_BUFFER_SIZE=20000000
 #
@@ -84,7 +84,9 @@ SYSTEMOPENMPI | SYSTEMOPENMPI[1-9])
         unset libDir
     fi
 
-    # TDB: extra openmpi major qualifier on name?
+    #-
+    # TBD: extra (major) version qualifier on name?
+    #-
     ## if [ "$FOAM_MPI" = "sys-openmpi" ]
     ## then
     ##     _foamMpiVersion="${MPI_ARCH_PATH##*mpi}"
@@ -342,6 +344,7 @@ SGIMPI)
 
 
 INTELMPI*)
+    export FOAM_MPI=intelmpi
     _foamEtc -config prefs.intelmpi  ## Optional adjustments
 
     if [ -n "$I_MPI_ROOT" ]
@@ -366,21 +369,45 @@ INTELMPI*)
         # Remove trailing slash
         MPI_ARCH_PATH="${MPI_ARCH_PATH%/}"
 
-        # Subdir name is FOAM_MPI name
-        FOAM_MPI="${MPI_ARCH_PATH##*/}"
-
-        # If subdir is version number only, prefix with 'impi-'
-        case "$FOAM_MPI" in ([0-9]*) FOAM_MPI="impi-$FOAM_MPI";; esac
+        #-
+        # TBD: extra version qualifier on name?
+        #      eg, when subdir is version number only
+        #-
+        ## if [ "$FOAM_MPI" = "intelmpi" ]
+        ## then
+        ##     _foamMpiVersion="${MPI_ARCH_PATH##*mpi}"
+        ##     case "$_foamMpiVersion" in
+        ##         ([1-9]*) FOAM_MPI="intelmpi-${_foamMpiVersion}";;
+        ##     esac
+        ## fi
     else
         echo "${_foamMpiWarning}invalid $WM_MPLIB directory" 1>&2
         echo "    => ${MPI_ARCH_PATH:-unset}" 1>&2
-        echo "Please set I_MPI_ROOT or MPI_ROOT correctly." 1>&2
+        echo "Please set I_MPI_ROOT (or MPI_ROOT) correctly." 1>&2
     fi
 
-    export FOAM_MPI MPI_ARCH_PATH
+    export MPI_ARCH_PATH
+
+    # With/without "intel64/" directory - handled here and in mpi rules
+
+    # Path, lib-path may have been set prior to call
+    if true
+    then
+        if [ -d "$MPI_ARCH_PATH"/intel64/bin ] \
+        && [ -d "$MPI_ARCH_PATH"/intel64/lib ]
+        then
+            _foamAddPath "$MPI_ARCH_PATH"/intel64/bin
+            _foamAddLib "$MPI_ARCH_PATH"/intel64/lib
+            _foamAddLib "$MPI_ARCH_PATH"/intel64/lib/release
 
-    _foamAddPath    "$MPI_ARCH_PATH"/intel64/bin
-    _foamAddLib     "$MPI_ARCH_PATH"/intel64/lib
+        elif [ -d "$MPI_ARCH_PATH"/bin ] \
+          && [ -d "$MPI_ARCH_PATH"/lib ]
+        then
+            _foamAddPath "$MPI_ARCH_PATH"/bin
+            _foamAddLib "$MPI_ARCH_PATH"/lib
+            _foamAddLib "$MPI_ARCH_PATH"/lib/release
+        fi
+    fi
     ;;
 
 
diff --git a/etc/cshrc b/etc/cshrc
index 8959453798b..cf2323792e3 100644
--- a/etc/cshrc
+++ b/etc/cshrc
@@ -6,7 +6,7 @@
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 #     Copyright (C) 2011-2016 OpenFOAM Foundation
-#     Copyright (C) 2016-2020 OpenCFD Ltd.
+#     Copyright (C) 2016-2021 OpenCFD Ltd.
 #------------------------------------------------------------------------------
 # License
 #     This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@@ -66,7 +66,7 @@ setenv WM_PROJECT_VERSION com
 setenv WM_COMPILER_TYPE system
 
 # [WM_COMPILER] - Compiler:
-# = Gcc | Clang | Icc | Cray | Amd | Arm | Pgi | Fujitsu |
+# = Gcc | Clang | Icc | Icx | Cray | Amd | Arm | Pgi | Fujitsu |
 #   Gcc<digits> | Clang<digits>
 setenv WM_COMPILER Gcc
 
diff --git a/wmake/rules/General/Icc/openmp b/wmake/rules/General/Icc/openmp
index 738673ca91c..b1824a5216a 100644
--- a/wmake/rules/General/Icc/openmp
+++ b/wmake/rules/General/Icc/openmp
@@ -2,4 +2,4 @@
 # The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP)
 
 COMP_OPENMP = -DUSE_OMP -qopenmp
-LINK_OPENMP = -liomp5
+LINK_OPENMP = -qopenmp
diff --git a/wmake/rules/General/Icx/c b/wmake/rules/General/Icx/c
new file mode 100644
index 00000000000..93990e6abf6
--- /dev/null
+++ b/wmake/rules/General/Icx/c
@@ -0,0 +1,10 @@
+SUFFIXES += .c
+
+cc          = icx
+
+cARCH       =
+cDBUG       =
+cOPT        = -O2
+cWARN       = $(FOAM_EXTRA_CFLAGS)
+
+#------------------------------------------------------------------------------
diff --git a/wmake/rules/General/Icx/c++ b/wmake/rules/General/Icx/c++
new file mode 100644
index 00000000000..657e02660b2
--- /dev/null
+++ b/wmake/rules/General/Icx/c++
@@ -0,0 +1,24 @@
+SUFFIXES += .C .cc .cpp .cxx
+
+CC          = icpx -std=c++11
+
+c++ARCH     =
+c++DBUG     =
+c++OPT      = -O2
+ptFLAGS     = -DNoRepository
+
+# - Standard warnings
+# - Less restrictive warnings (may be needed for flex++, CGAL, etc.).
+
+c++WARN     = \
+    -Wall -Wextra \
+    -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof \
+    -Wno-unknown-pragmas \
+    -Wno-undefined-var-template \
+    -diag-disable 327,654,1125,1292,2289,2304,11062,11074,11076 \
+    $(FOAM_EXTRA_CXXFLAGS)
+
+c++LESSWARN = \
+    -diag-disable 1224,2026,2305
+
+#------------------------------------------------------------------------------
diff --git a/wmake/rules/General/Icx/link-c b/wmake/rules/General/Icx/link-c
new file mode 100644
index 00000000000..a689d22d93f
--- /dev/null
+++ b/wmake/rules/General/Icx/link-c
@@ -0,0 +1,5 @@
+LINK_LIBS   = $(cDBUG)
+
+LINKLIBSO   = $(cc) $(cFLAGS) -shared
+
+LINKEXE     = $(cc) $(cFLAGS) -Xlinker --add-needed -Xlinker -z -Xlinker nodefs
diff --git a/wmake/rules/General/Icx/link-c++ b/wmake/rules/General/Icx/link-c++
new file mode 100644
index 00000000000..e023b8a35ed
--- /dev/null
+++ b/wmake/rules/General/Icx/link-c++
@@ -0,0 +1,11 @@
+LINK_LIBS   = $(c++DBUG)
+
+LINKLIBSO   = $(CC) $(c++FLAGS) -shared \
+    -Xlinker --add-needed \
+    -Xlinker --no-as-needed \
+    $(FOAM_EXTRA_LDFLAGS)
+
+LINKEXE     = $(CC) $(c++FLAGS) \
+    -Xlinker --add-needed \
+    -Xlinker --no-as-needed \
+    $(FOAM_EXTRA_LDFLAGS)
diff --git a/wmake/rules/General/Icx/openmp b/wmake/rules/General/Icx/openmp
new file mode 100644
index 00000000000..e8e20e81a4b
--- /dev/null
+++ b/wmake/rules/General/Icx/openmp
@@ -0,0 +1,5 @@
+# Flags for compiling/linking openmp
+# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP)
+
+COMP_OPENMP = -DUSE_OMP -fiopenmp
+LINK_OPENMP = -fiopenmp
diff --git a/wmake/rules/General/mplib-x86_64-INTELMPI b/wmake/rules/General/mplib-x86_64-INTELMPI
index 6d10729d736..f7060abcd0b 100644
--- a/wmake/rules/General/mplib-x86_64-INTELMPI
+++ b/wmake/rules/General/mplib-x86_64-INTELMPI
@@ -1,8 +1,18 @@
 #------------------------------------------------------------------------------
 # INTELMPI rules (x86_64)
+# - <root>/intel64/{include,lib}
+# - <root>/{include,lib}
 
-PFLAGS     = -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX
-PINC       = -isystem $(MPI_ARCH_PATH)/intel64/include
-PLIBS      = -L$(MPI_ARCH_PATH)/intel64/lib -lmpi
+intelmpi_subdir := $(shell test -d "$(MPI_ARCH_PATH)/intel64" && echo /intel64)
+
+PFLAGS  = -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX
+PINC    = -isystem $(MPI_ARCH_PATH)$(intelmpi_subdir)/include
+PLIBS   = -L$(MPI_ARCH_PATH)$(intelmpi_subdir)/lib/release -lmpi
+
+# DEBUG
+# -----
+## $(info MPI_ARCH_PATH: $(MPI_ARCH_PATH))
+## $(info PINC  $(PINC))
+## $(info PLIBS $(PLIBS))
 
 #------------------------------------------------------------------------------
diff --git a/wmake/rules/linux64Icc/c b/wmake/rules/linux64Icc/c
index 50e1d44de49..c73cd823716 100644
--- a/wmake/rules/linux64Icc/c
+++ b/wmake/rules/linux64Icc/c
@@ -1,3 +1,4 @@
+#------------------------------------------------------------------------------
 include $(GENERAL_RULES)/Icc/c
 
 cARCH       =
@@ -11,4 +12,5 @@ ctoo        = $(WM_SCHEDULER) $(cc) $(cFLAGS) -c $< -o $@
 
 include $(GENERAL_RULES)/Icc/link-c
 
-LINK_LIBS   += -L$(IA32ROOT)/lib
+#legacy: LINK_LIBS   += -L$(IA32ROOT)/lib
+#------------------------------------------------------------------------------
diff --git a/wmake/rules/linux64Icc/c++ b/wmake/rules/linux64Icc/c++
index 64f41784c40..8b55b7df8ac 100644
--- a/wmake/rules/linux64Icc/c++
+++ b/wmake/rules/linux64Icc/c++
@@ -1,3 +1,4 @@
+#------------------------------------------------------------------------------
 include $(GENERAL_RULES)/Icc/c++
 
 c++ARCH     = -pthread -fp-trap=common -fp-model precise
@@ -13,4 +14,5 @@ cpptoo      = $(Ctoo)
 
 include $(GENERAL_RULES)/Icc/link-c++
 
-LINK_LIBS   += -L$(IA64ROOT)/lib
+#legacy: LINK_LIBS   += -L$(IA64ROOT)/lib
+#------------------------------------------------------------------------------
diff --git a/wmake/rules/linux64Icc/c++Prof b/wmake/rules/linux64Icc/c++Prof
index 3bda4dad55e..48e788c4158 100644
--- a/wmake/rules/linux64Icc/c++Prof
+++ b/wmake/rules/linux64Icc/c++Prof
@@ -1,2 +1,2 @@
-c++DBUG    = -pg
+c++DBUG    = -p
 c++OPT     = -O2
diff --git a/wmake/rules/linux64Icc/cProf b/wmake/rules/linux64Icc/cProf
index ca3ac9bf5f0..f31aabbd9b4 100644
--- a/wmake/rules/linux64Icc/cProf
+++ b/wmake/rules/linux64Icc/cProf
@@ -1,2 +1,2 @@
-cDBUG       = -pg
+cDBUG       = -p
 cOPT        = -O2
diff --git a/wmake/rules/linux64Icx/c b/wmake/rules/linux64Icx/c
new file mode 100644
index 00000000000..5ee26506cb0
--- /dev/null
+++ b/wmake/rules/linux64Icx/c
@@ -0,0 +1,15 @@
+#------------------------------------------------------------------------------
+include $(GENERAL_RULES)/Icx/c
+
+cARCH       =
+
+# Compile option is non-mandatory, but must be non-empty
+sinclude $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
+
+cFLAGS      = $(cARCH) $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC
+
+ctoo        = $(WM_SCHEDULER) $(cc) $(cFLAGS) -c $< -o $@
+
+include $(GENERAL_RULES)/Icx/link-c
+
+#------------------------------------------------------------------------------
diff --git a/wmake/rules/linux64Icx/c++ b/wmake/rules/linux64Icx/c++
new file mode 100644
index 00000000000..8d1e0487614
--- /dev/null
+++ b/wmake/rules/linux64Icx/c++
@@ -0,0 +1,17 @@
+#------------------------------------------------------------------------------
+include $(GENERAL_RULES)/Icx/c++
+
+c++ARCH     = -fp-model precise
+
+include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
+
+c++FLAGS    = $(c++ARCH) $(GFLAGS) $(c++WARN) $(c++OPT) $(c++DBUG) $(ptFLAGS) $(LIB_HEADER_DIRS) -fPIC
+
+Ctoo        = $(WM_SCHEDULER) $(CC) $(c++FLAGS) -c $< -o $@
+cxxtoo      = $(Ctoo)
+cctoo       = $(Ctoo)
+cpptoo      = $(Ctoo)
+
+include $(GENERAL_RULES)/Icx/link-c++
+
+#------------------------------------------------------------------------------
diff --git a/wmake/rules/linux64Icx/c++Debug b/wmake/rules/linux64Icx/c++Debug
new file mode 100644
index 00000000000..0aec1fbffe1
--- /dev/null
+++ b/wmake/rules/linux64Icx/c++Debug
@@ -0,0 +1,2 @@
+c++DBUG    = -g -DFULLDEBUG -O0
+c++OPT     =
diff --git a/wmake/rules/linux64Icx/c++Opt b/wmake/rules/linux64Icx/c++Opt
new file mode 100644
index 00000000000..2aedabd6280
--- /dev/null
+++ b/wmake/rules/linux64Icx/c++Opt
@@ -0,0 +1,2 @@
+c++DBUG     =
+c++OPT      = -O3
diff --git a/wmake/rules/linux64Icx/c++OptKNL b/wmake/rules/linux64Icx/c++OptKNL
new file mode 100644
index 00000000000..ae99496bd47
--- /dev/null
+++ b/wmake/rules/linux64Icx/c++OptKNL
@@ -0,0 +1,4 @@
+c++DBUG     =
+c++OPT      = -xmic-avx512 -fp-speculation=safe -O3
+
+ROUNDING_MATH = -frounding-math
diff --git a/wmake/rules/linux64Icx/c++Prof b/wmake/rules/linux64Icx/c++Prof
new file mode 100644
index 00000000000..3bda4dad55e
--- /dev/null
+++ b/wmake/rules/linux64Icx/c++Prof
@@ -0,0 +1,2 @@
+c++DBUG    = -pg
+c++OPT     = -O2
diff --git a/wmake/rules/linux64Icx/cDebug b/wmake/rules/linux64Icx/cDebug
new file mode 100644
index 00000000000..73dce0dfd01
--- /dev/null
+++ b/wmake/rules/linux64Icx/cDebug
@@ -0,0 +1,2 @@
+cDBUG       = -g -DFULLDEBUG -O0
+cOPT        =
diff --git a/wmake/rules/linux64Icx/cOpt b/wmake/rules/linux64Icx/cOpt
new file mode 100644
index 00000000000..17318709f1f
--- /dev/null
+++ b/wmake/rules/linux64Icx/cOpt
@@ -0,0 +1,2 @@
+cDBUG       =
+cOPT        = -O3
diff --git a/wmake/rules/linux64Icx/cOptKNL b/wmake/rules/linux64Icx/cOptKNL
new file mode 100644
index 00000000000..b5349135be4
--- /dev/null
+++ b/wmake/rules/linux64Icx/cOptKNL
@@ -0,0 +1,2 @@
+cDBUG       =
+cOPT        = -O3 -no-prec-div
diff --git a/wmake/rules/linux64Icx/cProf b/wmake/rules/linux64Icx/cProf
new file mode 100644
index 00000000000..ca3ac9bf5f0
--- /dev/null
+++ b/wmake/rules/linux64Icx/cProf
@@ -0,0 +1,2 @@
+cDBUG       = -pg
+cOPT        = -O2
diff --git a/wmake/rules/linux64Icx/general b/wmake/rules/linux64Icx/general
new file mode 100644
index 00000000000..cfcb303a4a3
--- /dev/null
+++ b/wmake/rules/linux64Icx/general
@@ -0,0 +1,13 @@
+CPP        = /lib/cpp -traditional-cpp $(GFLAGS)
+
+include $(GENERAL_RULES)/standard
+include $(GENERAL_RULES)/Icx/openmp
+
+ifneq (,$(findstring ~openmp,$(WM_COMPILE_CONTROL)))
+    include $(GENERAL_RULES)/no-openmp
+endif
+
+include $(DEFAULT_RULES)/c
+include $(DEFAULT_RULES)/c++
+
+# -----------------------------------------------------------------------------
diff --git a/wmake/rules/linux64Icx/mplibHPMPI b/wmake/rules/linux64Icx/mplibHPMPI
new file mode 100644
index 00000000000..08c6149fece
--- /dev/null
+++ b/wmake/rules/linux64Icx/mplibHPMPI
@@ -0,0 +1 @@
+include $(GENERAL_RULES)/mplib-x86_64-HPMPI
diff --git a/wmake/rules/linux64Icx/mplibINTELMPI b/wmake/rules/linux64Icx/mplibINTELMPI
new file mode 100644
index 00000000000..6fc8ce3c369
--- /dev/null
+++ b/wmake/rules/linux64Icx/mplibINTELMPI
@@ -0,0 +1 @@
+include $(GENERAL_RULES)/mplib-x86_64-INTELMPI
diff --git a/wmake/rules/linuxIA64Icc/c++Opt b/wmake/rules/linuxIA64Icc/c++Opt
index dd3d5574742..2cb0159273e 100644
--- a/wmake/rules/linuxIA64Icc/c++Opt
+++ b/wmake/rules/linuxIA64Icc/c++Opt
@@ -1,5 +1,4 @@
 c++DBUG     =
-
 c++OPT      = \
     -DICC_IA64_PREFETCH \
     -ansi-alias \
diff --git a/wmake/rules/solaris64Gcc/c++Debug b/wmake/rules/solaris64Gcc/c++Debug
index 19bdb9c3346..08680a0e4aa 100644
--- a/wmake/rules/solaris64Gcc/c++Debug
+++ b/wmake/rules/solaris64Gcc/c++Debug
@@ -1,2 +1,2 @@
-c++DBUG    = -ggdb3 -DFULLDEBUG
+c++DBUG     = -ggdb3 -DFULLDEBUG
 c++OPT      = -O0 -fdefault-inline
-- 
GitLab