--- MITgcm/tools/genmake2 2005/04/28 18:01:19 1.123 +++ MITgcm/tools/genmake2 2005/09/11 18:52:26 1.130 @@ -1,6 +1,6 @@ #! /usr/bin/env bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.123 2005/04/28 18:01:19 edhill Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.130 2005/09/11 18:52:26 edhill Exp $ # # Makefile generator for MITgcm UV codes # created by cnh 03/98 @@ -527,6 +527,9 @@ *only* works if it is supported by the OPTFILE that is being used. + -ts | --ts + Produce timing information per timestep + -mpi | --mpi Include MPI header files and link to MPI libraries -mpi=PATH | --mpi=PATH @@ -668,11 +671,11 @@ RET_C=$? cat < genmake_tc_2.$FS program hello - Real*8 wtime + REAL*8 wtime external cloc call cloc(wtime) print *," HELLO WORLD", wtime - end program hello + end EOF $FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_warnings 2>&1 RET_F=$? @@ -686,6 +689,42 @@ } +check_HAVE_SETRLSTK() { + get_fortran_c_namemangling + cat < genmake_tc_1.c +$FC_NAMEMANGLE +#include +#include +#include +void FC_NAMEMANGLE(setrlstk) () +{ + struct rlimit rls; + rls.rlim_cur = RLIM_INFINITY; + rls.rlim_max = RLIM_INFINITY; + setrlimit(RLIMIT_STACK, &rls); + return; +} +EOF + make genmake_tc_1.o >> genmake_warnings 2>&1 + RET_C=$? + cat < genmake_tc_2.$FS + program hello + external setrlstk + call setrlstk() + end +EOF + $FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_warnings 2>&1 + RET_F=$? + test -x ./genmake_tc && ./genmake_tc >> genmake_warnings 2>&1 + RETVAL=$? + if test "x$RETVAL" = x0 ; then + HAVE_SETRLSTK=t + DEFINES="$DEFINES -DHAVE_SETRLSTK" + fi + rm -f genmake_tc* +} + + check_HAVE_STAT() { get_fortran_c_namemangling cat < genmake_tc_1.c @@ -714,7 +753,7 @@ integer nbyte call tfsize(nbyte) print *," HELLO WORLD", nbyte - end program hello + end EOF $FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_tc.log 2>&1 RET_F=$? @@ -834,15 +873,18 @@ NOOPTFLAGS= MPI= MPIPATH= +TS= -# DEFINES checked by test compilation +# DEFINES checked by test compilation or command-line HAVE_SYSTEM= HAVE_FDATE= FC_NAMEMANGLE= HAVE_CLOC= +HAVE_SETRLSTK= HAVE_STAT= HAVE_NETCDF= HAVE_ETIME= +IGNORE_TIME= MODS= TOOLSDIR= @@ -888,7 +930,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 MPI JAM DUMPSTATE STANDARDDIRS" +gm_s2="FC CPP IEEE TS 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 " @@ -1068,6 +1110,9 @@ -noieee | --noieee) IEEE= ;; + -ts | --ts) + TS=true ;; + -mpi | --mpi) MPI=true ;; -mpi=* | --mpi=*) @@ -1091,6 +1136,9 @@ ac_prev=TAMC_EXTRA ;; -tamc_extra=* | --tamc_extra=*) TAMC_EXTRA=$ac_optarg ;; + + -ignoretime | -ignore_time | --ignoretime | --ignore_time) + IGNORE_TIME="-DIGNORE_TIME" ;; -*) echo "Error: unrecognized option: "$ac_option @@ -1148,7 +1196,7 @@ # Find the MITgcm ${THISVER} if test -f "${ROOTDIR}/doc/tag-index" ; then - THISVER=`grep checkpoint ${ROOTDIR}/doc/tag-index | head -1` + THISVER=`grep '^checkpoint' ${ROOTDIR}/doc/tag-index | head -1` fi if test "x$MAKEFILE" = x ; then @@ -1300,6 +1348,11 @@ DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI" fi +if test ! "x$TS" = x ; then + echo " Turning on timing per timestep" + DEFINES="$DEFINES -DTIME_PER_TIMESTEP" +fi + printf "\n=== Checking system libraries ===\n" printf " Do we have the system() command using $FC... " cat > genmake_tcomp.$FS < genmake_tcomp.$FS <> $MAKEFILE echo >> $MAKEFILE echo 'F77FILES = $(SRCFILES:.F=.'$FS')' >> $MAKEFILE -echo 'F90FILES = $(F90SRCFILES:.F=.'$FS90')' >> $MAKEFILE +echo 'F90FILES = $(F90SRCFILES:.F90=.'$FS90')' >> $MAKEFILE echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE echo >> $MAKEFILE echo '.SUFFIXES:' >> $MAKEFILE