COMP: simplify openmp handling (#2617)

- remove old, unneeded -DUSE_OMP define.
- wmake -no-openmp option to add '~openmp' to WM_COMPILE_CONTROL

ENH: add bash completion handling for wmake
This commit is contained in:
Mark Olesen
2022-10-26 10:34:25 +02:00
parent fd55151a12
commit 24ffc5236d
13 changed files with 54 additions and 32 deletions

View File

@ -1,4 +1,4 @@
EXE_INC = $(COMP_OPENMP) /* -UUSE_OMP */
EXE_INC = $(COMP_OPENMP)
/* Mostly do not need to explicitly link openmp libraries */
/* EXE_LIBS = $(LINK_OPENMP) */

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -41,12 +41,6 @@ Description
int main(int argc, char *argv[])
{
#if USE_OMP
std::cout << "USE_OMP defined (" << USE_OMP << ")\n";
#else
std::cout << "USE_OMP undefined\n";
#endif
#if _OPENMP
std::cout << "_OPENMP = " << _OPENMP << "\n\n";

View File

@ -6,11 +6,10 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2017-2019 OpenCFD Ltd.
# Copyright (C) 2017-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# foamCreateCompletionCache
@ -195,7 +194,7 @@ extractOptions()
#------------------------------------------------------------------------------
# Default to standard search directories and a few scripts from bin/
[ "$#" -gt 0 ] || set -- ${searchDirs} paraFoam
[ "$#" -gt 0 ] || set -- ${searchDirs} paraFoam wmake
for item
do

View File

@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2017-2020 OpenCFD Ltd.
# Copyright (C) 2017-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -44,6 +44,10 @@ fi
# Add completion for commands, directories of commands
# -clear
# -list
# -quiet
# -verbose
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
unset -f foamAddCompletion 2>/dev/null
foamAddCompletion()
@ -52,12 +56,24 @@ foamAddCompletion()
echo "Usage: foamAddCompletion -clear | -list | dir(s) | app(s)" 1>&2
local appName choices
local verboseOnMissing=true
for appName
do
if [ "$appName" = "-clear" ]
if [ "$appName" = "-quiet" ]
then
# No message for missing applications
unset verboseOnMissing
elif [ "$appName" = "-verbose" ]
then
# Report for missing applications
verboseOnMissing="true"
elif [ "$appName" = "-clear" ]
then
# Clear cached values
echo "clear cached values" 1>&2
echo "Clear cached values" 1>&2
_of_complete_cache_=()
elif [ "$appName" = "-list" ]
@ -81,7 +97,8 @@ foamAddCompletion()
then
complete -o filenames -F _of_complete_ "${appName##*/}"
# echo "complete ${appName##*/}" 1>&2
elif [ -n "$appName" ]
elif [ -n "$appName" ] && [ -n "$verboseOnMissing" ]
then
echo "No completions for $appName" 1>&2
echo "[ignore if OpenFOAM is not yet compiled]" 1>&2
@ -236,8 +253,8 @@ then
# Completions for predefined directories
foamAddCompletion "$FOAM_APPBIN"
# A few scripts from bin/
foamAddCompletion paraFoam
# Completions for a few common scripts (allowed to be missing)
foamAddCompletion -quiet paraFoam wmake
fi
else
# Bash version is too old.

View File

@ -1,8 +1,9 @@
# Flags for compiling/linking openmp
# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP)
# -
# Clang provides 'omp' and a link for 'gomp'.
# With 'gomp' we can also use system libs.
COMP_OPENMP = -DUSE_OMP -fopenmp
COMP_OPENMP = -fopenmp
LINK_OPENMP = -lgomp
# -----------------------------------------------------------------------------

View File

@ -1,5 +1,6 @@
# Flags for compiling/linking openmp
# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP)
COMP_OPENMP = -DUSE_OMP -fopenmp
COMP_OPENMP = -fopenmp
LINK_OPENMP = -lomp
# -----------------------------------------------------------------------------

View File

@ -1,5 +1,6 @@
# Flags for compiling/linking openmp
# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP)
COMP_OPENMP = -DUSE_OMP -fopenmp
COMP_OPENMP = -fopenmp
LINK_OPENMP = -lgomp
# -----------------------------------------------------------------------------

View File

@ -1,5 +1,6 @@
# Flags for compiling/linking openmp
# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP)
COMP_OPENMP = -DUSE_OMP -qopenmp
COMP_OPENMP = -qopenmp
LINK_OPENMP = -qopenmp
# -----------------------------------------------------------------------------

View File

@ -1,5 +1,6 @@
# Flags for compiling/linking openmp
# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP)
COMP_OPENMP = -DUSE_OMP -fiopenmp
COMP_OPENMP = -fiopenmp
LINK_OPENMP = -fiopenmp
# -----------------------------------------------------------------------------

View File

@ -1,5 +1,6 @@
# Flags for compiling/linking openmp
# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP)
COMP_OPENMP = -DUSE_OMP -fopenmp
COMP_OPENMP = -fopenmp
LINK_OPENMP = -lnvomp
# -----------------------------------------------------------------------------

View File

@ -5,7 +5,7 @@ include $(GENERAL_RULES)/standard
# Darwin-specific
# ----
COMP_OPENMP = -DUSE_OMP -Xpreprocessor -fopenmp
COMP_OPENMP = -Xpreprocessor -fopenmp
LINK_OPENMP = -lomp
# ----

View File

@ -5,7 +5,7 @@ include $(GENERAL_RULES)/standard
# Fujitsu-specific
# ----
COMP_OPENMP = -DUSE_OMP -fopenmp
COMP_OPENMP = -fopenmp
LINK_OPENMP = -lfjomp
# ----

View File

@ -75,6 +75,7 @@ cat<<HELP_FULL
-module-prefix=PATH Specify FOAM_MODULE_PREFIX as absolute/relative path
-module-prefix=TYPE Specify FOAM_MODULE_PREFIX as predefined type
(u,user | g,group | o,openfoam)
-no-openmp Disable openmp (adds '~openmp' to WM_COMPILE_CONTROL)
-no-scheduler Disable scheduled parallel compilation
-show-api Print api value (from Make rules)
@ -308,6 +309,11 @@ do
-k | -keep-going | -non-stop)
export WM_CONTINUE_ON_ERROR=true
;;
# Disable use of openmp
-no-openmp)
WM_COMPILE_CONTROL="$WM_COMPILE_CONTROL ~openmp"
export WM_COMPILE_CONTROL
;;
# Disable scheduled parallel compilation
-no-scheduler)
unset WM_SCHEDULER