Skip to content

Commit

Permalink
Updates build script with "exit". More consistent.
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward Palmer committed Jul 9, 2024
1 parent 734dc2a commit eb04448
Showing 1 changed file with 39 additions and 31 deletions.
70 changes: 39 additions & 31 deletions scripts/build-platypus-csd3-sapphire.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#SBATCH --exclusive
. /etc/profile.d/modules.sh

# TODO:
# - Update the platypus-commit to master once the Platypus PR which makes
# the Hephaestus code no longer a dependency is merged-in.

function load_modules() {
module purge
module load rhel8/default-icl cmake
Expand All @@ -19,12 +23,12 @@ function load_modules() {
module load python/3.8
module load ninja

export STACK_SRC=`mktemp -d /tmp/moose_stack_src.XXXXXX`
export WORKDIR=`pwd`
export STACK_SRC=$(mktemp -d /tmp/moose_stack_src.XXXXXX)
export WORKDIR=$(pwd)
export compile_cores=8
export OMPI_MCA_mca_base_component_show_load_errors=0

USER=`whoami`
USER=$(whoami)
BUILD_DIR_NAME=${WORKDIR}

ROOT_PATH=/home/${USER}/rds/rds-ukaea-ap001/${USER}
Expand All @@ -36,16 +40,16 @@ function load_modules() {
HDF5_DIR_NAME=hdf5
HDF5_INSTALL_PATH=${WORKDIR}/${HDF5_DIR_NAME}

PETSC_COMMIT=38aca504f6ea08cc814f159b2c9bcf837a5876f3
PETSC_DIR_NAME=petsc
PETSC_INSTALL_DIR=${BUILD_PATH}/petsc

MOOSE_COMMIT=4e99faf9804480e7be302895ff9b8ded5b9944ea

PLATYPUS_COMMIT=f76d45c2dab57cdd6de54e63002ef2ad5fb8881d

export PATH=${BUILD_PATH}:${PATH}

cd ${WORKDIR}
cd ${WORKDIR} || exit 1

#Need to set some compiler flags via config file"
echo "-std=c++17" >> icpx.cfg
echo "-Wno-tautological-constant-compare" >> icpx.cfg
Expand All @@ -64,19 +68,23 @@ function load_modules() {
}

function build_hdf5() {
cd ${WORKDIR}
mkdir -p ${HDF5_DIR_NAME} || { echo "Failed to create ${HDF5_DIR_NAME}" ; exit 1 ; }
cd "${WORKDIR}" || exit 1
mkdir -p ${HDF5_DIR_NAME} || {
echo "Failed to create ${HDF5_DIR_NAME}"
exit 1
}

HDF5_MAJ_VER=1.10
HDF5_MIN_VER=10
HDF5_VER=${HDF5_MAJ_VER}.${HDF5_MIN_VER}

echo "Downloading HDF5"
curl -kLJO \
https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-${HDF5_MAJ_VER}/hdf5-${HDF5_VER}/src/hdf5-${HDF5_VER}.tar.gz \
|| { echo "Failed to download hdf5" ; exit 1 ; }
tar -xf hdf5-${HDF5_VER}.tar.gz

cd hdf5-${HDF5_VER}
cd hdf5-${HDF5_VER} || exit 1
make clean
./configure --prefix=${HDF5_INSTALL_PATH} --enable-cxx --enable-fortran --enable-build-mode=production
make install -j ${compile_cores}
Expand All @@ -94,12 +102,12 @@ function download_superlu_dist() {
}

function build_petsc() {
cd $WORKDIR
cd $WORKDIR || exit 1
mkdir -p petsc
cd petsc
curl -kL -O http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.19.3.tar.gz
tar -xf petsc-3.19.3.tar.gz -C .
cd petsc-3.19.3
cd petsc-3.19.3 || exit 1
./configure \
--with-cc=$CC --with-cxx=$CXX --with-fc=$FC -CXXPP=cpp \
--prefix=${WORKDIR}/${PETSC_DIR_NAME} \
Expand Down Expand Up @@ -144,9 +152,9 @@ function build_libtirpc() {

function build_moose() {
export MOOSE_JOBS=32
cd $WORKDIR
cd $WORKDIR || exit 1
git clone https://github.com/idaholab/moose
cd moose
cd moose || exit 1
git checkout ${MOOSE_COMMIT} || { echo "Checkout failed" ; exit 1 ; }
if [ ! -f "$WORKDIR/petsc/lib/libpetsc.so" ] ; then
echo "PETSc Install Unsuccessful"
Expand Down Expand Up @@ -179,37 +187,37 @@ function build_moose() {

./configure --with-derivative-size=200 --with-ad-indexing-type=global
METHODS='opt' ./scripts/update_and_rebuild_wasp.sh
cd framework
METHOD=opt make -j"$compile_cores"
cd framework || exit 1
METHOD=opt make -j$compile_cores
cd ..
cd modules
METHOD=opt make -j"$compile_cores"
cd modules || exit 1
METHOD=opt make -j$compile_cores
cd ..
cd test
METHOD=opt make -j"$compile_cores"
./run_tests -j"$compile_cores"
cd test || exit 1
METHOD=opt make -j$compile_cores
./run_tests -j"$compile_cores
cd ..
cd ..
}
function build_gslib() {
cd $WORKDIR
cd $WORKDIR || exit 1
if [ -d "$WORKDIR/gslb" ] ; then
return
fi
git clone https://github.com/Nek5000/gslib.git
cd gslib
cd gslib || exit 1
make CFLAGS='-O2 -fPIC'
}
function build_mfem() {
cd $WORKDIR
cd $WORKDIR || exit 1
git clone https://github.com/Heinrich-BR/mfem.git
cd mfem
cd mfem || exit 1
git checkout SubmeshBoundary
sed -i "s|list|# list|g" $WORKDIR/mfem/config/cmake/modules/FindNetCDF.cmake
mkdir build
cd build
cd build || exit 1
echo "Building MFEM"
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
Expand All @@ -231,17 +239,17 @@ function build_mfem() {
-DHDF5_DIR=/$WORKDIR/${HDF5_DIR_NAME}/ \
-DMFEM_USE_GSLIB=YES \
-DGSLIB_DIR=/$WORKDIR/gslib/build
make -j"$compile_cores"
cd miniapps/common
make -j"$compile_cores"
make -j$compile_cores
cd miniapps/common || exit 1
make -j$compile_cores
}

function build_platypus() {
cd $WORKDIR
cd $WORKDIR || exit 1
git clone https://github.com/aurora-multiphysics/platypus.git
cd platypus
cd platypus || exit 1
git checkout ${PLATYPUS_COMMIT}
make -j"$compile_cores"
make -j$compile_cores
}

load_modules
Expand Down

0 comments on commit eb04448

Please sign in to comment.