COMP: stricter handling of openmp vs no-openmp

- give precedence to ~openmp (-no-openmp) over +openmp (-openmp)
  in the general rules and in the Makefile. This makes it robuster
  when specifying +openmp in general, but ~openmp for specific build
  components.

- disable openmp for OSspecific and Pstream components.
  Neither should contain any openmp code anyhow.

  Additionally, since OSspecific is generally built as a static
  object, it can become problematic (eg, with AMD ROCm) if the
  compiler generates information that openmp is required but then uses
  static linkage.
This commit is contained in:
Mark Olesen
2023-12-11 09:54:49 +01:00
parent cd493897d3
commit d086cc5a0e
9 changed files with 61 additions and 18 deletions

View File

@ -6,7 +6,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2015-2016 OpenFOAM Foundation
# Copyright (C) 2018-2021 OpenCFD Ltd.
# Copyright (C) 2018-2023 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -348,19 +348,43 @@ sameDependency()
# Build a mpi-versioned library (targetType)
# - use sentinel file(s) to handle paraview version changes
# compile into qualified directory
# compile into MPI-qualified directory
# use sentinel file(s) to handle version changes
# 1 - libName
# 2... build/configure information
#
# Global variables used:
# - WM_OPTIONS, WM_MPLIB, FOAM_MPI
# - targetType
#
# Requires that WM_MPLIB contain an "MPI" string
#
# Has very simple option handling (bool options only!) that allow
# things like "wmakeLibMpi -debug -no-openmp" etc.
#
wmakeLibMpi()
{
local libName="$1"
local libName
local wmakeCmd="wmake"
# Very simple option handling (bool options only!)
while [ "$#" -gt 0 ]
do
case "$1" in
(- | --) # Stop option parsing
shift
break
;;
(-*) # Any bool option
wmakeCmd="$wmakeCmd $1"
;;
(*)
break # Done
;;
esac
shift
done
libName="$1"
shift
case "$WM_MPLIB" in (*MPI* | *mpi*)
@ -374,8 +398,8 @@ wmakeLibMpi()
sentinel=$(sameDependency "$libName" "MPLIB=$WM_MPLIB" "MPI=$FOAM_MPI" $@) || \
wclean "$libName"
echo "wmake $targetType $libName (mpi=$WM_MPLIB:$FOAM_MPI)"
wmake $targetType "$libName" && \
echo "$wmakeCmd $targetType${targetType:+ }(mpi=$WM_MPLIB:$FOAM_MPI)"
$wmakeCmd $targetType "$libName" && \
storeDependency "$sentinel" "MPLIB=$WM_MPLIB" "MPI=$FOAM_MPI" $@
)
;;