3191 |
f95 -fixed -w=unused -maxcontin=132 -c f95_test_mods.f90 > \$@ 2>&1 |
f95 -fixed -w=unused -maxcontin=132 -c f95_test_mods.f90 > \$@ 2>&1 |
3192 |
f95 -fixed -w=unused -maxcontin=132 -c -fixed f95_test.f90 >> \$@ 2>&1 |
f95 -fixed -w=unused -maxcontin=132 -c -fixed f95_test.f90 >> \$@ 2>&1 |
3193 |
|
|
3194 |
# the file included below is created by the |
CB2M_AD_FILES=\$(AD_FILES:.f=_cb2m.f$FS90) |
|
# postProcessor and its inclusion sets the |
|
|
# variable POSTPROCESSEDFILES |
|
|
# used below. Because the file is made during |
|
|
# make it won't be read until the second (recursive) |
|
|
# invocation in the rule below |
|
|
-include postProcess.make |
|
3195 |
|
|
3196 |
AD_OBJ_FILES_S1=\$(OPENAD_SUPPORT_F90_SRC_FILES:.F90=.o) \$(OPENAD_SUPPORT_C_SRC_FILES:.c=.o) \$(POSTPROCESSEDFILES:.f$FS90=.o) |
AD_OBJ_FILES_S1=\$(OPENAD_SUPPORT_F90_SRC_FILES:.F90=.o) \$(OPENAD_SUPPORT_C_SRC_FILES:.c=.o) OAD_intrinsics_oad.o \$(CB2M_AD_FILES:.f$FS90=_oad.o) |
3197 |
|
|
3198 |
AD_OBJ_FILES_S2=\$(AD_OBJ_FILES_S1) \$(NON_AD_F77_SRC_FILES:.F=_cb2m.o) \$(C_SRC_FILES:.c=.o) \$(F90_SRC_FILES:.F90=.o) |
AD_OBJ_FILES_S2=\$(AD_OBJ_FILES_S1) \$(NON_AD_F77_SRC_FILES:.F=_cb2m.o) \$(C_SRC_FILES:.c=.o) \$(F90_SRC_FILES:.F90=.o) |
3199 |
|
|
3200 |
postProcess.comp: \$(ALL_LINKED_FILES) \$(addsuffix _mod.h, \$(CB2M_F90_SRC_NAMES)) postProcess.tag \$(AD_OBJ_FILES_S1) |
\$(EXE_AD): \$(ALL_LINKED_FILES) \$(addsuffix _mod.h, \$(CB2M_F90_SRC_NAMES)) postProcess.tag \$(AD_OBJ_FILES_S2) |
|
ifeq (\$(MAKELEVEL),0) |
|
|
\$(MAKE) adAll |
|
|
else |
|
|
touch \$@ |
|
|
endif |
|
|
|
|
|
\$(EXE_AD): \$(ALL_LINKED_FILES) \$(addsuffix _mod.h, \$(CB2M_F90_SRC_NAMES)) postProcess.comp \$(AD_OBJ_FILES_S2) |
|
|
ifeq (\$(MAKELEVEL),1) |
|
3201 |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(AD_OBJ_FILES_S2) \$(LIBS) |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(AD_OBJ_FILES_S2) \$(LIBS) |
|
else |
|
|
touch \$@ |
|
|
endif |
|
3202 |
|
|
3203 |
# makefile debug rule |
# create sources files modules from header files containing common blocks |
|
openad: ad_input_code.w2f.pre.xb.x2w.w2f.td.pp.f$FS90 |
|
|
.PHONY: openad |
|
|
|
|
|
# create the module files |
|
3204 |
%_mod.FF90 : %.h ../OAD_support/cb2mGetModules.csh ../OAD_support/cb2mGetModules.awk |
%_mod.FF90 : %.h ../OAD_support/cb2mGetModules.csh ../OAD_support/cb2mGetModules.awk |
3205 |
../OAD_support/cb2mGetModules.csh $< ../OAD_support/cb2mGetModules.awk |
../OAD_support/cb2mGetModules.csh $< ../OAD_support/cb2mGetModules.awk |
3206 |
|
|
3207 |
# create the header files |
# create new header files with USE statements for the new modules made above |
3208 |
%_mod.h : %.h ../OAD_support/cb2mGetHeaders.csh ../OAD_support/cb2mGetHeaders.awk |
%_mod.h : %.h ../OAD_support/cb2mGetHeaders.csh ../OAD_support/cb2mGetHeaders.awk |
3209 |
../OAD_support/cb2mGetHeaders.csh $< ../OAD_support/cb2mGetHeaders.awk \$(CB2M_F90_SRC_NAMES) |
../OAD_support/cb2mGetHeaders.csh $< ../OAD_support/cb2mGetHeaders.awk \$(CB2M_F90_SRC_NAMES) |
3210 |
|
|
3211 |
# change everybody else to use the new module files: |
# change the include directives of everybody to refer to the new header files with the USE statements |
3212 |
%_cb2m.FF90 : %.F ../OAD_support/cb2mUseModules.bash |
%_cb2m.FF90 : %.F ../OAD_support/cb2mUseModules.bash |
3213 |
../OAD_support/cb2mUseModules.bash $< ${MPI} |
../OAD_support/cb2mUseModules.bash $< ${MPI} |
3214 |
|
|
3223 |
@printf 'running ... ' |
@printf 'running ... ' |
3224 |
@./\$(EXE_AD) > \$@ |
@./\$(EXE_AD) > \$@ |
3225 |
|
|
|
CB2M_AD_FILES=\$(AD_FILES:.f=_cb2m.f$FS90) |
|
3226 |
ad_input_code.f$FS90: \$(CB2M_AD_FILES) |
ad_input_code.f$FS90: \$(CB2M_AD_FILES) |
3227 |
cat \$^ > \$@ |
cat \$^ > \$@ |
3228 |
|
|
|
# strip all comments and blanks to reduce |
|
|
# the file size in order to reduce perl's memory requirements |
|
|
ad_input_code_sf.f$FS90 : ad_input_code.f$FS90 |
|
|
cat \$^ | sed -f ../OAD_support/strip.sed | sed -f ../OAD_support/stop2print.sed > \$@ |
|
|
|
|
|
# mfef90 preprocessing |
|
|
# expand statement functions |
|
|
# expose mfef90 specific substring handling |
|
|
# add the w2f__types module |
|
|
ad_input_code_sf.w2f.f$FS90: ad_input_code_sf.f$FS90 mfef90 whirl2f whirl2f_be w2f__types.f90 |
|
|
./mfef90 -r8 -z -F -N132 \$< |
|
|
mv \$<.B \$(basename \$<).B |
|
|
./whirl2f -openad \$(basename \$<).B |
|
|
cat w2f__types.f90 \$(basename \$<).w2f.f > \$@ |
|
|
|
|
3229 |
# canonicalizer |
# canonicalizer |
3230 |
ad_input_code_sf.w2f.pre.f$FS90: ad_input_code_sf.w2f.f$FS90 preProcess.py |
ad_input_code_sf.pre.f90 : \$(CB2M_AD_FILES) |
3231 |
./preProcess.py --timing --r8 -H -S \$< -o \$@ |
\${OPENADFORTTK_BASE}/tools/SourceProcessing/preProcess.py --timing --r8 -H -S -o \$@ \$^ |
3232 |
|
|
3233 |
|
# replace stop statements (to avoid the implied unstructured control flow) with print statements |
3234 |
|
ad_input_code_sf.pre.s2p.f90 : ad_input_code_sf.pre.f90 |
3235 |
|
cat \$< | sed -f ../OAD_support/stop2print.sed > ad_input_code_sf.pre.s2p.f90 |
3236 |
|
|
3237 |
# F -> WHIRL |
# F -> WHIRL |
3238 |
# note that the canonicalized version cuts off at col 72 |
ad_input_code_sf.pre.s2p.B: ad_input_code_sf.pre.s2p.f90 |
3239 |
# doing this also for string constants which is ok as long |
\${OPEN64ROOT}/crayf90/sgi/mfef90 -r8 -z -F ad_input_code_sf.pre.s2p.f90 |
|
# as we are in fixed mode and cut of exactly there. |
|
|
# Otherwise mfef90 patches in spaces to fill up to 72 (or 132) |
|
|
# characters respectively. |
|
|
ad_input_code_sf.w2f.pre.B: ad_input_code_sf.w2f.pre.f$FS90 mfef90 |
|
|
./mfef90 -r8 -z -F \$< |
|
|
mv \$<.B \$@ |
|
3240 |
|
|
3241 |
# WHIRL -> XAIF |
# WHIRL -> XAIF |
3242 |
ad_input_code_sf.w2f.pre.xaif : ad_input_code_sf.w2f.pre.B whirl2xaif |
ad_input_code_sf.pre.s2p.xaif : ad_input_code_sf.pre.s2p.B |
3243 |
./whirl2xaif -s -n --debug 1 -o \$@ \$< |
\${OPENADFORTTK}/bin/whirl2xaif -s -n --debug 1 -o \$@ \$< |
3244 |
|
|
3245 |
# XAIF -> XAIF' |
# XAIF -> XAIF' |
3246 |
ad_input_code_sf.w2f.pre.xb.xaif : ad_input_code_sf.w2f.pre.xaif xaif.xsd xaif_base.xsd xaif_inlinable_intrinsics.xsd xaif_derivative_propagator.xsd xaif_output.xsd oadDriver |
ad_input_code_sf.pre.s2p.xb.xaif : ad_input_code_sf.pre.s2p.xaif xaif.xsd xaif_base.xsd xaif_inlinable_intrinsics.xsd xaif_derivative_propagator.xsd xaif_output.xsd |
3247 |
./oadDriver -f -t forward_step -i \$< -c \${XAIFSCHEMAROOT}/schema/examples/inlinable_intrinsics.xaif -o \$@ -I -r |
\${XAIFBOOSTERROOT}/xaifBooster/algorithms/BasicBlockPreaccumulationReverse/driver/oadDriver -f -t forward_step -i \$< -c \${XAIFSCHEMAROOT}/schema/examples/inlinable_intrinsics.xaif -o \$@ -I -r |
3248 |
|
|
3249 |
# XAIF' -> WHIRL' |
# XAIF' -> WHIRL' |
3250 |
ad_input_code_sf.w2f.pre.xb.x2w.B : ad_input_code_sf.w2f.pre.xb.xaif xaif2whirl |
ad_input_code_sf.pre.s2p.xb.x2w.B : ad_input_code_sf.pre.s2p.xb.xaif |
3251 |
./xaif2whirl --debug 1 ad_input_code_sf.w2f.pre.B \$< |
\${OPENADFORTTK}/bin/xaif2whirl --debug 1 ad_input_code_sf.pre.s2p.B \$< |
3252 |
|
|
3253 |
# WHIRL' -> F' |
# WHIRL' -> F' |
3254 |
ad_input_code_sf.w2f.pre.xb.x2w.w2f.f$FS90: ad_input_code_sf.w2f.pre.xb.x2w.B whirl2f whirl2f_be |
ad_input_code_sf.pre.s2p.xb.x2w.w2f.f$FS90: ad_input_code_sf.pre.s2p.xb.x2w.B |
3255 |
./whirl2f -FLIST:ftn_file=\$@ -openad \$< |
\${OPEN64ROOT}/whirl2f/whirl2f -FLIST:ftn_file=\$@ -openad \$< |
3256 |
|
|
3257 |
# insert template directives |
# insert template directives |
3258 |
ad_input_code_sf.w2f.pre.xb.x2w.w2f.td.f$FS90: ad_input_code_sf.w2f.pre.xb.x2w.w2f.f$FS90 ../OAD_support/insertTemplateDir.bash |
ad_input_code_sf.pre.s2p.xb.x2w.w2f.td.f$FS90: ad_input_code_sf.pre.s2p.xb.x2w.w2f.f$FS90 ../OAD_support/insertTemplateDir.bash |
3259 |
../OAD_support/insertTemplateDir.bash \$< \$@ |
../OAD_support/insertTemplateDir.bash \$< \$@ |
3260 |
|
|
3261 |
PPEXTRAS=\$(wildcard ../OAD_support/ad_template.*.F) ../OAD_support/ad_inline.F |
PPEXTRAS=\$(wildcard ../OAD_support/ad_template.*.F) ../OAD_support/ad_inline.F |
3262 |
# postprocess F' |
# postprocess F' |
3263 |
postProcess.tag: ad_input_code_sf.w2f.pre.xb.x2w.w2f.td.f$FS90 postProcess.py \$(PPEXTRAS:.F=.f) |
postProcess.tag: ad_input_code_sf.pre.s2p.xb.x2w.w2f.td.f$FS90 \$(PPEXTRAS:.F=.f) | w2f__types.f90 |
3264 |
# the target is a placeholder to signal execution of the rule |
\${OPENADFORTTK_BASE}/tools/SourceProcessing/postProcess.py --progress --timing --infoUnitFile w2f__types.f90 --outputFormat=fixed --separateOutput --pathSuffix "" --filenameSuffix "_oad" -m r -i ../OAD_support/ad_inline.f \$< |
3265 |
|
# the target is a placeholder to trigger a single execution of the rule |
3266 |
touch \$@ |
touch \$@ |
3267 |
# this step also creates the file postProcess.make but we cannot |
# put this so make knows about the postprocessing output |
3268 |
# name it as the target or else make will try to remake it for |
OAD_intrinsics_oad.f \$(CB2M_AD_FILES:.f$FS90=_oad.f): postProcess.tag |
|
# the include directive above for any rule, e.g. make clean |
|
|
./postProcess.py --progress --timing --infoUnitFile w2f__types.f90 --outputFormat=fixed -m r -i ../OAD_support/ad_inline.f --width 4 \$< |
|
3269 |
|
|
3270 |
# setup some links |
# link the XAIF schema files |
3271 |
%.xsd: |
%.xsd: |
3272 |
\$(LN) \${XAIFSCHEMAROOT}/schema/\$@ . |
\$(LN) \${XAIFSCHEMAROOT}/schema/\$@ . |
3273 |
|
|
|
mfef90: |
|
|
\$(LN) \${OPEN64ROOT}/crayf90/sgi/mfef90 . |
|
|
|
|
3274 |
# link the support files: |
# link the support files: |
3275 |
\$(OPENAD_SUPPORT_F90_SRC_FILES) \$(OPENAD_SUPPORT_C_SRC_FILES): |
\$(OPENAD_SUPPORT_F90_SRC_FILES) \$(OPENAD_SUPPORT_C_SRC_FILES): |
3276 |
\$(LN) ../OAD_support/\$@ . |
\$(LN) ../OAD_support/\$@ . |
3277 |
|
|
3278 |
whirl2xaif xaif2whirl: |
AD_CLEAN += *_mod.h *_mod.F90 *.FF90 *.mod-whirl temp.sed oad_cp.* postProcess.tag \$(PPEXTRAS:.F=.f) |
|
\$(LN) \${OPENADFORTTK}/bin/\$@ . |
|
|
|
|
|
preProcess.py postProcess.py: |
|
|
\$(LN) \${OPENADFORTTK_BASE}/tools/SourceProcessing/\$@ . |
|
|
|
|
|
whirl2f whirl2f_be: |
|
|
\$(LN) \${OPEN64ROOT}/whirl2f/\$@ . |
|
|
|
|
|
oadDriver: |
|
|
\$(LN) \${XAIFBOOSTERROOT}/xaifBooster/algorithms/BasicBlockPreaccumulationReverse/driver/oadDriver \$@ |
|
|
|
|
|
AD_CLEAN += *_mod.h *_mod.F90 *.FF90 *.mod-whirl temp.sed oad_cp.* postProcess.make postProcess.tag postProcess.comp \$(PPEXTRAS:.F=.f) |
|
3279 |
|
|
3280 |
# ============ end OpenAD specific section ============== |
# ============ end OpenAD specific section ============== |
3281 |
|
|