forked from NOAA-GFDL/mkmf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile-202312.sh
executable file
·104 lines (83 loc) · 3.3 KB
/
compile-202312.sh
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
#!/bin/csh -f
# download MOM6 code
# git clone --recursive https://github.com/NOAA-GFDL/MOM6-examples.git MOM6-examples
#
set argv=(`getopt -u -o h -l platform: -- $*`)
while ("$argv[1]" != "--")
switch ($argv[1])
case --platform:
set platform = $argv[2]; shift argv; breaksw
endsw
shift argv
end
shift argv
set BASEDIR=`pwd`
set MACHINE_ID=${platform}
set COMPILE_OPTION=${MACHINE_ID}-intel.mk
set compile_FMS=0
set compile_ocean_only=0
set compile_MOM6_SIS2=1
##############################
if ( ${compile_FMS} == 1 ) then
echo "compile FMS library ..."
cd $BASEDIR
mkdir -p build/intel/shared/repro
cd build/intel/shared/repro
if ( -f path_names ) then
rm -f path_names
endif
echo "generating file_paths ..."
../../../../src/mkmf/bin/list_paths ../../../../src/FMS2
echo "generating makefile ..."
../../../../src/mkmf/bin/mkmf -t ../../../../src/mkmf/templates/${COMPILE_OPTION} -p libfms.a -c "-Duse_libMPI -Duse_netCDF -DSPMD" path_names
echo "compiling FMS library..."
make NETCDF=4 REPRO=1 libfms.a -j
cp libfms.a lib_FMS.a
echo "compiling FMS library done"
endif
###############################################
if ( ${compile_ocean_only} == 1 ) then
echo "compile ocean only ..."
cd $BASEDIR
mkdir -p build/intel/ocean_only/repro
cd build/intel/ocean_only/repro
if ( -f path_names ) then
rm -f path_names
endif
echo "generating file_paths ..."
../../../../src/mkmf/bin/list_paths -l ./ ../../../../src/MOM6/{config_src/infra/FMS2,config_src/memory/dynamic_nonsymmetric,config_src/drivers/solo_driver,config_src/external,src{*,*/*}}
echo "generating makefile ..."
../../../../src/mkmf/bin/mkmf -t ../../../../src/mkmf/templates/${COMPILE_OPTION} -o '-I../../shared/repro' -p MOM6 -l '-L ../../shared/repro -lfms' path_names
echo "compiling MOM6 ocean only ..."
make NETCDF=4 REPRO=1 MOM6 -j
# echo "generating libocean.a"
# ar rv libocean.a *o
echo "compiling MOM6 ocean only done"
endif
#######################################
if ( ${compile_MOM6_SIS2} == 1 ) then
echo "compiling MOM6-SIS2 ..."
cd $BASEDIR
mkdir -p build/intel/ice_ocean_SIS2/repro
cd build/intel/ice_ocean_SIS2/repro
if ( -f path_names ) then
rm -f path_names
endif
echo "generating file_paths ..."
../../../../src/mkmf/bin/list_paths -l ./ ../../../../src/MOM6/config_src/{infra/FMS2,memory/dynamic_nonsymmetric,drivers/FMS_cap,external} ../../../../src/SIS2/config_src/dynamic_nonsymmetric ../../../../src/MOM6/src/{*,*/*}/ ../../../../src/{atmos_null,coupler,land_null,ice_param,icebergs/src,SIS2,FMS2/coupler,FMS2/include}
echo "generating makefile ..."
../../../../src/mkmf/bin/mkmf -t ../../../../src/mkmf/templates/${COMPILE_OPTION} -o '-I../../shared/repro' -p MOM6 -l '-L../../shared/repro -lfms' -c '-Duse_AM3_physics -D_USE_LEGACY_LAND_' path_names
echo "compiling MOM6-SIS2 only ..."
make NETCDF=4 REPRO=1 MOM6 -j
echo "generating lib_ocean.a"
rm repro
ar rv lib_ocean.a *o
echo "compiling MOM6-SIS2 done"
# Install library and module files for NEMSAppbuilder
cd $BASEDIR
mkdir -p exec/${MACHINE_ID}/
# link to the library and module files
rm -rf exec/${MACHINE_ID}/lib_FMS exec/${MACHINE_ID}/lib_ocean
ln -s ${BASEDIR}/build/intel/shared/repro exec/${MACHINE_ID}/lib_FMS
ln -s ${BASEDIR}/build/intel/ice_ocean_SIS2/repro exec/${MACHINE_ID}/lib_ocean
endif