/[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.150 by edhill, Mon May 22 22:11:11 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 755  EOF Line 767  EOF
767    
768    
769  check_HAVE_SIGREG()  {  check_HAVE_SIGREG()  {
770        if test ! "x$HAVE_SIGREG" = x ; then
771            return
772        fi
773      get_fortran_c_namemangling      get_fortran_c_namemangling
774      cat <<EOF > genmake_tc_1.c      cat <<EOF > genmake_tc_1.c
775  $FC_NAMEMANGLE  $FC_NAMEMANGLE
# Line 922  EOF Line 937  EOF
937      cat genmake_tnc.F >> genmake_tnc.log      cat genmake_tnc.F >> genmake_tnc.log
938      echo "===  genmake_tnc.F  ===" >> genmake_tnc.log      echo "===  genmake_tnc.F  ===" >> genmake_tnc.log
939      RET_CPP=f      RET_CPP=f
940      COMM="$CPP $DEFINES $INCLUDES genmake_tnc.F"      COMM="cat genmake_tnc.F | $CPP $DEFINES $INCLUDES"
941      echo "$COMM" >> genmake_tnc.log      echo "$COMM" >> genmake_tnc.log
942      $COMM > genmake_tnc.$FS 2>/dev/null  &&  RET_CPP=t      $COMM > genmake_tnc.$FS 2>/dev/null  &&  RET_CPP=t
943      if test "x$RET_CPP" = xf ; then      if test "x$RET_CPP" = xf ; then
# Line 950  EOF Line 965  EOF
965      else      else
966          # try again with "-lnetcdf" added to the libs          # try again with "-lnetcdf" added to the libs
967          echo "try again with added '-lnetcdf'" > genmake_tnc.log          echo "try again with added '-lnetcdf'" > genmake_tnc.log
968          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
969          echo " &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log          echo " &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log
970          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
971          $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  \
972              &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \              &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \
973              &&  $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
974          RET_COMPILE=$?          RET_COMPILE=$?
# Line 1008  MPI= Line 1023  MPI=
1023  MPIPATH=  MPIPATH=
1024  TS=  TS=
1025  PAPIS=  PAPIS=
1026    PCLS=
1027  FOOLAD=  FOOLAD=
1028  PAPI=  PAPI=
1029    PCL=
1030  HPMT=  HPMT=
1031  GSL=  GSL=
1032  HAVE_TEST_L=  HAVE_TEST_L=
# Line 1070  TAMC_EXTRA= Line 1087  TAMC_EXTRA=
1087    
1088  #  The following state can be set directly by command-line switches  #  The following state can be set directly by command-line switches
1089  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE"  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE"
1090  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"
1091    
1092  #  The following state is not directly set by command-line switches  #  The following state is not directly set by command-line switches
1093  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 1271  for ac_option in "$@" ; do
1271              TS=true ;;              TS=true ;;
1272          -papis | --papis)          -papis | --papis)
1273              PAPIS=true ;;              PAPIS=true ;;
1274            -pcls | --pcls)
1275                PCLS=true ;;
1276          -foolad | --foolad)          -foolad | --foolad)
1277              FOOLAD=true ;;              FOOLAD=true ;;
1278          -papi | --papi)          -papi | --papi)
1279              PAPI=true ;;              PAPI=true ;;
1280            -pcl | --pcl)
1281                PCL=true ;;
1282          -hpmt | --hpmt)          -hpmt | --hpmt)
1283              HPMT=true ;;              HPMT=true ;;
1284    
# Line 1526  if test ! "x$PAPIS" = x ; then Line 1547  if test ! "x$PAPIS" = x ; then
1547        INCLUDES="$INCLUDES $PAPIINC"        INCLUDES="$INCLUDES $PAPIINC"
1548        LIBS="$LIBS $PAPILIB"        LIBS="$LIBS $PAPILIB"
1549  fi  fi
1550    if test ! "x$PCLS" = x ; then
1551          echo "  Turning on PCL counter summary per timestep"
1552          echo "  Please make sure PCLINC, PCLLIB are defined"
1553          if test ! "x$FOOLAD" = x ; then
1554                DEFINES="$DEFINES -DUSE_PCL_FLOPS_SFP"
1555          else
1556                DEFINES="$DEFINES -DUSE_PCL_FLOPS"
1557          fi
1558          INCLUDES="$INCLUDES $PCLINC"
1559          LIBS="$LIBS $PCLLIB"
1560    fi
1561  if test ! "x$PAPI" = x ; then  if test ! "x$PAPI" = x ; then
1562        if test ! "x$PAPIS" = x ; then        if test ! "x$PAPIS" = x ; then
1563            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 1570  if test ! "x$PAPI" = x ; then
1570            LIBS="$LIBS $PAPILIB"            LIBS="$LIBS $PAPILIB"
1571        fi        fi
1572  fi  fi
1573    if test ! "x$PCL" = x ; then
1574          if test ! "x$PCLS" = x ; then
1575              echo "  PCL performance analysis and flop summary per timestep cannot co-exist!"
1576              echo "  Sticking with PCL flop summary per timestep!"
1577          else
1578              echo "  Turning on performance analysis with PCL"
1579              echo "  Please make sure PCLINC, PCLLIB are defined"
1580              DEFINES="$DEFINES -DUSE_PCL"
1581              INCLUDES="$INCLUDES $PCLINC"
1582              LIBS="$LIBS $PCLLIB"
1583          fi
1584    fi
1585  if test ! "x$HPMT" = x ; then  if test ! "x$HPMT" = x ; then
1586        if test ! "x$PAPI" = x ; then        if test ! "x$PAPI" = x ; then
1587            echo "  PAPI and the HPM Toolkit cannot co-exist!"            echo "  PAPI and the HPM Toolkit cannot co-exist!"
1588            echo "  Sticking with PAPI!"            echo "  Sticking with PAPI!"
1589          else if test ! "x$PCL" = x ; then
1590              echo "  PCL and the HPM Toolkit cannot co-exist!"
1591              echo "  Sticking with PCL!"
1592        else        else
1593            echo "  Turning on performance analysis with the HPM Toolkit"            echo "  Turning on performance analysis with the HPM Toolkit"
1594            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 1596  if test ! "x$HPMT" = x ; then
1596            INCLUDES="$INCLUDES $HPMTINC"            INCLUDES="$INCLUDES $HPMTINC"
1597            LIBS="$LIBS $HPMTLIB"            LIBS="$LIBS $HPMTLIB"
1598        fi        fi
1599          fi
1600  fi  fi
1601  if test ! "x$GSL" = x ; then  if test ! "x$GSL" = x ; then
1602        echo "  Turning on use of GSL to control floating point calculations"        echo "  Turning on use of GSL to control floating point calculations"
# Line 1645  rm -f genmake_t* Line 1693  rm -f genmake_t*
1693    
1694  printf "  Can we register a signal handler using $FC...  "  printf "  Can we register a signal handler using $FC...  "
1695  check_HAVE_SIGREG  check_HAVE_SIGREG
1696  if test "x$HAVE_SIGREG" != x ; then  if test "x$HAVE_SIGREG" = xt ; then
1697      echo "yes"      echo "yes"
1698  else  else
1699      echo "no"      echo "no"
# Line 2416  Clean: Line 2464  Clean:
2464          @make clean          @make clean
2465          @make cleanlinks          @make cleanlinks
2466          -rm -f \$(SPECIAL_FILES)          -rm -f \$(SPECIAL_FILES)
2467          -rm -f genmake* make.log run.log *.bak          -rm -f genmake_state genmake_*optfile genmake_warnings make.log run.log *.bak
2468  CLEAN:  CLEAN:
2469          @make Clean          @make Clean
2470          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;

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

  ViewVC Help
Powered by ViewVC 1.1.22