/[MITgcm]/MITgcm/tools/genmake2
ViewVC logotype

Diff of /MITgcm/tools/genmake2

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.144 by edhill, Sat Mar 11 02:53:48 2006 UTC revision 1.149 by edhill, Thu May 11 20:28:50 2006 UTC
# Line 13  Line 13 
13  test_for_package_in_cpp_options() {  test_for_package_in_cpp_options() {
14      cpp_options=$1      cpp_options=$1
15      pkg=$2      pkg=$2
16      test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_$pkg" || exit 99      test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_$pkg[ ]"
17      test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_$pkg" || exit 99      test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_$pkg[ ]"
18      test_for_string_in_file $cpp_options "^[ ]*#define.*DISABLE_$pkg" || exit 99      test_for_string_in_file $cpp_options "^[ ]*#define.*DISABLE_$pkg[ ]"
19      test_for_string_in_file $cpp_options "^[ ]*#undef.*DISABLE_$pkg" || exit 99      test_for_string_in_file $cpp_options "^[ ]*#undef.*DISABLE_$pkg[ ]"
20        test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_$pkg$"
21        test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_$pkg$"
22        test_for_string_in_file $cpp_options "^[ ]*#define.*DISABLE_$pkg$"
23        test_for_string_in_file $cpp_options "^[ ]*#undef.*DISABLE_$pkg$"
24  }  }
25    
26  # Search for particular CPP #cmds associated with MPI  # Search for particular CPP #cmds associated with MPI
27  # usage: test_for_mpi_in_cpp_eeoptions CPP_file  # usage: test_for_mpi_in_cpp_eeoptions CPP_file
28  test_for_mpi_in_cpp_eeoptions() {  test_for_mpi_in_cpp_eeoptions() {
29      cpp_options=$1      cpp_options=$1
30      test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_USE_MPI" || exit 99      test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_USE_MPI[ ]"
31      test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_USE_MPI" || exit 99      test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_USE_MPI[ ]"
32      test_for_string_in_file $cpp_options "^[ ]*#define.*ALWAYS_USE_MPI" || exit 99      test_for_string_in_file $cpp_options "^[ ]*#define.*ALWAYS_USE_MPI[ ]"
33      test_for_string_in_file $cpp_options "^[ ]*#undef.*ALWAYS_USE_MPI" || exit 99      test_for_string_in_file $cpp_options "^[ ]*#undef.*ALWAYS_USE_MPI[ ]"
34        test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_USE_MPI$"
35        test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_USE_MPI$"
36        test_for_string_in_file $cpp_options "^[ ]*#define.*ALWAYS_USE_MPI$"
37        test_for_string_in_file $cpp_options "^[ ]*#undef.*ALWAYS_USE_MPI$"
38  }  }
39    
40  # Search for particular string in a file. Return 1 if detected, 0 if not  # Search for particular string in a file. Return 1 if detected, 0 if not
# Line 39  test_for_string_in_file() { Line 47  test_for_string_in_file() {
47      if test "x${RETVAL}" = x0 ; then      if test "x${RETVAL}" = x0 ; then
48          printf "Error: In $file there is an illegal line: "          printf "Error: In $file there is an illegal line: "
49          grep -i "$strng" $file          grep -i "$strng" $file
50          return 1          exit 99
51      fi      fi
52      return 0      return 0
53  }  }
# Line 579  Usage: "$0" [OPTIONS] Line 587  Usage: "$0" [OPTIONS]
587      -ts | --ts      -ts | --ts
588            Produce timing information per timestep            Produce timing information per timestep
589      -papis | --papis      -papis | --papis
590            Produce summary MFlop/s with PAPI per timestep            Produce summary MFlop/s (and IPC) with PAPI per timestep
591        -pcls | --pcls
592              Produce summary MFlop/s etc. with PCL per timestep
593      -foolad | --foolad      -foolad | --foolad
594            Fool the AD code generator            Fool the AD code generator
595      -papi | --papi      -papi | --papi
596            Performance analysis with PAPI            Performance analysis with PAPI
597        -pcl | --pcl
598              Performance analysis with PCL
599      -hpmt | --hpmt      -hpmt | --hpmt
600            Performance analysis with the HPM Toolkit            Performance analysis with the HPM Toolkit
601    
# Line 922  EOF Line 934  EOF
934      cat genmake_tnc.F >> genmake_tnc.log      cat genmake_tnc.F >> genmake_tnc.log
935      echo "===  genmake_tnc.F  ===" >> genmake_tnc.log      echo "===  genmake_tnc.F  ===" >> genmake_tnc.log
936      RET_CPP=f      RET_CPP=f
937      COMM="$CPP $DEFINES $INCLUDES genmake_tnc.F"      COMM="cat genmake_tnc.F | $CPP $DEFINES $INCLUDES"
938      echo "$COMM" >> genmake_tnc.log      echo "$COMM" >> genmake_tnc.log
939      $COMM > genmake_tnc.$FS 2>/dev/null  &&  RET_CPP=t      $COMM > genmake_tnc.$FS 2>/dev/null  &&  RET_CPP=t
940      if test "x$RET_CPP" = xf ; then      if test "x$RET_CPP" = xf ; then
# Line 950  EOF Line 962  EOF
962      else      else
963          # try again with "-lnetcdf" added to the libs          # try again with "-lnetcdf" added to the libs
964          echo "try again with added '-lnetcdf'" > genmake_tnc.log          echo "try again with added '-lnetcdf'" > genmake_tnc.log
965          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
966          echo " &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log          echo " &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log
967          echo " &&  $LINK -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf" >> genmake_tnc.log          echo " &&  $LINK -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf" >> genmake_tnc.log
968          $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  \
969              &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \              &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \
970              &&  $LINK -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf >> genmake_tnc.log 2>&1              &&  $LINK -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf >> genmake_tnc.log 2>&1
971          RET_COMPILE=$?          RET_COMPILE=$?
# Line 1008  MPI= Line 1020  MPI=
1020  MPIPATH=  MPIPATH=
1021  TS=  TS=
1022  PAPIS=  PAPIS=
1023    PCLS=
1024  FOOLAD=  FOOLAD=
1025  PAPI=  PAPI=
1026    PCL=
1027  HPMT=  HPMT=
1028  GSL=  GSL=
1029  HAVE_TEST_L=  HAVE_TEST_L=
# Line 1070  TAMC_EXTRA= Line 1084  TAMC_EXTRA=
1084    
1085  #  The following state can be set directly by command-line switches  #  The following state can be set directly by command-line switches
1086  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE"  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE"
1087  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"
1088    
1089  #  The following state is not directly set by command-line switches  #  The following state is not directly set by command-line switches
1090  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 "
# Line 1254  for ac_option in "$@" ; do Line 1268  for ac_option in "$@" ; do
1268              TS=true ;;              TS=true ;;
1269          -papis | --papis)          -papis | --papis)
1270              PAPIS=true ;;              PAPIS=true ;;
1271            -pcls | --pcls)
1272                PCLS=true ;;
1273          -foolad | --foolad)          -foolad | --foolad)
1274              FOOLAD=true ;;              FOOLAD=true ;;
1275          -papi | --papi)          -papi | --papi)
1276              PAPI=true ;;              PAPI=true ;;
1277            -pcl | --pcl)
1278                PCL=true ;;
1279          -hpmt | --hpmt)          -hpmt | --hpmt)
1280              HPMT=true ;;              HPMT=true ;;
1281    
# Line 1526  if test ! "x$PAPIS" = x ; then Line 1544  if test ! "x$PAPIS" = x ; then
1544        INCLUDES="$INCLUDES $PAPIINC"        INCLUDES="$INCLUDES $PAPIINC"
1545        LIBS="$LIBS $PAPILIB"        LIBS="$LIBS $PAPILIB"
1546  fi  fi
1547    if test ! "x$PCLS" = x ; then
1548          echo "  Turning on PCL counter summary per timestep"
1549          echo "  Please make sure PCLINC, PCLLIB are defined"
1550          if test ! "x$FOOLAD" = x ; then
1551                DEFINES="$DEFINES -DUSE_PCL_FLOPS_SFP"
1552          else
1553                DEFINES="$DEFINES -DUSE_PCL_FLOPS"
1554          fi
1555          INCLUDES="$INCLUDES $PCLINC"
1556          LIBS="$LIBS $PCLLIB"
1557    fi
1558  if test ! "x$PAPI" = x ; then  if test ! "x$PAPI" = x ; then
1559        if test ! "x$PAPIS" = x ; then        if test ! "x$PAPIS" = x ; then
1560            echo "  PAPI performance analysis and flop summary per timestep cannot co-exist!"            echo "  PAPI performance analysis and flop summary per timestep cannot co-exist!"
# Line 1538  if test ! "x$PAPI" = x ; then Line 1567  if test ! "x$PAPI" = x ; then
1567            LIBS="$LIBS $PAPILIB"            LIBS="$LIBS $PAPILIB"
1568        fi        fi
1569  fi  fi
1570    if test ! "x$PCL" = x ; then
1571          if test ! "x$PCLS" = x ; then
1572              echo "  PCL performance analysis and flop summary per timestep cannot co-exist!"
1573              echo "  Sticking with PCL flop summary per timestep!"
1574          else
1575              echo "  Turning on performance analysis with PCL"
1576              echo "  Please make sure PCLINC, PCLLIB are defined"
1577              DEFINES="$DEFINES -DUSE_PCL"
1578              INCLUDES="$INCLUDES $PCLINC"
1579              LIBS="$LIBS $PCLLIB"
1580          fi
1581    fi
1582  if test ! "x$HPMT" = x ; then  if test ! "x$HPMT" = x ; then
1583        if test ! "x$PAPI" = x ; then        if test ! "x$PAPI" = x ; then
1584            echo "  PAPI and the HPM Toolkit cannot co-exist!"            echo "  PAPI and the HPM Toolkit cannot co-exist!"
1585            echo "  Sticking with PAPI!"            echo "  Sticking with PAPI!"
1586          else if test ! "x$PCL" = x ; then
1587              echo "  PCL and the HPM Toolkit cannot co-exist!"
1588              echo "  Sticking with PCL!"
1589        else        else
1590            echo "  Turning on performance analysis with the HPM Toolkit"            echo "  Turning on performance analysis with the HPM Toolkit"
1591            echo "  Please make sure HPMTINC, HPMTLIB are defined"            echo "  Please make sure HPMTINC, HPMTLIB are defined"
# Line 1549  if test ! "x$HPMT" = x ; then Line 1593  if test ! "x$HPMT" = x ; then
1593            INCLUDES="$INCLUDES $HPMTINC"            INCLUDES="$INCLUDES $HPMTINC"
1594            LIBS="$LIBS $HPMTLIB"            LIBS="$LIBS $HPMTLIB"
1595        fi        fi
1596          fi
1597  fi  fi
1598  if test ! "x$GSL" = x ; then  if test ! "x$GSL" = x ; then
1599        echo "  Turning on use of GSL to control floating point calculations"        echo "  Turning on use of GSL to control floating point calculations"
# Line 2416  Clean: Line 2461  Clean:
2461          @make clean          @make clean
2462          @make cleanlinks          @make cleanlinks
2463          -rm -f \$(SPECIAL_FILES)          -rm -f \$(SPECIAL_FILES)
2464          -rm -f genmake* make.log run.log *.bak          -rm -f genmake_state genmake_*optfile genmake_warnings make.log run.log *.bak
2465  CLEAN:  CLEAN:
2466          @make Clean          @make Clean
2467          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;

Legend:
Removed from v.1.144  
changed lines
  Added in v.1.149

  ViewVC Help
Powered by ViewVC 1.1.22