mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
- provides an optional memory management using a memory pool. Currently can support Umpire (https://github.com/LLNL/Umpire) When available, its use can be controlled by the FOAM_MEMORY_POOL environment variable, or the memory_pool Optimisation switch (etc/controlDict). Notes: Use of the memory-pool is controlled by the 'is_aligned_type()' test and the minimum field size, controlled by the 'use_memory_pool()' test. If the memory-pool is not enabled or not required according to the two above tests, the allocation falls back to either an aligned or unaligned allocation (depending on the field size). The thresholds for aligned, unaligned, memory-pool allocation are still a compile-time option. Made by direct edit of the corrsponding functions.
109 lines
3.1 KiB
Bash
Executable File
109 lines
3.1 KiB
Bash
Executable File
#!/bin/sh
|
|
cd "${0%/*}" || exit # Run from this directory
|
|
targetType=libo # Preferred library type
|
|
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments $*
|
|
. ${WM_PROJECT_DIR:?}/wmake/scripts/have_umpire
|
|
|
|
#------------------------------------------------------------------------------
|
|
# Hack for MacOS (with Gcc).
|
|
# The gcc compiler include path has something like this:
|
|
# /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include
|
|
#
|
|
# but xcode flex installs under this:
|
|
# /Applications/Xcode.app/Contents/Developer/
|
|
# Toolchains/XcodeDefault.xctoolchain/usr/include
|
|
|
|
case "${WM_ARCH}/${WM_COMPILER}" in
|
|
(darwin*/Gcc*)
|
|
if [ ! -f FlexLexer.h ]
|
|
then
|
|
# Remove stale link(s)
|
|
rm -f FlexLexer.h lnInclude/FlexLexer.h
|
|
|
|
for include in \
|
|
/usr/include \
|
|
/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include \
|
|
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include \
|
|
;
|
|
do
|
|
if [ -f "$include"/FlexLexer.h ]
|
|
then
|
|
echo "Adding FlexLexer.h link to ${PWD##*/} (darwin/gcc)" 1>&2
|
|
ln -sf "$include"/FlexLexer.h FlexLexer.h
|
|
|
|
if [ -d lnInclude ]
|
|
then
|
|
(cd lnInclude && ln -sf ../FlexLexer.h .)
|
|
fi
|
|
break
|
|
fi
|
|
done
|
|
fi
|
|
;;
|
|
(*)
|
|
if [ -f FlexLexer.h ]
|
|
then
|
|
echo "Removing old FlexLexer.h link from ${PWD##*/}" 1>&2
|
|
rm -f FlexLexer.h lnInclude/FlexLexer.h
|
|
fi
|
|
;;
|
|
esac
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
unset COMP_FLAGS LINK_FLAGS
|
|
|
|
# If <sys/inotify.h> is available (Linux)
|
|
if [ -f /usr/include/sys/inotify.h ]
|
|
then
|
|
echo " found <sys/inotify.h> -- using inotify for file monitoring" 1>&2
|
|
export COMP_FLAGS="-DFOAM_USE_INOTIFY"
|
|
fi
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Have -lumpire, but also -lcamp etc.
|
|
# Also need to follow the link order
|
|
get_umpire_libs()
|
|
{
|
|
if [ -d "${UMPIRE_LIB_DIR}" ]
|
|
then
|
|
set -- $(
|
|
# Expected link order
|
|
for name in umpire fmt camp
|
|
do
|
|
[ -f "$UMPIRE_LIB_DIR/lib${name}.a" ] && echo "-l$name"
|
|
done
|
|
)
|
|
echo "$@"
|
|
else
|
|
echo
|
|
fi
|
|
}
|
|
|
|
|
|
if have_umpire
|
|
then
|
|
libNames="$(get_umpire_libs)"
|
|
|
|
if [ -n "$libNames" ]
|
|
then
|
|
echo " found umpire -- enabling memory pool interface" 1>&2
|
|
echo " umpire libs: $libNames" 1>&2
|
|
|
|
COMP_FLAGS="$COMP_FLAGS -DFOAM_USE_UMPIRE -I${UMPIRE_INC_DIR}"
|
|
LINK_FLAGS="$LINK_FLAGS -L${UMPIRE_LIB_DIR} $libNames"
|
|
export COMP_FLAGS LINK_FLAGS
|
|
else
|
|
echo " expecting umpire, but did not resolve the libraries" 1>&2
|
|
fi
|
|
fi
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Make object (non-shared by default)
|
|
# Never want/need openmp, especially for static objects
|
|
wmake -no-openmp $targetType
|
|
|
|
#------------------------------------------------------------------------------
|