Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Build/Scripts/HYPRE/build_hypre.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ if [ -d "$FIREMODELS/hypre" ]; then
cd $FIREMODELS/hypre
if [[ "$(git tag -l "v2.32.0")" == "v2.32.0" ]]; then
echo "Checking out v2.32.0"
$(git checkout v2.32.0)
git checkout v2.32.0
fi
cd $FIREMODELS/hypre/src
cd $FIREMODELS/hypre/src/cmbuild
export HYPRE_VERSION=$(git describe)
echo "Cleaning hypre repository..."
make distclean
rm -r $FIREMODELS/hypre/src/cmbuild/*
cp $FIREMODELS/fds/Build/Scripts/HYPRE/$CONFMAKE .
./$CONFMAKE
# get back from detached HEAD state
cd $FIREMODELS/hypre
$(git checkout master)
git checkout master
cd $dir
export HYPRE_HOME=$FIREMODELS/libs/hypre/$HYPRE_VERSION
echo "Hypre library:" $FIREMODELS/libs/hypre/$HYPRE_VERSION
Expand Down
33 changes: 33 additions & 0 deletions Build/Scripts/HYPRE/confmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
export HYPRE_INSTALL_PREFIX=$FIREMODELS/libs/hypre/$HYPRE_VERSION

if [[ "$FDS_BUILD_TARGET" == *"osx"* ]]; then
C_FLAGS="-O3"
elif [[ "$FDS_BUILD_TARGET" == *"intel"* ]]; then
C_FLAGS="-O3 -fno-unsafe-math-optimizations -fp-model=precise"
else
C_FLAGS="-O3"
fi

cmake_args=(
-DCMAKE_INSTALL_PREFIX="$HYPRE_INSTALL_PREFIX"
-DCMAKE_C_COMPILER="$CC"
-DCMAKE_C_FLAGS="$C_FLAGS"
-DCMAKE_INSTALL_LIBDIR="lib"
)

# Add OSX deployment target if building for macOS
if [[ "$FDS_BUILD_TARGET" == *"osx"* ]]; then
if [ "$(uname -m)" == "x86_64" ]; then
cmake_args+=(-DCMAKE_OSX_DEPLOYMENT_TARGET="10.6")
else
cmake_args+=(-DCMAKE_OSX_DEPLOYMENT_TARGET="13.0")
fi
fi

# Run cmake with the arguments
cmake ../ "${cmake_args[@]}"

# ./configure CC=$CC FC=mpiifort CFLAGS="-O3 -fno-unsafe-math-optimizations -fp-model=precise" FFLAGS="-O3 -fno-unsafe-math-optimizations -fp-model=precise" \
# --prefix=$FIREMODELS/libs/hypre/$HYPRE_VERSION

make install
13 changes: 0 additions & 13 deletions Build/Scripts/HYPRE/confmake_impi_intel_linux.sh

This file was deleted.

4 changes: 2 additions & 2 deletions Build/Scripts/SUNDIALS/build_sundials.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if [ -d "$FIREMODELS/sundials" ]; then
cd $FIREMODELS/sundials
if [[ "$(git tag -l "v6.7.0")" == "v6.7.0" ]]; then
echo "Checking out v6.7.0"
$(git checkout v6.7.0)
git checkout v6.7.0
fi
mkdir $FIREMODELS/sundials/BUILDDIR
cd $FIREMODELS/sundials/BUILDDIR
Expand All @@ -46,7 +46,7 @@ if [ -d "$FIREMODELS/sundials" ]; then
./$CONFMAKE
# get back from detached HEAD state
cd $FIREMODELS/sundials
$(git checkout main)
git checkout main
cd $dir
export SUNDIALS_HOME=$FIREMODELS/libs/sundials/$SUNDIALS_VERSION
echo "Sundials library:" $FIREMODELS/libs/sundials/$SUNDIALS_VERSION
Expand Down
29 changes: 29 additions & 0 deletions Build/Scripts/SUNDIALS/confmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
export SUNDIALS_INSTALL_PREFIX=$FIREMODELS/libs/sundials/$SUNDIALS_VERSION

cmake_args=(
-DCMAKE_INSTALL_PREFIX="$SUNDIALS_INSTALL_PREFIX"
-DEXAMPLES_INSTALL_PATH="$SUNDIALS_INSTALL_PREFIX/examples"
-DCMAKE_C_COMPILER="$CC"
-DCMAKE_CXX_COMPILER="$CXX"
-DCMAKE_Fortran_COMPILER="$FC"
-DBUILD_FORTRAN_MODULE_INTERFACE=ON
-DEXAMPLES_ENABLE_CXX=OFF
-DEXAMPLES_ENABLE_CUDA=OFF
-DEXAMPLES_ENABLE_F2003=OFF
-DENABLE_OPENMP=OFF
-DCMAKE_INSTALL_LIBDIR="lib"
)

# Add OSX deployment target if building for macOS
if [[ "$FDS_BUILD_TARGET" == *"osx"* ]]; then
if [ "$(uname -m)" == "x86_64" ]; then
cmake_args+=(-DCMAKE_OSX_DEPLOYMENT_TARGET="10.6")
else
cmake_args+=(-DCMAKE_OSX_DEPLOYMENT_TARGET="13.0")
fi
fi

# Run cmake with the arguments
cmake ../ "${cmake_args[@]}"

make install
35 changes: 0 additions & 35 deletions Build/Scripts/SUNDIALS/confmake_impi_intel_linux.sh

This file was deleted.

63 changes: 63 additions & 0 deletions Build/Scripts/build_thirdparty_libs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# PARSE OPTIONS FOR CLEAN LIBRARY BUILDS ####################################

# Set FIREMODELS environment variable if it is not already exists.
if [ -z "${FIREMODELS}" ]; then
export FIREMODELS="$(readlink -f "$(pwd)/../../../")"
fi

echo "FIREMODELS=$FIREMODELS"

clean_hypre=false
clean_sundials=false
ARG=""

# Loop through the options
while [[ $# -gt 0 ]]; do
case "$1" in
--clean-hypre)
clean_hypre=true # Set the flag to true when --clean-hypre is used
shift
;;
--clean-sundials)
clean_sundials=true
shift
;;
--)
shift
break
;;
*)
ARG="${ARG} $1" # Append unrecognized arguments to ARG
shift
;;
esac
done

# Trim leading spaces from ARG, if necessary
ARG="${ARG#"${ARG%%[![:space:]]*}"}"

if [ "$clean_hypre" = true ]; then
echo "Option --clean-hypre is set."
fi

if [ "$clean_sundials" = true ]; then
echo "Option --clean-sundials is set."
fi

# FINISHED WITH CLEANING OPTIONS ###########################################

# Decide compilers
source ../Scripts/set_thirdparty_compilers.sh

# build hypre
source ../Scripts/HYPRE/build_hypre.sh confmake.sh $clean_hypre

## build sundials
source ../Scripts/SUNDIALS/build_sundials.sh confmake.sh $clean_sundials


# Use ARG and the options
#echo "ARG is: $ARG"
if [ "$SOURCE_INTEL_IFORT" -eq 1 ]; then
source ../Scripts/set_intel_compiler.sh $ARG
fi
166 changes: 166 additions & 0 deletions Build/Scripts/set_thirdparty_compilers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
echo "FDS build target = $FDS_BUILD_TARGET"

# For following variables 1- indicate availble through
# environment variable FIREMODELS_CC, FIREMODELS_CXX, and FIREMODELS_FC
set_CC=0
set_CXX=0
set_FC=0

if [ -n "$FIREMODELS_CC" ]; then
CC=$FIREMODELS_CC
if command -v $CC &> /dev/null; then
set_CC=1
else
echo "The compiler specified by the FIREMODELS_CC environment variable ($CC) is not available on this system. Searching for an alternative compiler."
fi
fi

if [ -n "$FIREMODELS_CXX" ]; then
CXX=$FIREMODELS_CXX
if command -v $CXX &> /dev/null; then
set_CXX=1
else
echo "The compiler specified by the FIREMODELS_CXX environment variable ($CXX) is not available on this system. Searching for an alternative compiler."
fi
fi

if [ -n "$FIREMODELS_FC" ]; then
FC=$FIREMODELS_FC
if command -v $FC &> /dev/null; then
set_FC=1
else
echo "The compiler specified by the FIREMODELS_FC environment variable ($FC) is not available on this system. Searching for an alternative compiler."
fi
fi


if [[ "$FDS_BUILD_TARGET" == *"osx"* ]]; then
# Check for C compiler (mpicc, gcc, clang)
if [ $set_CC -eq 0 ]; then
if command -v mpicc &> /dev/null; then
CC=mpicc
elif command -v clang &> /dev/null; then
CC=clang
elif command -v gcc &> /dev/null; then
CC=gcc
else
echo "Error: Any of mpicc, iclang, or gcc is not available on this system."
exit 1
fi
fi

# Check for clang C++ compiler (mpicxx, g++, clang ++)
if [ $set_CXX -eq 0 ]; then
if command -v mpicxx &> /dev/null; then
CXX=mpicxx
elif command -v clang++ &> /dev/null; then
CXX=clang++
elif command -v g++ &> /dev/null; then
CXX=g++
else
echo "Error: Any of mpicxx, clang++, or g++ is not available on this system."
exit 1
fi
fi

# Check for Fortran compiler (gfortran)
if [ $set_FC -eq 0 ]; then
if command -v mpifort &> /dev/null; then
FC=mpifort
elif command -v gfortran &> /dev/null; then
FC=gfortran
else
echo "Error: gfortran is not available on this system."
exit 1
fi
fi

elif [[ "$FDS_BUILD_TARGET" == *"intel"* ]]; then
# Check for Intel C compiler
if [ $set_CC -eq 0 ]; then
if command -v mpiicx &> /dev/null; then
CC=mpiicx
elif command -v icx &> /dev/null; then
CC=icx
elif command -v mpiicc &> /dev/null; then
CC=mpiicc
elif command -v icc &> /dev/null; then
CC=icc
else
echo "Error: Any of mpiicx, icx, mpiicc, or icc is not available on this system."
exit 1
fi
fi

# Check for Intel C++ compiler
if [ $set_CXX -eq 0 ]; then
if command -v mpiicpx &> /dev/null; then
CXX=mpiicpx
elif command -v icpx &> /dev/null; then
CXX=icpx
elif command -v mpiicpc &> /dev/null; then
CXX=mpiicpc
elif command -v icpc &> /dev/null; then
CXX=icpc
else
echo "Error: Any of mpiicpx, icpx, mpiicpc, or icpc is not available on this system."
exit 1
fi
fi

# Check for Intel Fortran compiler (ifort). ifx will be added in future.
if [ $set_FC -eq 0 ]; then
if command -v mpiifort &> /dev/null; then
FC=mpiifort
elif command -v ifort &> /dev/null; then
FC=ifort
else
echo "Error: Any of mpiifort, or ifort is not available on this system."
exit 1
fi
fi
else #gnu
# Check for gnu C compiler (gcc)
if [ $set_CC -eq 0 ]; then
if command -v mpicc &> /dev/null; then
CC=mpicc
elif command -v gcc &> /dev/null; then
CC=gcc
else
echo "Error: Any of mpicc, gcc is not available on this system."
exit 1
fi
fi

# Check for Intel C++ compiler (g++)
if [ $set_CXX -eq 0 ]; then
if command -v mpicxx &> /dev/null; then
CXX=mpicxx
elif command -v g++ &> /dev/null; then
CXX=g++
else
echo "Error: Any of mpicxx, g++ is not available on this system."
exit 1
fi
fi

# Check for Fortran compiler (gfortran)
if [ $set_FC -eq 0 ]; then
if command -v mpifort &> /dev/null; then
FC=mpifort
elif command -v gfortran &> /dev/null; then
FC=gfortran
else
echo "Error: Any of mpifort, gfortran is not available on this system."
exit 1
fi
fi
fi

echo "C Compiler CC=$CC"
echo "C++ compiler CXX=$CXX"
echo "Fortran compiler FC=$FC"

export CC=$CC
export CXX=$CXX
export FC=$FC
Loading