Commit fb4a0ee7 authored by mark's avatar mark
Browse files

ENH: ensure adios_config information reflects installation and is moveable

parent 74b42821
......@@ -53,6 +53,7 @@ usage() {
usage: ${0##*/} [OPTION] [adios-VERSION]
options:
-cmake PATH With cmake from the path given
-gcc Force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX
-help
......@@ -80,7 +81,12 @@ do
export CC=gcc # use gcc/g++
export CXX=g++
;;
ADIOS-[1-9]* | adios-[1-9]* | ADIOS-git | adios-git)
-cmake)
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
CMAKE_PATH="${2%%/}"
shift
;;
ADIOS-[1-9]* | adios-[1-9]* | ADIOS-git* | adios-git*)
adiosPACKAGE="${1%%/}"
;;
*)
......@@ -119,6 +125,115 @@ echo ========================================
echo "Build adios library $adiosPACKAGE for $FOAM_MPI"
echo
#
# Manual adjustments to adios config
#
adjustADIOS()
{
# Rename libraries according to FOAM_MPI
(
cd $ADIOS_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH || exit 1
if [ "$FOAM_MPI" != dummy ]
then
\mv -f libadios.a libadios_$FOAM_MPI.a
\mv -f libadiosread.a libadiosread_$FOAM_MPI.a
fi
\mv -f libadios_nompi.a libadios_dummy.a
\mv -f libadiosread_nompi.a libadiosread_dummy.a
echo
echo "ADIOS library renamed to libadios_$FOAM_MPI"
echo
)
# We don't need/use XML things
\rm -f $ADIOS_ARCH_PATH/bin/adios_lint
# Replace resolved paths with variables
echo "Adjust prefix for ADIOS"
for i in \
$ADIOS_ARCH_PATH/bin/adios_config \
$ADIOS_ARCH_PATH/etc/adios_config.flags \
;
do
[ -f "$i" ] || {
echo " no such file - '$i'"
continue
}
if sed -i -e 's|'"$WM_THIRD_PARTY_DIR"'|$WM_THIRD_PARTY_DIR|g' $i
then
echo " '$i'"
else
echo " problems with '$i'"
fi
done
# Adjust the config flags file:
# * Remove references to Fortran libraries (disabled in configure)
# * Remove references to deprecated version 1 API
# * Cleanup excessive whitespace
# * Handle renamed libraries:
# - libadios -> libadios_$FOAM_MPI
# - libadios_nompi -> libadios_dummy
#
echo "Adjust library names for ADIOS"
for i in \
$ADIOS_ARCH_PATH/etc/adios_config.flags \
;
do
[ -f "$i" ] || {
echo " no such file - '$i'"
continue
}
if sed -i \
-e '/_FLIB=/d' \
-e '/_V1_INC=/d' \
-e 's| *| |g' \
-e 's|\(-ladios[a-z]*_\)nompi |\1dummy |g' \
$i
then
echo " '$i'"
else
echo " problems with '$i'"
fi
if [ "$FOAM_MPI" != dummy ]
then
sed -i -e 's|\(-ladios[a-z]*\) |\1_'"$FOAM_MPI |g" $i || \
echo " problems with '$i'"
fi
done
}
#
# List ADIOS methods/configuration
#
listMethods()
{
[ -f $ADIOS_ARCH_PATH/bin/adios_config ] || {
echo "Warning: no adios_config"
return 1
}
echo "==============="
# May have problems listing parallel methods (eg, transport key missing)
if $ADIOS_ARCH_PATH/bin/adios_config -m >/dev/null 2>&1
then
$ADIOS_ARCH_PATH/bin/adios_config -m 2>/dev/null
else
echo "Warning: could not list parallel methods"
# Fallback to serial methods
$ADIOS_ARCH_PATH/bin/adios_config -s -m 2>/dev/null
fi || echo "Warning: could not list configured methods"
echo "==============="
}
# Needs future adjustment
# - for shared library
# - for mpi-specific library locations
......@@ -128,98 +243,122 @@ then
echo " ADIOS header in $ADIOS_ARCH_PATH/include"
### echo " ADIOS libs in $FOAM_EXT_LIBBIN" # dynamic
echo " ADIOS libs in $ADIOS_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" # static
listMethods
elif [ -z "$CMAKE_PATH" ]
then
echo "Starting build: $adiosPACKAGE (using configure)"
echo
else
(
# configuration options:
unset configOpt
(
# configuration options:
unset configOpt
# Add InfiniBand support
ibDir=/usr/local/ofed
if [ -d "$ibDir" ]
then
configOpt="$configOpt --with-infiniband=$ibDir"
fi
# Add InfiniBand support
ibDir=/usr/local/ofed
if [ -d "$ibDir" -a "$FOAM_MPI" != dummy ]
then
configOpt="$configOpt --with-infiniband=$ibDir"
fi
# Transport layers
if [ -f "/usr/include/bzlib.h" ]
then
configOpt="$configOpt --with-bzip2=/usr"
fi
# Transport layers
if [ -f "/usr/include/bzlib.h" ]
then
configOpt="$configOpt --with-bzip2"
fi
if [ -f "/usr/include/zlib.h" ]
then
configOpt="$configOpt --with-zlib=/usr"
fi
if [ -f "/usr/include/zlib.h" ]
then
configOpt="$configOpt --with-zlib"
fi
# Other types of support
## $configOpt="$configOpt --with-hdf5=..."
## $configOpt="$configOpt --with-lustre=..."
## configOpt="$configOpt --enable-research-transports"
# end of configuration options
# ----------------------------
buildDIR=$buildBASE/$adiosPACKAGE
# Other types of support
## $configOpt="$configOpt --with-hdf5=..."
## $configOpt="$configOpt --with-lustre=..."
configOpt="$configOpt --enable-research-transports"
cd $ADIOS_SOURCE_DIR || exit 1
[ -e Makefile ] && make distclean 2>/dev/null
# end of configuration options
# ----------------------------
buildDIR=$buildBASE/$adiosPACKAGE
export GIT_DIR=$ADIOS_SOURCE_DIR/.git
cd $ADIOS_SOURCE_DIR || exit 1
[ -e Makefile ] && make distclean 2>/dev/null
# Remove any existing build folder and recreate
rm -rf $ADIOS_ARCH_DIR
rm -rf $buildDIR 2>/dev/null
mkdir -p $buildDIR
export GIT_DIR=$ADIOS_SOURCE_DIR/.git
[ -f configure ] || {
echo "no configure for $adiosPACKAGE ... trying autogen"
./autogen.sh
}
# Remove any existing build folder and recreate
rm -rf $ADIOS_ARCH_DIR
rm -rf $buildDIR 2>/dev/null
mkdir -p $buildDIR
# May not work properly with FOAM_MPI = dummy
if [ "$FOAM_MPI" = dummy ]
then
configOpt="$configOpt --without-mpi"
else
CC=mpicc
CXX=mpicxx
fi
[ -f configure ] || {
echo "no configure for $adiosPACKAGE ... trying autogen"
./autogen.sh
# Install into lib64/
cd $buildDIR && $ADIOS_SOURCE_DIR/configure \
--prefix=$ADIOS_ARCH_PATH \
--libdir=$ADIOS_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \
--disable-fortran \
--with-pic \
--without-fastbit \
$configOpt \
&& make -j $WM_NCOMPPROCS all \
&& make install \
&& echo "Built: $adiosPACKAGE" \
&& adjustADIOS \
&& listMethods
) || {
echo "Error building: $adiosPACKAGE"
}
else
# CMake options often lag the configure ones
echo "Starting build: $adiosPACKAGE (using cmake)"
echo
(
buildDIR=$buildBASE/$adiosPACKAGE
cd $ADIOS_SOURCE_DIR || exit 1
# May not work properly with FOAM_MPI = dummy
if [ "$FOAM_MPI" = dummy ]
then
configOpt="$configOpt --without-mpi"
else
CC=mpicc
CXX=mpicxx
fi
# Install into lib64/
cd $buildDIR && $ADIOS_SOURCE_DIR/configure \
--prefix=$ADIOS_ARCH_PATH \
--libdir=$ADIOS_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \
--disable-fortran \
--with-pic \
--without-fastbit \
$configOpt \
&& make -j $WM_NCOMPPROCS all \
&& make install \
&& echo "Built: $adiosPACKAGE" \
&& cd $ADIOS_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH && \
{
# Rename according to FOAM_MPI
if [ "$FOAM_MPI" != dummy ]
export GIT_DIR=$ADIOS_SOURCE_DIR/.git
# Remove any existing build folder and recreate
rm -rf $ADIOS_ARCH_DIR
rm -rf $buildDIR 2>/dev/null
mkdir -p $buildDIR
# May not work properly with FOAM_MPI = dummy
if [ "$FOAM_MPI" = dummy ]
then
\mv -f libadios.a libadios_$FOAM_MPI.a
\mv -f libadiosread.a libadiosread_$FOAM_MPI.a
configOpt="$configOpt --without-mpi"
else
CC=mpicc
CXX=mpicxx
fi
\mv -f libadios_nompi.a libadios_dummy.a
\mv -f libadiosread_nompi.a libadiosread_dummy.a
echo
echo "ADIOS library renamed to libadios_$FOAM_MPI"
echo
} && cd $ADIOS_ARCH_PATH/bin && \
{
# We don't need/use XML things
\rm -f adios_lint
$ADIOS_ARCH_PATH/bin/adios_config -m 2>/dev/null || \
echo "Warning: Problems running adios_config"
cmake=$(findCMake)
# Install into lib64/
cd $buildDIR && $cmake \
-DCMAKE_INSTALL_PREFIX=$ADIOS_ARCH_PATH \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_FORTRAN:BOOL=FALSE \
$ADIOS_SOURCE_DIR \
&& make -j $WM_NCOMPPROCS all \
&& make install \
&& echo "Built: $adiosPACKAGE" \
&& adjustADIOS \
&& listMethods
) || {
echo "Error building: $adiosPACKAGE"
}
) || {
echo "Error building: $adiosPACKAGE"
}
fi
# ----------------------------------------------------------------- end-of-file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment