321 |
|
|
322 |
#================================================================ |
#================================================================ |
323 |
# look for possible FORTRAN compilers |
# look for possible FORTRAN compilers |
324 |
tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95" |
tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95 gfortran" |
325 |
p_FC= |
p_FC= |
326 |
for c in $tmp ; do |
for c in $tmp ; do |
327 |
rm -f ./hello.f ./hello |
rm -f ./hello.f ./hello |
527 |
*only* works if it is supported by the OPTFILE that |
*only* works if it is supported by the OPTFILE that |
528 |
is being used. |
is being used. |
529 |
|
|
530 |
|
-ts | --ts |
531 |
|
Produce timing information per timestep |
532 |
|
|
533 |
-mpi | --mpi |
-mpi | --mpi |
534 |
Include MPI header files and link to MPI libraries |
Include MPI header files and link to MPI libraries |
535 |
-mpi=PATH | --mpi=PATH |
-mpi=PATH | --mpi=PATH |
671 |
RET_C=$? |
RET_C=$? |
672 |
cat <<EOF > genmake_tc_2.$FS |
cat <<EOF > genmake_tc_2.$FS |
673 |
program hello |
program hello |
674 |
Real*8 wtime |
REAL*8 wtime |
675 |
external cloc |
external cloc |
676 |
call cloc(wtime) |
call cloc(wtime) |
677 |
print *," HELLO WORLD", wtime |
print *," HELLO WORLD", wtime |
678 |
end program hello |
end |
679 |
EOF |
EOF |
680 |
$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_warnings 2>&1 |
$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_warnings 2>&1 |
681 |
RET_F=$? |
RET_F=$? |
717 |
integer nbyte |
integer nbyte |
718 |
call tfsize(nbyte) |
call tfsize(nbyte) |
719 |
print *," HELLO WORLD", nbyte |
print *," HELLO WORLD", nbyte |
720 |
end program hello |
end |
721 |
EOF |
EOF |
722 |
$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_tc.log 2>&1 |
$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_tc.log 2>&1 |
723 |
RET_F=$? |
RET_F=$? |
837 |
NOOPTFLAGS= |
NOOPTFLAGS= |
838 |
MPI= |
MPI= |
839 |
MPIPATH= |
MPIPATH= |
840 |
|
TS= |
841 |
|
|
842 |
# DEFINES checked by test compilation |
# DEFINES checked by test compilation or command-line |
843 |
HAVE_SYSTEM= |
HAVE_SYSTEM= |
844 |
HAVE_FDATE= |
HAVE_FDATE= |
845 |
FC_NAMEMANGLE= |
FC_NAMEMANGLE= |
847 |
HAVE_STAT= |
HAVE_STAT= |
848 |
HAVE_NETCDF= |
HAVE_NETCDF= |
849 |
HAVE_ETIME= |
HAVE_ETIME= |
850 |
|
IGNORE_TIME= |
851 |
|
|
852 |
MODS= |
MODS= |
853 |
TOOLSDIR= |
TOOLSDIR= |
893 |
|
|
894 |
# The following state can be set directly by command-line switches |
# The following state can be set directly by command-line switches |
895 |
gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE" |
gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE" |
896 |
gm_s2="FC CPP IEEE MPI JAM DUMPSTATE STANDARDDIRS" |
gm_s2="FC CPP IEEE TS MPI JAM DUMPSTATE STANDARDDIRS" |
897 |
|
|
898 |
# The following state is not directly set by command-line switches |
# The following state is not directly set by command-line switches |
899 |
gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPEND PDEPEND PDEFAULT INCLUDES FFLAGS FOPTIM " |
gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPEND PDEPEND PDEFAULT INCLUDES FFLAGS FOPTIM " |
1073 |
-noieee | --noieee) |
-noieee | --noieee) |
1074 |
IEEE= ;; |
IEEE= ;; |
1075 |
|
|
1076 |
|
-ts | --ts) |
1077 |
|
TS=true ;; |
1078 |
|
|
1079 |
-mpi | --mpi) |
-mpi | --mpi) |
1080 |
MPI=true ;; |
MPI=true ;; |
1081 |
-mpi=* | --mpi=*) |
-mpi=* | --mpi=*) |
1099 |
ac_prev=TAMC_EXTRA ;; |
ac_prev=TAMC_EXTRA ;; |
1100 |
-tamc_extra=* | --tamc_extra=*) |
-tamc_extra=* | --tamc_extra=*) |
1101 |
TAMC_EXTRA=$ac_optarg ;; |
TAMC_EXTRA=$ac_optarg ;; |
1102 |
|
|
1103 |
|
-ignoretime | -ignore_time | --ignoretime | --ignore_time) |
1104 |
|
IGNORE_TIME="-DIGNORE_TIME" ;; |
1105 |
|
|
1106 |
-*) |
-*) |
1107 |
echo "Error: unrecognized option: "$ac_option |
echo "Error: unrecognized option: "$ac_option |
1159 |
|
|
1160 |
# Find the MITgcm ${THISVER} |
# Find the MITgcm ${THISVER} |
1161 |
if test -f "${ROOTDIR}/doc/tag-index" ; then |
if test -f "${ROOTDIR}/doc/tag-index" ; then |
1162 |
THISVER=`grep checkpoint ${ROOTDIR}/doc/tag-index | head -1` |
THISVER=`grep '^checkpoint' ${ROOTDIR}/doc/tag-index | head -1` |
1163 |
fi |
fi |
1164 |
|
|
1165 |
if test "x$MAKEFILE" = x ; then |
if test "x$MAKEFILE" = x ; then |
1311 |
DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI" |
DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI" |
1312 |
fi |
fi |
1313 |
|
|
1314 |
|
if test ! "x$TS" = x ; then |
1315 |
|
echo " Turning on timing per timestep" |
1316 |
|
DEFINES="$DEFINES -DTIME_PER_TIMESTEP" |
1317 |
|
fi |
1318 |
|
|
1319 |
printf "\n=== Checking system libraries ===\n" |
printf "\n=== Checking system libraries ===\n" |
1320 |
printf " Do we have the system() command using $FC... " |
printf " Do we have the system() command using $FC... " |
1321 |
cat > genmake_tcomp.$FS <<EOF |
cat > genmake_tcomp.$FS <<EOF |
1338 |
printf " Do we have the fdate() command using $FC... " |
printf " Do we have the fdate() command using $FC... " |
1339 |
cat > genmake_tcomp.$FS <<EOF |
cat > genmake_tcomp.$FS <<EOF |
1340 |
program hello |
program hello |
1341 |
CHARACTER(128) string |
CHARACTER*(128) string |
1342 |
string = ' ' |
string = ' ' |
1343 |
call fdate( string ) |
call fdate( string ) |
1344 |
print *, string |
print *, string |
1403 |
else |
else |
1404 |
echo "no" |
echo "no" |
1405 |
fi |
fi |
1406 |
|
DEFINES="$DEFINES $IGNORE_TIME" |
1407 |
|
|
1408 |
printf "\n=== Setting defaults ===\n" |
printf "\n=== Setting defaults ===\n" |
1409 |
printf " Adding MODS directories: " |
printf " Adding MODS directories: " |
1842 |
cat $i/$j >> ad_files |
cat $i/$j >> ad_files |
1843 |
done |
done |
1844 |
done |
done |
1845 |
|
if test ! "x"$FS = "x.f" ; then |
1846 |
|
cat ad_files | sed -e "s/\.f/.$FS/g" > ad_files_f |
1847 |
|
mv -f ad_files_f ad_files |
1848 |
|
fi |
1849 |
|
|
1850 |
echo |
echo |
1851 |
echo "=== Creating the Makefile ===" |
echo "=== Creating the Makefile ===" |
2041 |
cat ad_flow_files.inc >> $MAKEFILE |
cat ad_flow_files.inc >> $MAKEFILE |
2042 |
echo >> $MAKEFILE |
echo >> $MAKEFILE |
2043 |
echo 'F77FILES = $(SRCFILES:.F=.'$FS')' >> $MAKEFILE |
echo 'F77FILES = $(SRCFILES:.F=.'$FS')' >> $MAKEFILE |
2044 |
echo 'F90FILES = $(F90SRCFILES:.F=.'$FS90')' >> $MAKEFILE |
echo 'F90FILES = $(F90SRCFILES:.F90=.'$FS90')' >> $MAKEFILE |
2045 |
echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE |
echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE |
2046 |
echo >> $MAKEFILE |
echo >> $MAKEFILE |
2047 |
echo '.SUFFIXES:' >> $MAKEFILE |
echo '.SUFFIXES:' >> $MAKEFILE |
2170 |
|
|
2171 |
# ... AD ... |
# ... AD ... |
2172 |
adall: ad_taf |
adall: ad_taf |
2173 |
adtaf: ad_taf_output.f |
adtaf: ad_taf_output.$FS |
2174 |
adtamc: ad_tamc_output.f |
adtamc: ad_tamc_output.$FS |
2175 |
|
|
2176 |
ad_input_code.f: \$(AD_FILES) \$(HEADERFILES) |
ad_input_code.$FS: \$(AD_FILES) \$(HEADERFILES) |
2177 |
@$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -DALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > ad_config.template |
@$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -DALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > ad_config.template |
2178 |
cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h |
cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h |
2179 |
-rm -f ad_config.template |
-rm -f ad_config.template |
2180 |
@make \$(F77FILES) |
@make \$(F77FILES) |
2181 |
@make \$(AD_FLOW_FILES) |
@make \$(AD_FLOW_FILES) |
2182 |
cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.f |
cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.$FS |
2183 |
|
|
2184 |
ad_taf_output.f: ad_input_code.f |
ad_taf_output.$FS: ad_input_code.$FS |
2185 |
\$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f |
\$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS |
2186 |
cat ad_input_code_ad.f | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.f |
cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.$FS |
2187 |
|
|
2188 |
adtafonly: |
adtafonly: |
2189 |
\$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f |
\$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS |
2190 |
cat ad_input_code_ad.f | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.f |
cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.$FS |
2191 |
|
|
2192 |
ad_taf: ad_taf_output.o \$(OBJFILES) |
ad_taf: ad_taf_output.o \$(OBJFILES) |
2193 |
\$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS) |
\$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS) |
2194 |
|
|
2195 |
ad_tamc_output.f: ad_input_code.f |
ad_tamc_output.$FS: ad_input_code.$FS |
2196 |
\$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.f |
\$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.$FS |
2197 |
cat ad_input_code_ad.f | sed -f \$(TOOLSDIR)/adjoint_sed > ad_tamc_output.f |
cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_tamc_output.$FS |
2198 |
|
|
2199 |
ad_tamc: ad_tamc_output.o \$(OBJFILES) |
ad_tamc: ad_tamc_output.o \$(OBJFILES) |
2200 |
\$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS) |
\$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS) |
2207 |
|
|
2208 |
# ... FTL ... |
# ... FTL ... |
2209 |
ftlall: ftl_taf |
ftlall: ftl_taf |
2210 |
ftltaf: ftl_taf_output.f |
ftltaf: ftl_taf_output.$FS |
2211 |
ftltamc: ftl_tamc_output.f |
ftltamc: ftl_tamc_output.$FS |
2212 |
|
|
2213 |
ftl_input_code.f: \$(AD_FILES) \$(HEADERFILES) |
ftl_input_code.$FS: \$(AD_FILES) \$(HEADERFILES) |
2214 |
@$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -DALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > ftl_config.template |
@$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -DALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > ftl_config.template |
2215 |
cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h |
cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h |
2216 |
-rm -f ftl_config.template |
-rm -f ftl_config.template |
2217 |
@make \$(F77FILES) |
@make \$(F77FILES) |
2218 |
@make \$(AD_FLOW_FILES) |
@make \$(AD_FLOW_FILES) |
2219 |
cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.f |
cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.$FS |
2220 |
|
|
2221 |
ftl_taf_output.f: ftl_input_code.f |
ftl_taf_output.$FS: ftl_input_code.$FS |
2222 |
\$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f |
\$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS |
2223 |
cat ftl_input_code_ftl.f | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.f |
cat ftl_input_code_ftl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.$FS |
2224 |
|
|
2225 |
ftltafonly: |
ftltafonly: |
2226 |
\$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f |
\$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS |
2227 |
cat ftl_input_code_ftl.f | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.f |
cat ftl_input_code_ftl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.$FS |
2228 |
|
|
2229 |
ftl_taf: ftl_taf_output.o \$(OBJFILES) |
ftl_taf: ftl_taf_output.o \$(OBJFILES) |
2230 |
\$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS) |
\$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS) |
2231 |
|
|
2232 |
ftl_tamc_output.f: ftl_input_code.f |
ftl_tamc_output.$FS: ftl_input_code.$FS |
2233 |
\$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.f |
\$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.$FS |
2234 |
cat ftl_input_code_ftl.f | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_tamc_output.f |
cat ftl_input_code_ftl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_tamc_output.$FS |
2235 |
|
|
2236 |
ftl_tamc: ftl_tamc_output.o \$(OBJFILES) |
ftl_tamc: ftl_tamc_output.o \$(OBJFILES) |
2237 |
\$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS) |
\$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS) |
2238 |
|
|
2239 |
|
|
2240 |
# ... SVD ... |
# ... SVD ... |
2241 |
svdtaf: ad_taf_output.f ftl_taf_output.f |
svdtaf: ad_taf_output.$FS ftl_taf_output.$FS |
2242 |
@echo "--->>> Only ran TAF to generate SVD code! <<<---" |
@echo "--->>> Only ran TAF to generate SVD code! <<<---" |
2243 |
@echo "--->>> Do make svdall afterwards to compile. <<<---" |
@echo "--->>> Do make svdall afterwards to compile. <<<---" |
2244 |
svdall: svd_touch svd_taf |
svdall: svd_touch svd_taf |
2254 |
@echo "--->>> Only COMPILE svd code! <<<---" |
@echo "--->>> Only COMPILE svd code! <<<---" |
2255 |
@echo "--->>> Assumes you previously <<<---" |
@echo "--->>> Assumes you previously <<<---" |
2256 |
@echo "--->>> did make svdtaf <<<---" |
@echo "--->>> did make svdtaf <<<---" |
2257 |
touch ad_taf_output.f ftl_taf_output.f |
touch ad_taf_output.$FS ftl_taf_output.$FS |
2258 |
\$(FC) \$(FFLAGS) \$(FOPTIM) -c ad_taf_output.f |
\$(FC) \$(FFLAGS) \$(FOPTIM) -c ad_taf_output.$FS |
2259 |
\$(FC) \$(FFLAGS) \$(FOPTIM) -c ftl_taf_output.f |
\$(FC) \$(FFLAGS) \$(FOPTIM) -c ftl_taf_output.$FS |
2260 |
@$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -DALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > ftl_config.template |
@$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -DALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > ftl_config.template |
2261 |
cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h |
cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h |
2262 |
-rm -f ftl_config.template |
-rm -f ftl_config.template |