forked from NOAA-GSL/rrfs_utl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rrfs_utl
executable file
·127 lines (110 loc) · 4.95 KB
/
build.rrfs_utl
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/bin/sh
# common modules to compile GSI/EnKF:
# Jet: source /home/rtrr/PARM_EXEC/modulefiles/modulefile.jet.GSI_UPP_WRF
# Theia: source /home/rtrr/PARM_EXEC/modulefiles/modulefile.theia.GSI_UPP_WRF
# Cheyenne: source /glade/p/ral/jntp/gge/modulefiles/modulefile.cheyenne.GSI_UPP_WRF
#
# build commands:
# cmake -DENKF_MODE=WRF -DBUILD_CORELIBS=ON -DBUILD_GSDCLOUD_ARW=ON path_to_GSI
# cmake -DENKF_MODE=WRF -DBUILD_CORELIBS=ON -DBUILD_GSDCLOUD_ARW=ON -DBUILD_UTIL_COM=ON -DBUILD_ENKF_PREPROCESS_ARW=ON path_to_GSI"
# (for global: cmake -D-DENKF_MODE=GFS -DBUILD_CORELIBS=ON path_to_GSI)
# make -j8
#
dir_root=$(pwd)
################# Hera ####################
if [[ "`grep -i "hera" /etc/hosts | head -n1`" != "" ]] ; then
source /etc/profile.d/modules.sh
modulefile="/home/rtrr/PARM_EXEC/modulefiles/modulefile.hera.GSI_UPP_WRF"
NCEPLIBS="/scratch1/BMC/comgsi/precompiled/NCEPLIBS/b_intel18.0.5.274_impi2018.0.4/install"
GSILIBS="/scratch1/BMC/comgsi/precompiled/GSILIBS/b_intel18.0.5.274_impi2018.0.4"
################# Jet ####################
elif [[ -d /jetmon ]] ; then
source /etc/profile.d/modules.sh
modulefile="/home/rtrr/PARM_EXEC/modulefiles/modulefile.jet.GSI_UPP_WRF"
NCEPLIBS="/lfs4/BMC/wrfruc/gge/precompiled/NCEPLIBS/b_intel18.0.5.274_impi2018.4.274/install"
GSILIBS="/lfs4/BMC/wrfruc/gge/precompiled/GSILIBS/b_intel18.0.5.274_impi2018.4.274"
################# Cheyenne ####################
elif [[ -d /glade ]] ; then
source /etc/profile.d/modules.sh
modulefile="/glade/p/ral/jntp/gge/modulefiles/modulefile.cheyenne.GSI_UPP_WRF"
NCEPLIBS="/glade/p/ral/jntp/gge/precompiled/NCEPLIBS/b_intel18.0.5_impi2018.4.274/install"
GSILIBS="/glade/p/ral/jntp/gge/precompiled/GSILIBS/b_intel18.0.5_impi2018.4.274"
#modulefile="/glade/p/ral/jntp/gge/precompiled/NCEPLIBS/modulefile.cheyenne.GSI_UPP_WRF.gnu"
#NCEPLIBS="/glade/p/ral/jntp/gge/precompiled/NCEPLIBS/b_gnu8.3.0_openmpi3.1.4/install"
#GSILIBS="/glade/p/ral/jntp/gge/precompiled/GSILIBS/b_gnu8.3.0_openmpi3.1.4/"
################# Orion ####################
elif [[ -d /work/noaa ]] ; then ### orion
modulefile="/home/gge/modulefiles/modulefile.orion.GSI_UPP_WRF"
NCEPLIBS="/work/noaa/wrfruc/gge/precompiled/NCEPLIBS/b_intel2018.4_impi2018.4/install"
GSILIBS="/work/noaa/wrfruc/gge/precompiled/GSILIBS/b_intel2018.4_impi2018.4"
################# Generic ####################
else
echo -e "\nunknown machine"
echo "Please modify build.comgsi at this location"
echo "to load required modules and setup NCEPLIBS and GSILIBS"
##follow the above examples and delete the following "exit 9" to go forward
exit 9
source /etc/profile.d/modules.sh
modulefile="/my/modulefile.me.GSI_UPP_WRF"
NCEPLIBS="/my/NCEPLIBS/b_intel18.0.5_impi2018.4.274/install"
GSILIBS="/my/GSILIBS/b_intel18.0.5_impi2018.4.274/"
fi
if [ ! -f $modulefile ]; then
echo "modulefiles $modulefile does not exist"
exit 10
fi
source $modulefile
## if NETCDF4 is set to 0 or 1, unset it
if [[ "$NETCDF4" == "1" ]] || [[ "$NETCDF4" == "0" ]]; then
unset NETCDF4
fi
export BACIO_LIB4=${NCEPLIBS}/lib/libbacio_4.a
#export BUFR_LIBd=${NCEPLIBS}/lib/libbufr_d.a
export BUFR_LIBd=${GSILIBS}/lib/libbufr_v.a
export GSIWRF_LIB=${GSILIBS}/lib/libWRFLIB.a
export CRTM_LIB=${NCEPLIBS}/lib/libcrtm.a
export CRTM_INC=${NCEPLIBS}/include
export NEMSIO_LIB=${NCEPLIBS}/lib/libnemsio.a
export NEMSIO_INC=${NCEPLIBS}/include
export SFCIO_LIB4=${NCEPLIBS}/lib/libsfcio_4.a
export SFCIO_INC4=${NCEPLIBS}/include_4
export SIGIO_LIB4=${NCEPLIBS}/lib/libsigio_4.a
export SIGIO_INC4=${NCEPLIBS}/include_4
export SP_LIBd=${NCEPLIBS}/lib/libsp_d.a
export SP_LIB4=${NCEPLIBS}/lib/libsp_4.a
export W3EMC_LIBd=${NCEPLIBS}/lib/libw3emc_d.a
export W3EMC_LIB4=${NCEPLIBS}/lib/libw3emc_4.a
export W3EMC_INCd=${NCEPLIBS}/include_d
export W3EMC_INC4=${NCEPLIBS}/include_4
export W3NCO_LIBd=${NCEPLIBS}/lib/libw3nco_d.a
export W3NCO_LIB4=${NCEPLIBS}/lib/libw3nco_4.a
export IP_LIBd=${NCEPLIBS}/lib/libip_d.a
export IP_LIB4=${NCEPLIBS}/lib/libip_4.a
set -x
rm -rf $dir_root/build
mkdir -p $dir_root/build
cd $dir_root/build
set +x
echo "compiled at the node:" >> output.log
hostname >> output.log
module list >> output.log
echo -e "\nThe branch name:" >> output.log
git branch | grep "*" >> output.log
echo -e "\nThe commit ID:" >> output.log
git log -1 | head -n1 >> output.log
echo -e "\ngit status:" >> output.log
git status >> output.log
echo -e "\nCompiling commands:" >> output.log
echo " cmake -DENKF_MODE=WRF -DBUILD_CORELIBS=ON -DBUILD_GSDCLOUD_ARW=ON -DBUILD_ENKF_PREPROCESS_ARW=ON -DBUILD_UTIL_COM=ON -Wno-dev .." >> output.log
echo " make -j8" >> output.log
cat output.log
cmake .. 2>&1 | tee output.cmake
make -j 4 2>&1 | tee output.compile
###aftermath
commitID=`git log -1 | head -n1 |cut -c8-15`
repoName=`git config --get remote.origin.url | cut -d: -f2`
repoName=${repoName//\//:}
datestamp=`date +%Y%m%d`
cd bin
echo -e "\n\nAll build results are at ./build/ \n\n"
exit