| 1 |
|
|
| 2 |
#! /usr/bin/env bash |
#! /usr/bin/env bash |
| 3 |
# |
# |
| 4 |
# $Header$ |
# $Header$ |
| 924 |
|
|
| 925 |
echo "=== Processing options files and arguments ===" |
echo "=== Processing options files and arguments ===" |
| 926 |
gm_local="genmake_local" |
gm_local="genmake_local" |
| 927 |
|
modsCount=0 |
| 928 |
for i in . $MODS ; do |
for i in . $MODS ; do |
| 929 |
if test -r $i/$gm_local ; then |
if test -r $i/$gm_local ; then |
| 930 |
. $i/$gm_local |
. $i/$gm_local |
| 931 |
break |
break |
| 932 |
fi |
fi |
| 933 |
|
let modsCount=modsCount+1 |
| 934 |
done |
done |
| 935 |
|
if test modsCount -gt 1 ; then |
| 936 |
|
echo "ERROR: some uses of MODS break with more than one directory specified" |
| 937 |
|
exit -1; |
| 938 |
|
fi |
| 939 |
printf " getting local config information: " |
printf " getting local config information: " |
| 940 |
if test -f $gm_local ; then |
if test -f $gm_local ; then |
| 941 |
echo "using $gm_local" |
echo "using $gm_local" |
| 1904 |
basename=${sf%%.F} |
basename=${sf%%.F} |
| 1905 |
isAD=`egrep ^$basename.f'[ ]*' adSrcFiles.tmp` |
isAD=`egrep ^$basename.f'[ ]*' adSrcFiles.tmp` |
| 1906 |
if test -z "$isAD" ; then |
if test -z "$isAD" ; then |
| 1907 |
echo " \\" >> nonADF77srclist.tmp |
toBeIgnored=`egrep ^$basename'[ ]*' ${MODS}/dontCompile` |
| 1908 |
printf " $sf" >> nonADF77srclist.tmp |
if test -z "$toBeIgnored" ; then |
| 1909 |
|
echo " \\" >> nonADF77srclist.tmp |
| 1910 |
|
printf " $sf" >> nonADF77srclist.tmp |
| 1911 |
|
fi |
| 1912 |
fi |
fi |
| 1913 |
;; |
;; |
| 1914 |
F90) |
F90) |
| 2290 |
OPENAD_SUPPORT_C_SRC_FILES = \ |
OPENAD_SUPPORT_C_SRC_FILES = \ |
| 2291 |
iaddr.c |
iaddr.c |
| 2292 |
|
|
| 2293 |
|
f95_test.f90: all_mods.xb.x2w.w2f.pp.f \$(NON_AD_F77_SRC_FILES:.F=_cb2m.ff90) ad_input_code.w2f.canon.xb.x2w.w2f.rs.pp.f |
| 2294 |
|
cat \$^ > \$@ |
| 2295 |
|
|
| 2296 |
|
f95_test.out: f95_test.f90 |
| 2297 |
|
f95_4.1 -w=unused -maxcontin=132 -c -fixed \$^ > \$@ 2>&1 |
| 2298 |
|
|
| 2299 |
AD_OBJ_FILES=\$(OPENAD_SUPPORT_F90_SRC_FILES:.f90=.o) \$(OPENAD_SUPPORT_C_SRC_FILES:.c=.o) all_mods.xb.x2w.w2f.pp.o ad_input_code.w2f.canon.xb.x2w.w2f.rs.pp.o \$(NON_AD_F77_SRC_FILES:.F=_cb2m.o) \$(C_SRC_FILES:.c=.o) \$(F90_SRC_FILES:.F90=.o) |
AD_OBJ_FILES=\$(OPENAD_SUPPORT_F90_SRC_FILES:.f90=.o) \$(OPENAD_SUPPORT_C_SRC_FILES:.c=.o) all_mods.xb.x2w.w2f.pp.o ad_input_code.w2f.canon.xb.x2w.w2f.rs.pp.o \$(NON_AD_F77_SRC_FILES:.F=_cb2m.o) \$(C_SRC_FILES:.c=.o) \$(F90_SRC_FILES:.F90=.o) |
| 2300 |
|
|
| 2301 |
\$(EXE_AD): \$(AD_OBJ_FILES) |
\$(EXE_AD): \$(AD_OBJ_FILES) |
| 2327 |
@./\$(EXE_AD) > \$@ |
@./\$(EXE_AD) > \$@ |
| 2328 |
|
|
| 2329 |
CB2M_AD_FILES=\$(AD_FILES:.f=_cb2m.ff90) |
CB2M_AD_FILES=\$(AD_FILES:.f=_cb2m.ff90) |
| 2330 |
ad_input_code.$FS: \$(CB2M_AD_FILES) |
ad_input_code.$FS: ${MODS}/maxMinDefs.f \$(CB2M_AD_FILES) |
| 2331 |
# @$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 |
cat \$^ > \$@ |
|
# cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h |
|
|
# -rm -f ad_config.template |
|
|
cat ../code_ad/maxMinDefs.f \$(CB2M_AD_FILES) > ad_input_code.$FS |
|
| 2332 |
|
|
| 2333 |
\$(CB2MFILES): |
\$(CB2MFILES): |
| 2334 |
\$(LN) \$(addprefix ../code_ad/, \$(CB2MFILES)) . |
\$(LN) \$(addprefix ${MODS}/, \$(CB2MFILES)) . |
| 2335 |
|
|
| 2336 |
# strip all comments and blanks to reduce |
# strip all comments and blanks to reduce |
| 2337 |
# the file size in order to reduce perl's memory requirements |
# the file size in order to reduce perl's memory requirements |
| 2338 |
ad_input_code_sf.f : ad_input_code.f |
ad_input_code_sf.f : ad_input_code.f |
| 2339 |
cat \$^ | sed -f ../code_ad/strip.sed | sed -f ../code_ad/stop2print.sed > \$@ |
cat \$^ | sed -f ${MODS}/strip.sed | sed -f ${MODS}/stop2print.sed > \$@ |
| 2340 |
|
|
| 2341 |
# mfef90 preprocessing |
# mfef90 preprocessing |
| 2342 |
# expand statement functions |
# expand statement functions |
| 2367 |
|
|
| 2368 |
# XAIF -> XAIF' |
# XAIF -> XAIF' |
| 2369 |
ad_input_code_sf.w2f.canon.xb.xaif : ad_input_code_sf.w2f.canon.xaif xaif.xsd xaif_base.xsd xaif_inlinable_intrinsics.xsd xaif_derivative_propagator.xsd xaif_output.xsd openad_adm |
ad_input_code_sf.w2f.canon.xb.xaif : ad_input_code_sf.w2f.canon.xaif xaif.xsd xaif_base.xsd xaif_inlinable_intrinsics.xsd xaif_derivative_propagator.xsd xaif_output.xsd openad_adm |
| 2370 |
./openad_adm -i \$< -c \${XAIFSCHEMAROOT}/schema/examples/inlinable_intrinsics.xaif -o \$@ -I |
./openad_adm -i \$< -c \${XAIFSCHEMAROOT}/schema/examples/inlinable_intrinsics.xaif -o \$@ -I -r |
| 2371 |
|
|
| 2372 |
# XAIF' -> WHIRL' |
# XAIF' -> WHIRL' |
| 2373 |
ad_input_code_sf.w2f.canon.xb.x2w.B : ad_input_code_sf.w2f.canon.xb.xaif xaif2whirl |
ad_input_code_sf.w2f.canon.xb.x2w.B : ad_input_code_sf.w2f.canon.xb.xaif xaif2whirl |
| 2374 |
./xaif2whirl --structured ad_input_code_sf.w2f.canon.B \$< |
./xaif2whirl --debug 1 --structured ad_input_code_sf.w2f.canon.B \$< |
| 2375 |
|
|
| 2376 |
# WHIRL' -> F' |
# WHIRL' -> F' |
| 2377 |
ad_input_code_sf.w2f.canon.xb.x2w.w2f.f: ad_input_code_sf.w2f.canon.xb.x2w.B whirl2f whirl2f_be |
ad_input_code_sf.w2f.canon.xb.x2w.w2f.f: ad_input_code_sf.w2f.canon.xb.x2w.B whirl2f whirl2f_be |
| 2379 |
|
|
| 2380 |
# undo slice hiding |
# undo slice hiding |
| 2381 |
# insert template directives |
# insert template directives |
| 2382 |
ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.f: ad_input_code_sf.w2f.canon.xb.x2w.w2f.f reslicer.py ../code_ad/insertTemplateDir.bash |
ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.f: ad_input_code_sf.w2f.canon.xb.x2w.w2f.f reslicer.py ${MODS}/insertTemplateDir.bash |
| 2383 |
python reslicer.py \$< > \$<.1 |
python reslicer.py \$< > \$<.1 |
| 2384 |
../code_ad/insertTemplateDir.bash \$<.1 \$@ |
${MODS}/insertTemplateDir.bash \$<.1 \$@ |
| 2385 |
rm \$<.1 |
rm \$<.1 |
| 2386 |
|
|
| 2387 |
# postprocess F' |
# postprocess F' |
| 2388 |
ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.pp.f: ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.f multi-pp.pl ../code_ad/ad_inline.f ../code_ad/ad_template.checkpoint.f ../code_ad/ad_template.split.f |
ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.pp.f: ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.f multi-pp.pl ${MODS}/ad_inline.f ${MODS}/ad_template.checkpoint.f ${MODS}/ad_template.plain.f ${MODS}/ad_template.split.f ${MODS}/ad_template.sa_cg2d.f |
| 2389 |
perl multi-pp.pl -inline=../code_ad/ad_inline.f \$< |
perl multi-pp.pl -inline=${MODS}/ad_inline.f \$< |
| 2390 |
cat \$@ | sed 's/RETURN//' > \$@.1 |
cat \$@ | sed 's/RETURN//' > \$@.1 |
| 2391 |
mv \$@.1 \$@ |
mv \$@.1 \$@ |
| 2392 |
|
|
| 2397 |
# remove the transformed globals module from the |
# remove the transformed globals module from the |
| 2398 |
# transformed ad_input_code file |
# transformed ad_input_code file |
| 2399 |
# and remove for now the duplicate variables |
# and remove for now the duplicate variables |
| 2400 |
ad_input_code.w2f.canon.xb.x2w.w2f.rs.pp.f: ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.pp.f |
# and fix 2 data statements |
| 2401 |
cat \$< | sed '/MODULE /,/END MODULE/d' | sed '/^ INTEGER(w2f__i4) DOLOOP_UB/d' > \$@ |
ad_input_code.w2f.canon.xb.x2w.w2f.rs.pp.f: ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.pp.f ${MODS}/fixData.sed |
| 2402 |
|
cat \$< | sed '/MODULE /,/END MODULE/d' | sed '/^ INTEGER(w2f__i4) DOLOOP_UB/d' | sed -f ${MODS}/fixData.sed > \$@ |
| 2403 |
|
|
| 2404 |
# setup some links |
# setup some links |
| 2405 |
%.xsd: |
%.xsd: |
| 2410 |
|
|
| 2411 |
# link the support files: |
# link the support files: |
| 2412 |
\$(OPENAD_SUPPORT_F90_SRC_FILES) \$(OPENAD_SUPPORT_C_SRC_FILES) : |
\$(OPENAD_SUPPORT_F90_SRC_FILES) \$(OPENAD_SUPPORT_C_SRC_FILES) : |
| 2413 |
\$(LN) ../code_ad/\$@ . |
\$(LN) ${MODS}/\$@ . |
| 2414 |
|
|
| 2415 |
whirl2xaif xaif2whirl: |
whirl2xaif xaif2whirl: |
| 2416 |
\$(LN) \${OPENADROOT}/OpenADFortTk/OpenADFortTk-i686-Linux/bin/\$@ . |
\$(LN) \${OPENADROOT}/OpenADFortTk/OpenADFortTk-i686-Linux/bin/\$@ . |