- allows reuse of an int64_t scotch library with label-size 32 and/or label-size 64. COMP: prefer scotch/metis/kahip libraries with label-size qualifiers - as noted in #2200, mpirun may insert mpi libraries higher in the library loader which can cause masking of our ThirdParty libraries of the same name. With scotch (for example), the operating system may have an int32 version installed but we have an int64 version compiled under ThirdParty. Runing in serial is fine, but in parallel we resolve to the (incorrect) system version due to the adjustments in mpirun. - adjust the ThirdParty make scripts to also create corresponding links (eg, 'ln -s libscotch.so libscotch-int64.so') and prefer linkage with these qualified libraries. Eg, -L$(SCOTCH_LIB_DIR) -lscotch$(SCOTCH_LIBNAME_SUFFIX) this prevent accidental runtime linkage with the system versions. STYLE: simplify scotch interface code by using local functions
173 lines
4.0 KiB
Bash
173 lines
4.0 KiB
Bash
#----------------------------------*-sh-*--------------------------------------
|
|
# ========= |
|
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
# \\ / O peration |
|
|
# \\ / A nd | www.openfoam.com
|
|
# \\/ M anipulation |
|
|
#------------------------------------------------------------------------------
|
|
# Copyright (C) 2018-2021 OpenCFD Ltd.
|
|
#------------------------------------------------------------------------------
|
|
# License
|
|
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
|
#
|
|
# Script
|
|
# have_kahip
|
|
#
|
|
# Description
|
|
# Detection/setup of KAHIP
|
|
#
|
|
# Requires
|
|
# config.sh/kahip
|
|
#
|
|
# Functions provided
|
|
# have_kahip, no_kahip, echo_kahip, query_kahip, search_kahip
|
|
#
|
|
# Variables set on success
|
|
# HAVE_KAHIP
|
|
# KAHIP_ARCH_PATH
|
|
# KAHIP_INC_DIR
|
|
# KAHIP_LIB_DIR
|
|
# KAHIP_LIBNAME_SUFFIX [optional]
|
|
#
|
|
#------------------------------------------------------------------------------
|
|
. ${WM_PROJECT_DIR:?}/wmake/scripts/sysFunctions # General system functions
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Reset
|
|
no_kahip()
|
|
{
|
|
unset HAVE_KAHIP KAHIP_ARCH_PATH KAHIP_INC_DIR KAHIP_LIB_DIR
|
|
unset KAHIP_VERSION KAHIP_LIBNAME_SUFFIX
|
|
}
|
|
|
|
|
|
# Report
|
|
echo_kahip()
|
|
{
|
|
echo "kahip=${HAVE_KAHIP:-false}"
|
|
echo "root=\"$KAHIP_ARCH_PATH\""
|
|
echo "include=\"$KAHIP_INC_DIR\""
|
|
echo "library=\"$KAHIP_LIB_DIR\""
|
|
if [ -n "$KAHIP_LIBNAME_SUFFIX" ]
|
|
then
|
|
echo "libsuffix=\"$KAHIP_LIBNAME_SUFFIX\""
|
|
fi
|
|
}
|
|
|
|
|
|
# Search
|
|
# $1 : prefix (*_ARCH_PATH, system, ...)
|
|
#
|
|
# On success, return 0 and export variables
|
|
# -> HAVE_KAHIP, KAHIP_ARCH_PATH, KAHIP_INC_DIR, KAHIP_LIB_DIR
|
|
search_kahip()
|
|
{
|
|
local warn="==> skip kahip"
|
|
local incName="kaHIP_interface.h"
|
|
local libName="libkahip"
|
|
|
|
local prefix="${1:-system}"
|
|
local header library
|
|
|
|
# ----------------------------------
|
|
if isNone "$prefix"
|
|
then
|
|
[ -n "$warn" ] && echo "$warn (disabled)"
|
|
return 1
|
|
elif hasAbsdir "$prefix"
|
|
then
|
|
header=$(findFirstFile "$prefix/include/$incName")
|
|
library=$(findExtLib "$libName")
|
|
elif isSystem "$prefix"
|
|
then
|
|
header=$(findSystemInclude -name="$incName")
|
|
prefix=$(sysPrefix "$header")
|
|
else
|
|
unset prefix
|
|
fi
|
|
# ----------------------------------
|
|
|
|
# Header
|
|
[ -n "$header" ] || {
|
|
[ -n "$warn" ] && echo "$warn (no header)"
|
|
return 2
|
|
}
|
|
|
|
# Library
|
|
[ -n "$library" ] \
|
|
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
|
|| {
|
|
[ -n "$warn" ] && echo "$warn (no library)"
|
|
return 2
|
|
}
|
|
|
|
# ----------------------------------
|
|
|
|
# kahip itself is 32-bit int, but our interface handles some
|
|
# 64-bit conversion.
|
|
|
|
echo "kahip (int32) - $prefix"
|
|
export HAVE_KAHIP=true
|
|
export KAHIP_ARCH_PATH="$prefix"
|
|
export KAHIP_INC_DIR="${header%/*}" # Basename
|
|
export KAHIP_LIB_DIR="${library%/*}" # Basename
|
|
}
|
|
|
|
|
|
# Output as per search_* function
|
|
have_kahip()
|
|
{
|
|
local warn="==> skip kahip"
|
|
local config="config.sh/kahip"
|
|
local file
|
|
|
|
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
|
then
|
|
. "$file"
|
|
else
|
|
[ -n "$warn" ] && echo "$warn (no $config)"
|
|
return 1
|
|
fi
|
|
|
|
search_kahip "$KAHIP_ARCH_PATH"
|
|
}
|
|
|
|
|
|
# Query settings
|
|
query_kahip()
|
|
{
|
|
local config="config.sh/kahip"
|
|
local file
|
|
|
|
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
|
then
|
|
. "$file"
|
|
_process_query kahip "$KAHIP_ARCH_PATH"
|
|
else
|
|
echo "(no $config)" 1>&2
|
|
echo "kahip=unknown"
|
|
fi
|
|
}
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Reset
|
|
no_kahip
|
|
|
|
# Test/query
|
|
case "$1" in
|
|
-test | -debug-test)
|
|
[ "$1" = "-debug-test" ] && set -x
|
|
have_kahip
|
|
[ "$1" = "-debug-test" ] && set +x
|
|
echo_kahip
|
|
;;
|
|
-query)
|
|
query_kahip
|
|
;;
|
|
esac
|
|
|
|
#------------------------------------------------------------------------------
|