forked from ufs-community/MPAS-Model
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·67 lines (61 loc) · 1.63 KB
/
build.sh
File metadata and controls
executable file
·67 lines (61 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
# shellcheck disable=SC1090,1091
HOMEmpas="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
source "${HOMEmpas}/ush/detect_machine.sh"
COMPILER="${COMPILER:-intel}"
# ==============================================================================
usage() {
set +x
echo
echo "Usage: $0 -j <num> -h"
echo
echo " -j number of build jobs DEFAULT: 8"
echo " -c additional CMAKE options"
echo " -f force a clean build"
echo " -h display this message and quit"
echo
exit 1
}
while getopts "c:j:hf" opt; do
case ${opt} in
c)
CMAKE_OPTS=${OPTARG}
;;
j)
BUILD_JOBS=${OPTARG}
;;
f)
CLEAN_BUILD=YES
;;
h|\?|:)
usage
;;
esac
done
cd "${HOMEmpas}" || exit 1
module purge
module use "${HOMEmpas}/modulefiles"
module load "mpas/${MACHINE}.${COMPILER}"
module list
BUILD_DIR=${BUILD_DIR:-${HOMEmpas}/build}
if [[ ${CLEAN_BUILD} == 'YES' ]]; then
[[ -d ${BUILD_DIR} ]] && rm -rf ${BUILD_DIR}
elif [[ -d ${BUILD_DIR} ]]; then
printf "Build directory (${BUILD_DIR}) already exists\n"
printf "Please choose what to do:\n\n"
printf "[r]emove the existing directory\n"
printf "[c]ontinue building in the existing directory\n"
printf "[q]uit this build script\n"
read -p "Choose an option (r/c/q):" choice
case ${choice} in
[Rr]* ) rm -rf ${BUILD_DIR} ;;
[Cc]* ) ;;
* ) exit ;;
esac
fi
mkdir -p ${BUILD_DIR}
cd ${BUILD_DIR} || exit 1
BUILD_JOBS=${BUILD_JOBS:-8}
CMAKE_OPTS+=' -DMPAS_DOUBLE_PRECISION=OFF'
cmake ${CMAKE_OPTS} -DMPAS_CORES="init_atmosphere;atmosphere" ..
make -j $BUILD_JOBS