Last active
March 22, 2021 03:02
-
-
Save shahrzad/0cef99eecddff82aafa17d8bcee314c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
module purge | |
module load cmake | |
source_dir="$HOME/src/" | |
install_dir="$HOME/lib/" | |
CXX_FLAGS="-DHPX_WITH_THREAD_IDLE_RATES=ON -DHPX_WITH_EXAMPLES=OFF" | |
if [ $# -eq 3 ] | |
then | |
build_type=$1 | |
compiler=$2 | |
node_name=$3 | |
####################build type######################## | |
if [ $1 == 'Release' ] || [ $1 == 'release' ] | |
then | |
CXX_FLAGS="${CXX_FLAGS} -DCMAKE_BUILD_TYPE='Release'" | |
hpx_build_dir="${source_dir}/hpx/build_release" | |
hpx_install_dir="${install_dir}/hpx/hpx_release" | |
build_type="release" | |
elif [ $1 == 'Debug' ] || [ $1 == 'debug' ] | |
then | |
CXX_FLAGS="${CXX_FLAGS} -DCMAKE_BUILD_TYPE='Debug' -DHPX_WITH_THREAD_BACKTRACE_DEPTH=50" | |
hpx_build_dir="${source_dir}/hpx/build_debug" | |
hpx_install_dir="${install_dir}/hpx/hpx_debug" | |
build_type="debug" | |
elif [ $1 == 'RelWithDebInfo' ] || [ $1 == 'relwithdebinfo' ] || [ $1 == 'relDeb' ] || [ $1 == 'reldeb' ] | |
then | |
CXX_FLAGS="${CXX_FLAGS} -DCMAKE_BUILD_TYPE='RelWithDebInfo'" | |
build_dir="${source_dir}/hpx/build_relDeb" | |
install_dir="${install_dir}/hpx/hpx_relDeb" | |
build_type="release" | |
else | |
echo "Error: Build type not accepted" | |
exit | |
fi | |
####################compiler type######################## | |
if [ ${compiler} == 'clang' ] || [ ${compiler} == 'Clang' ] | |
then | |
module load clang | |
module load boost | |
hpx_build_dir="${hpx_build_dir}_clang" | |
hpx_install_dir="${hpx_install_dir}_clang" | |
CXX_FLAGS="${CXX_FLAGS} -DCMAKE_CXX_FLAGS=-stdlib=libc++" | |
elif [ ${compiler} == 'gcc' ] || [ ${compiler} == 'GCC' ] | |
then | |
module load gcc | |
module load boost | |
hpx_build_dir="${hpx_build_dir}_gcc" | |
hpx_install_dir="${hpx_install_dir}_gcc" | |
else | |
echo "ERROR: Compiler type not accepted" | |
exit | |
fi | |
hpx_build_dir="${hpx_build_dir}_${node_name}" | |
hpx_install_dir="${hpx_install_dir}_${node_name}" | |
if [ ${hpx_build_dir} != "" ] && [ ${hpx_install_dir} != "" ] | |
then | |
rm -rf "${hpx_build_dir}" | |
rm -rf "${hpx_install_dir}" | |
rm -rf "${hpx_build_dir}/hpx_cmake_log.txt" | |
CXX_FLAGS="${CXX_FLAGS} -DCMAKE_INSTALL_PREFIX=${hpx_install_dir}" | |
else | |
echo "ERROR: Build or install directory was not set properly" | |
exit | |
fi | |
mkdir -p ${hpx_build_dir} | |
mkdir -p ${hpx_build_dir}/info | |
mkdir -p ${hpx_install_dir} | |
touch "${hpx_build_dir}/info/hpx_cmake_log.txt" | |
touch "${hpx_build_dir}/info/hpx_git_log.txt" | |
touch "${hpx_build_dir}/info/hpx_date.txt" | |
cd ${hpx_build_dir} | |
cmake ${CXX_FLAGS} .. | tee ${hpx_build_dir}/info/hpx_cmake_log.txt | |
echo "Running on ${node_name}">>${hpx_build_dir}/info/hpx_cmake_log.txt | |
make -j 16 | |
make install -j 16 | |
cd ${source_dir}/hpx | |
BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
echo "$BRANCH branch">>${hpx_build_dir}/info/hpx_git_log.txt | |
git --git-dir ${source_dir}/hpx/.git log -n50>>${hpx_build_dir}/info/hpx_git_log.txt | |
date>>"${hpx_build_dir}/info/hpx_date.txt" | |
else | |
echo "Error: Three arguments should be provided: build_type compiler node_name" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment