--- MITgcm/tools/genmake2 2006/04/07 02:53:55 1.146 +++ MITgcm/tools/genmake2 2006/06/07 22:33:00 1.151 @@ -1,6 +1,6 @@ #! /usr/bin/env bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.146 2006/04/07 02:53:55 edhill Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.151 2006/06/07 22:33:00 edhill Exp $ # # Makefile generator for MITgcm UV codes # created by cnh 03/98 @@ -587,11 +587,15 @@ -ts | --ts Produce timing information per timestep -papis | --papis - Produce summary MFlop/s with PAPI per timestep + Produce summary MFlop/s (and IPC) with PAPI per timestep + -pcls | --pcls + Produce summary MFlop/s etc. with PCL per timestep -foolad | --foolad Fool the AD code generator -papi | --papi Performance analysis with PAPI + -pcl | --pcl + Performance analysis with PCL -hpmt | --hpmt Performance analysis with the HPM Toolkit @@ -763,6 +767,9 @@ check_HAVE_SIGREG() { + if test ! "x$HAVE_SIGREG" = x ; then + return + fi get_fortran_c_namemangling cat < genmake_tc_1.c $FC_NAMEMANGLE @@ -820,6 +827,13 @@ check_HAVE_SETRLSTK() { + if test "x$HAVE_SETRLSTK" = xt ; then + DEFINES="$DEFINES -DHAVE_SETRLSTK" + return + fi + if test ! "x$HAVE_SETRLSTK" = x ; then + return + fi get_fortran_c_namemangling cat < genmake_tc_1.c $FC_NAMEMANGLE @@ -930,7 +944,7 @@ cat genmake_tnc.F >> genmake_tnc.log echo "=== genmake_tnc.F ===" >> genmake_tnc.log RET_CPP=f - COMM="$CPP $DEFINES $INCLUDES genmake_tnc.F" + COMM="cat genmake_tnc.F | $CPP $DEFINES $INCLUDES" echo "$COMM" >> genmake_tnc.log $COMM > genmake_tnc.$FS 2>/dev/null && RET_CPP=t if test "x$RET_CPP" = xf ; then @@ -958,10 +972,10 @@ else # try again with "-lnetcdf" added to the libs echo "try again with added '-lnetcdf'" > genmake_tnc.log - echo "$CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS \ " >> genmake_tnc.log + echo "cat genmake_tnc.F | $CPP $DEFINES $INCLUDES > genmake_tnc.$FS \ " >> genmake_tnc.log echo " && $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log echo " && $LINK -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf" >> genmake_tnc.log - $CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS 2>/dev/null \ + cat genmake_tnc.F | $CPP $DEFINES $INCLUDES > genmake_tnc.$FS 2>/dev/null \ && $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1 \ && $LINK -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf >> genmake_tnc.log 2>&1 RET_COMPILE=$? @@ -1016,8 +1030,10 @@ MPIPATH= TS= PAPIS= +PCLS= FOOLAD= PAPI= +PCL= HPMT= GSL= HAVE_TEST_L= @@ -1027,7 +1043,7 @@ HAVE_FDATE= FC_NAMEMANGLE= HAVE_CLOC= -HAVE_SETRLSTK= +# HAVE_SETRLSTK= HAVE_STAT= HAVE_NETCDF= HAVE_ETIME= @@ -1078,7 +1094,7 @@ # The following state can be set directly by command-line switches gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE" -gm_s2="FC CPP IEEE TS PAPIS PAPI HPMT GSL MPI JAM DUMPSTATE STANDARDDIRS" +gm_s2="FC CPP IEEE TS PAPIS PCLS PAPI PCL HPMT GSL MPI JAM DUMPSTATE STANDARDDIRS" # The following state is not directly set by command-line switches gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPEND PDEPEND PDEFAULT INCLUDES FFLAGS FOPTIM " @@ -1262,10 +1278,14 @@ TS=true ;; -papis | --papis) PAPIS=true ;; + -pcls | --pcls) + PCLS=true ;; -foolad | --foolad) FOOLAD=true ;; -papi | --papi) PAPI=true ;; + -pcl | --pcl) + PCL=true ;; -hpmt | --hpmt) HPMT=true ;; @@ -1534,6 +1554,17 @@ INCLUDES="$INCLUDES $PAPIINC" LIBS="$LIBS $PAPILIB" fi +if test ! "x$PCLS" = x ; then + echo " Turning on PCL counter summary per timestep" + echo " Please make sure PCLINC, PCLLIB are defined" + if test ! "x$FOOLAD" = x ; then + DEFINES="$DEFINES -DUSE_PCL_FLOPS_SFP" + else + DEFINES="$DEFINES -DUSE_PCL_FLOPS" + fi + INCLUDES="$INCLUDES $PCLINC" + LIBS="$LIBS $PCLLIB" +fi if test ! "x$PAPI" = x ; then if test ! "x$PAPIS" = x ; then echo " PAPI performance analysis and flop summary per timestep cannot co-exist!" @@ -1546,10 +1577,25 @@ LIBS="$LIBS $PAPILIB" fi fi +if test ! "x$PCL" = x ; then + if test ! "x$PCLS" = x ; then + echo " PCL performance analysis and flop summary per timestep cannot co-exist!" + echo " Sticking with PCL flop summary per timestep!" + else + echo " Turning on performance analysis with PCL" + echo " Please make sure PCLINC, PCLLIB are defined" + DEFINES="$DEFINES -DUSE_PCL" + INCLUDES="$INCLUDES $PCLINC" + LIBS="$LIBS $PCLLIB" + fi +fi if test ! "x$HPMT" = x ; then if test ! "x$PAPI" = x ; then echo " PAPI and the HPM Toolkit cannot co-exist!" echo " Sticking with PAPI!" + else if test ! "x$PCL" = x ; then + echo " PCL and the HPM Toolkit cannot co-exist!" + echo " Sticking with PCL!" else echo " Turning on performance analysis with the HPM Toolkit" echo " Please make sure HPMTINC, HPMTLIB are defined" @@ -1557,6 +1603,7 @@ INCLUDES="$INCLUDES $HPMTINC" LIBS="$LIBS $HPMTLIB" fi + fi fi if test ! "x$GSL" = x ; then echo " Turning on use of GSL to control floating point calculations" @@ -1644,7 +1691,7 @@ printf " Can we unlimit the stack size using $FC... " check_HAVE_SETRLSTK -if test "x$HAVE_SETRLSTK" != x ; then +if test "x$HAVE_SETRLSTK" = xt ; then echo "yes" else echo "no" @@ -1653,7 +1700,7 @@ printf " Can we register a signal handler using $FC... " check_HAVE_SIGREG -if test "x$HAVE_SIGREG" != x ; then +if test "x$HAVE_SIGREG" = xt ; then echo "yes" else echo "no" @@ -2518,10 +2565,10 @@ ad_vars="$ad_vars SVD_TAMC_FLAGS SVD_TAF_FLAGS" for i in $ad_vars ; do name=$i - t1="t2=\$"`echo $i` + t1="t2=\$"`echo "$i"` eval $t1 printf "%-20s = " $name >> $MAKEFILE - echo $t2 >> $MAKEFILE + echo "$t2" | sed -e 's| \+| |g' >> $MAKEFILE done echo " Add the source list for AD code generation"