Commit 20493fbe authored by mattijs's avatar mattijs
Browse files

ENH: armclang: new compiler type. Fixes #779.

parent f250fab7
......@@ -61,7 +61,7 @@ export WM_COMPILER_TYPE=system
# [WM_COMPILER] - Compiler:
# = Gcc | Gcc4[8-9] | Gcc5[1-5] | Gcc6[1-4] | Gcc7[1-3] | GccKNL |
# Clang | Clang3[8-9] | Clang[45]0 | Icc | IccKNL | Cray
# Clang | Clang3[8-9] | Clang[45]0 | Icc | IccKNL | Cray | Arm
export WM_COMPILER=Gcc
# [WM_ARCH_OPTION] - Memory addressing:
......
#----------------------------------*-sh-*--------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
#
# File
# etc/bashrc
#
# Description
# Set OpenFOAM environment for POSIX shell (eg, bash,dash,zsh,...)
# Source manually or from the ~/.profile or ~/.bashrc files.
#
# Note
# Many environment variables can be overridden using a <prefs.sh> file
# from one of these locations:
# * user-specific:
# * ~/.OpenFOAM/$WM_PROJECT_VERSION
# * ~/.OpenFOAM
# * group-specific:
# * $WM_PROJECT_SITE/site/$WM_PROJECT_VERSION
# * $WM_PROJECT_SITE/site
# * general:
# * $WM_PROJECT_DIR/etc
#
# Any changes made to this bashrc file may be lost with the next upgrade.
#
#------------------------------------------------------------------------------
export WM_PROJECT=OpenFOAM
export WM_PROJECT_VERSION=plus.develop
# [FOAM_INST_DIR] - parent directory containing the OpenFOAM installation.
# \- When this file is located as $WM_PROJECT_DIR/etc/bashrc, the next lines
# should work when sourced by BASH or ZSH shells. If this however fails,
# set one of the fallback values to an appropriate path.
# --
rc="${BASH_SOURCE:-${ZSH_NAME:+$0}}"
[ -n "$rc" ] && FOAM_INST_DIR=$(\cd $(dirname $rc)/../.. && \pwd -L) || \
FOAM_INST_DIR=$HOME/$WM_PROJECT
# FOAM_INST_DIR=/opt/$WM_PROJECT
# FOAM_INST_DIR=/usr/local/$WM_PROJECT
#
# END OF (NORMAL) USER EDITABLE PART
################################################################################
: # Extra safety - if the user commented out all fallback values
export FOAM_INST_DIR
unset rc
# Default environment variables.
# Can override with a <prefs.sh> file instead of editing below.
# [WM_COMPILER_TYPE] - Compiler location:
# = system | ThirdParty
export WM_COMPILER_TYPE=system
# [WM_COMPILER] - Compiler:
# = Gcc | Gcc4[8-9] | Gcc5[1-5] | Gcc6[1-4] | Gcc7[1-3] | GccKNL |
# Clang | Clang3[8-9] | Clang[45]0 | Icc | IccKNL | Cray
export WM_COMPILER=Gcc
# [WM_ARCH_OPTION] - Memory addressing:
# = 32 | 64
# * on a 64-bit OS this can be 32 or 64
# * on a 32-bit OS, it is always 32-bit and this option is ignored
export WM_ARCH_OPTION=64
# [WM_PRECISION_OPTION] - Floating-point precision:
# = DP | SP
export WM_PRECISION_OPTION=DP
# [WM_LABEL_SIZE] - Label size in bits:
# = 32 | 64
export WM_LABEL_SIZE=32
# [WM_COMPILE_OPTION] - Optimised, debug, profiling:
# = Opt | Debug | Prof
export WM_COMPILE_OPTION=Opt
# [WM_MPLIB] - MPI implementation:
# = SYSTEMOPENMPI | OPENMPI | SYSTEMMPI | MPI | MPICH | MPICH-GM |
# HPMPI | CRAY-MPICH | FJMPI | QSMPI | SGIMPI | INTELMPI | USERMPI
export WM_MPLIB=SYSTEMOPENMPI
# [FOAM_SIGFPE] - Trapping of floating-point exceptions.
# - overrides the 'trapFpe' controlDict entry
# = true | false
#export FOAM_SIGFPE=true
# [FOAM_SETNAN] - Memory initialisation as NaN
# - overrides the 'setNaN' controlDict entry
# = true | false
#export FOAM_SETNAN=false
# [WM_OSTYPE] - Operating System Type:
# = POSIX
#export WM_OSTYPE=POSIX
################################################################################
# Old directories to be cleaned from PATH, LD_LIBRARY_PATH
foamOldDirs="$WM_PROJECT_DIR $WM_THIRD_PARTY_DIR \
$HOME/$WM_PROJECT/$USER $FOAM_USER_APPBIN $FOAM_USER_LIBBIN \
$WM_PROJECT_SITE $FOAM_SITE_APPBIN $FOAM_SITE_LIBBIN"
# Location of installation and third-party software
export WM_PROJECT_INST_DIR=$FOAM_INST_DIR
export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION
export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION
# [WM_PROJECT_SITE] - Location of site-specific (group) files
# default (unset) implies WM_PROJECT_INST_DIR/site
if [ -d "$WM_PROJECT_SITE" ]
then
export WM_PROJECT_SITE
else
unset WM_PROJECT_SITE
fi
# [WM_PROJECT_USER_DIR] - Location of user files
export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
# Load shell functions
. $WM_PROJECT_DIR/etc/config.sh/functions
# Override definitions via prefs, with 'other' first so the sys-admin
# can provide base values independent of WM_PROJECT_SITE
_foamEtc -mode=o prefs.sh
_foamEtc -mode=ug prefs.sh
# Evaluate command-line parameters and record settings for later.
# These can be used to set/unset values, specify additional files etc.
export FOAM_SETTINGS="$@"
_foamEval $@
# Clean standard environment variables (PATH, MANPATH, LD_LIBRARY_PATH)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export PATH MANPATH LD_LIBRARY_PATH
_foamClean PATH "$foamOldDirs"
_foamClean MANPATH "$foamOldDirs"
_foamClean LD_LIBRARY_PATH "$foamOldDirs"
# Setup for OpenFOAM compilation etc
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_foamEtc -config settings
# Setup for third-party packages
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_foamEtc -config mpi
_foamEtc -config paraview -- $@ # Pass through for evaluation
_foamEtc -config vtk
_foamEtc -config ensight
_foamEtc -config gperftools
## _foamEtc -config ADIOS
_foamEtc -config CGAL
_foamEtc -config scotch
_foamEtc -config FFTW
# Interactive shell
if /usr/bin/tty -s 2>/dev/null
then
_foamEtc -config aliases
[ "${BASH_VERSINFO:-0}" -ge 4 ] && _foamEtc -config bash_completion
fi
# Clean environment paths again. Only remove duplicates
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export PATH MANPATH LD_LIBRARY_PATH
_foamClean PATH
_foamClean MANPATH
_foamClean LD_LIBRARY_PATH
# Add trailing ':' for system manpages
if [ -n "$MANPATH" ]
then
MANPATH="${MANPATH}:"
fi
if [ -n "$LD_PRELOAD" ]
then
export LD_PRELOAD
_foamClean LD_PRELOAD
fi
# Cleanup temporary information
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Unload shell functions
. $WM_PROJECT_DIR/etc/config.sh/functions
# Variables (done as the last statement for a clean exit code)
unset cleaned foamOldDirs
#------------------------------------------------------------------------------
......@@ -212,6 +212,10 @@ case Icc*: # Intel compilers
setenv WM_CC 'icc'
setenv WM_CXX 'icpc'
breaksw
case Arm*: # Arm system compilers
setenv WM_CC 'armclang'
setenv WM_CXX 'armclang++'
breaksw
endsw
# Clear prior to sourcing
......
......@@ -209,6 +209,10 @@ Icc*) # Intel compilers
export WM_CC='icc'
export WM_CXX='icpc'
;;
Arm*) # Arm system compilers
export WM_CC='armclang'
export WM_CXX='armclang++'
;;
esac
# Clear prior to sourcing
......
#----------------------------------*-sh-*--------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
#
# File
# etc/config.sh/settings
# - sourced by OpenFOAM-*/etc/bashrc
#
# Description
# Settings for OpenFOAM.
#
#------------------------------------------------------------------------------
export WM_ARCH=$(uname -s) # System name
: ${WM_OSTYPE:=POSIX}; export WM_OSTYPE # System type (POSIX is default)
# Default compiler = gcc/g++ and C++11
export WM_CC="gcc"
export WM_CXX="g++"
export WM_CFLAGS="-fPIC"
export WM_CXXFLAGS="-fPIC -std=c++11"
unset WM_COMPILER_ARCH WM_COMPILER_LIB_ARCH WM_LDFLAGS
# Adjust according to system and architecture
case "$WM_ARCH" in
Linux)
WM_ARCH=linux
case $(uname -m) in
i686)
export WM_ARCH_OPTION=32
;;
x86_64)
: ${WM_ARCH_OPTION:=64}; export WM_ARCH_OPTION # Default to 64-bit
case "$WM_ARCH_OPTION" in
32)
export WM_COMPILER_ARCH=64
export WM_CFLAGS="$WM_CFLAGS -m32"
export WM_CXXFLAGS="$WM_CXXFLAGS -m32"
export WM_LDFLAGS="-m32"
;;
64)
WM_ARCH=linux64
export WM_COMPILER_LIB_ARCH=64
export WM_CFLAGS="$WM_CFLAGS -m64"
export WM_CXXFLAGS="$WM_CXXFLAGS -m64"
export WM_LDFLAGS="-m64"
;;
*)
echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32|64" 1>&2
;;
esac
;;
ia64)
WM_ARCH=linuxIA64
;;
armv7l)
WM_ARCH=linuxARM7
export WM_ARCH_OPTION=32
export WM_COMPILER_LIB_ARCH=32
;;
aarch64)
WM_ARCH=linuxARM64
export WM_ARCH_OPTION=64
export WM_COMPILER_LIB_ARCH=64
;;
ppc64)
WM_ARCH=linuxPPC64
export WM_COMPILER_LIB_ARCH=64
export WM_CFLAGS="$WM_CFLAGS -m64"
export WM_CXXFLAGS="$WM_CXXFLAGS -m64"
export WM_LDFLAGS="-m64"
;;
ppc64le)
WM_ARCH=linuxPPC64le
export WM_COMPILER_LIB_ARCH=64
export WM_CFLAGS="$WM_CFLAGS -m64"
export WM_CXXFLAGS="$WM_CXXFLAGS -m64"
export WM_LDFLAGS="-m64"
;;
*)
echo Unknown processor type $(uname -m) for Linux 1>&2
;;
esac
;;
SunOS)
WM_ARCH=SunOS64
WM_MPLIB=FJMPI
export WM_COMPILER_LIB_ARCH=64
export WM_CFLAGS="$WM_CFLAGS -mabi=64"
export WM_CXXFLAGS="$WM_CXXFLAGS -mabi=64"
export WM_LDFLAGS="-mabi=64 -G0"
;;
*) # An unsupported operating system
/bin/cat << UNSUPPORTED_OS 1>&2
===============================================================================
Your '$WM_ARCH' operating system is unsupported by this OpenFOAM release.
For further assistance, please contact www.OpenFOAM.com
===============================================================================
UNSUPPORTED_OS
;;
esac
#------------------------------------------------------------------------------
# [FOAM_JOB_DIR] - unset is equivalent to ~/.OpenFOAM/jobControl
## export FOAM_JOB_DIR="$HOME/.OpenFOAM/jobControl"
# wmake configuration
export WM_DIR=$WM_PROJECT_DIR/wmake
export WM_LINK_LANGUAGE=c++
export WM_LABEL_OPTION=Int$WM_LABEL_SIZE
export WM_OPTIONS=$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION$WM_COMPILE_OPTION
# Base executables/libraries
export FOAM_APPBIN=$WM_PROJECT_DIR/platforms/$WM_OPTIONS/bin
export FOAM_LIBBIN=$WM_PROJECT_DIR/platforms/$WM_OPTIONS/lib
# External (ThirdParty) libraries
export FOAM_EXT_LIBBIN=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/lib
# Site-specific (group) files
if [ -n "$WM_PROJECT_SITE" ]
then
siteDir=$WM_PROJECT_SITE
else
siteDir=$WM_PROJECT_INST_DIR/site
fi
# Shared site (group) executables/libraries
export FOAM_SITE_APPBIN=$siteDir/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
export FOAM_SITE_LIBBIN=$siteDir/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
# User executables/libraries
export FOAM_USER_APPBIN=$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin
export FOAM_USER_LIBBIN=$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib
# [FOAM_CODE_TEMPLATES] - dynamicCode templates
# * fallback == "foamEtcFile -list codeTemplates/dynamicCode"
# export FOAM_CODE_TEMPLATES=$WM_PROJECT_DIR/etc/codeTemplates/dynamicCode
# Convenience
export FOAM_ETC=$WM_PROJECT_DIR/etc
export FOAM_APP=$WM_PROJECT_DIR/applications
export FOAM_SRC=$WM_PROJECT_DIR/src
export FOAM_TUTORIALS=$WM_PROJECT_DIR/tutorials
export FOAM_UTILITIES=$WM_PROJECT_DIR/applications/utilities
export FOAM_SOLVERS=$WM_PROJECT_DIR/applications/solvers
export FOAM_RUN=$WM_PROJECT_USER_DIR/run
# Add wmake to the path - not required for runtime-only environment
[ -d "$WM_DIR" ] && PATH=$WM_DIR:$PATH
# Add OpenFOAM scripts to the path
export PATH=$WM_PROJECT_DIR/bin:$PATH
# Add site-specific scripts to path - only if they exist
if [ -d "$siteDir/bin" ] # Generic
then
_foamAddPath "$siteDir/bin"
fi
if [ -d "$siteDir/$WM_PROJECT_VERSION/bin" ] # Version-specific
then
_foamAddPath "$siteDir/$WM_PROJECT_VERSION/bin"
fi
unset siteDir
_foamAddPath $FOAM_USER_APPBIN:$FOAM_SITE_APPBIN:$FOAM_APPBIN
_foamAddLib $FOAM_LIBBIN/dummy # Dummy versions of external libraries last
if [ -n "$FOAM_EXT_LIBBIN" ] # External libraries (allowed to be unset)
then
_foamAddLib $FOAM_EXT_LIBBIN
fi
_foamAddLib $FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN
#------------------------------------------------------------------------------
# Compiler settings
# ~~~~~~~~~~~~~~~~~
# Default to system compiler
: ${WM_COMPILER_TYPE:=system}; export WM_COMPILER_TYPE
# Adjust for non-gcc compilers
case "$WM_COMPILER" in
Clang*) # Clang compiler suite
export WM_CC='clang'
export WM_CXX='clang++'
;;
Cray*) # Cray system compilers
export WM_CC='cc'
export WM_CXX='CC'
;;
Icc*) # Intel compilers
export WM_CC='icc'
export WM_CXX='icpc'
;;
esac
# Clear prior to sourcing
unset gcc_version gmp_version mpfr_version mpc_version
unset GMP_ARCH_PATH MPFR_ARCH_PATH
# Load pre-defined compiler versions
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_foamEtc -config compiler
# ThirdParty base for compilers
archDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH
case "$WM_COMPILER_TYPE-$WM_COMPILER" in
ThirdParty-Gcc*)
gccDir=$archDir/$gcc_version
gmpDir=$archDir/${gmp_version:-gmp-system}
mpfrDir=$archDir/${mpfr_version:-mpfr-system}
mpcDir=$archDir/${mpc_version:-mpc-system}
# Check that the compiler directory can be found
[ -d "$gccDir" ] || /bin/cat << GCC_NOT_FOUND 1>&2
===============================================================================
Warning in $WM_PROJECT_DIR/etc/config.sh/settings:
Cannot find '$WM_COMPILER' compiler installation
$gccDir
Either install this compiler version, or use the system compiler by setting
WM_COMPILER_TYPE to 'system' in \$WM_PROJECT_DIR/etc/bashrc.
===============================================================================
GCC_NOT_FOUND
_foamAddMan $gccDir/man
_foamAddPath $gccDir/bin
# Add ThirdParty compiler libraries to run-time environment
_foamAddLib $gccDir/lib$WM_COMPILER_LIB_ARCH
# Add gmp/mpfr/mpc libraries to run-time environment.
# Require that they exist, automatically find lib64/ or lib/.
_foamAddLibAuto $gmpDir && \
export GMP_ARCH_PATH=$gmpDir # For non-system CGAL
_foamAddLibAuto $mpfrDir && \
export MPFR_ARCH_PATH=$mpfrDir # For non-system CGAL
_foamAddLibAuto $mpcDir
if [ "$FOAM_VERBOSE" -a "$PS1" ]
then
echo "Using ThirdParty compiler"
echo " ${gccDir##*/} (${gmpDir##*/} $${mpfrDir##*/} ${mpcDir##*/})"
fi
;;
ThirdParty-Clang*)
clangDir=$archDir/$clang_version
# Check that the compiler directory can be found
[ -d "$clangDir" ] || /bin/cat << CLANG_NOT_FOUND 1>&2
===============================================================================
Warning in $WM_PROJECT_DIR/etc/config.sh/settings:
Cannot find '$WM_COMPILER' compiler installation
$clangDir
Either install this compiler version, or use the system compiler by setting
WM_COMPILER_TYPE to 'system' in \$WM_PROJECT_DIR/etc/bashrc.
===============================================================================
CLANG_NOT_FOUND
_foamAddMan $clangDir/share/man
_foamAddPath $clangDir/bin
_foamAddLib $clangDir/lib # For things like libomp (openmp) etc
if [ "$FOAM_VERBOSE" -a "$PS1" ]
then
echo "Using ThirdParty compiler"
echo " ${clangDir##*/}"
fi
;;
system-* | ThirdParty-*)
# Using system compiler or other ThirdParty compiler
;;
*)
/bin/cat << UNKNOWN_TYPE 1>&2
===============================================================================
Unknown WM_COMPILER_TYPE="$WM_COMPILER_TYPE" - treating as 'system'
Please check your settings
===============================================================================
UNKNOWN_TYPE
export WM_COMPILER_TYPE=system
;;
esac
# Cleanup
# ~~~~~~~
unset archDir
unset gcc_version gccDir
unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
unset clang_version clangDir
#------------------------------------------------------------------------------
......@@ -58,7 +58,7 @@ setenv WM_COMPILER_TYPE system
# [WM_COMPILER] - Compiler:
# = Gcc | Gcc4[8-9] | Gcc5[1-5] | Gcc6[1-4] | Gcc7[1-3] | GccKNL |
# Clang | Clang3[8-9] | Clang[45]0 | Icc | IccKNL | Cray
# Clang | Clang3[8-9] | Clang[45]0 | Icc | IccKNL | Cray | Arm
setenv WM_COMPILER Gcc
# [WM_ARCH_OPTION] - Memory addressing:
......
SUFFIXES += .c
cWARN = -Wall
cc = armclang
include $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
cFLAGS = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC
ctoo = $(WM_SCHEDULER) $(cc) $(cFLAGS) -c $< -o $@
LINK_LIBS = $(cDBUG)
LINKLIBSO = $(cc) -shared
LINKEXE = $(cc) -Xlinker --add-needed -Xlinker -z -Xlinker nodefs
SUFFIXES += .C .cc .cpp .cxx
c++WARN = \
-Wall -Wextra -Wold-style-cast \
-Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof \
-Wno-undefined-var-template \
-Wno-unknown-warning-option
# Suppress some warnings for flex++ and CGAL
c++LESSWARN = \
-Wno-old-style-cast -Wno-unused-local-typedefs \
-Wno-tautological-undefined-compare -Wno-shift-negative-value
CC = armclang++ -std=c++11
include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
ptFLAGS = -DNoRepository -ftemplate-depth-100
c++FLAGS = $(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)
LINK_LIBS = $(c++DBUG)
LINKLIBSO = $(CC) $(c++FLAGS) -shared
LINKEXE = $(CC) $(c++FLAGS) -Xlinker --add-needed
c++DBUG = -g -DFULLDEBUG
c++OPT = -O0
c++DBUG =
c++OPT = -mcpu=thunderx2t99 -ffp-contract=fast -ffast-math -O3 -funsafe-math-optimizations
c++DBUG = -pg
c++OPT = -O2
cDBUG = -g -DFULLDEBUG
cOPT = -O0
cDBUG =
cOPT = -mcpu=thunderx2t99 -ffp-contract=fast -ffast-math -O3
cDBUG = -pg
cOPT = -O2
CPP = cpp -traditional-cpp $(GFLAGS)
</