# # QSUB -s /bin/csh # QSUB -lQ 95000000 # SSD requirements in bytes # QSUB -lT 300 # time limit in seconds # QSUB -q prem # queue to be used, prem, reg, econ, sb, sds_test, lm # QSUB -lM 3.5Mw # space used in megawords # QSUB -nr #newacct 24100004 #----------------------------------------------------------------------- # # This script runs timesgcm (TGCM15) model with options to invoke UNICOS # performance, timing, and fortran analysis tools. As with other jobs, # this script accepts up to two mod deck files ($0.mods (required but may # be empty) and $0.mods1 (optional), where $0 is the name of this script). # For mod decks to be included, this job must be submitted using the # "modjob" command. Any mods will be included in the performance and analysis # tools. Reports from the analysis tools will be sent to the machine path # given as rdir (see below). (This job may also be run in "normal" mode, # i.e., with or without mods, and no analysis tools used. This script can # also be run interactively on shavano but manually copy current mod deck # file to shavano:~/mods). Note that the use of any of the tools will force # compilation of the entire model, adding 2-2.5 minutes cpu time to the job. # # The following analysis tools are available: # # flint: # Source code analyzer which can detect a wide range of potential # problems including inappropriate arguments passed to functions, # inappropriate library calls, inconsistencies in common-block # declarations, non-portable code, type usage conflicts, unused # functions, subroutines, and variables, etc. Flint runs on source # code only, and does not require execution (can set run = 0) # # ftref: # Generates global cross-reference of common block variables for entire # program. Summaries of entries and subprogram calls, and static calling # trees are also available. Requires recompilation of entire code, but # not execution (can set run = 0) # # perftrace: # Reports hardware performance by program unit including cpu time # spent, number of flops, inlining factor, etc. Requires recompilation # and execution. (can incur significant cpu overhead) (any *one* of # the 4 possible analysis groups (0-3) may be specified by setting # perf_group (separate execution is required for each group)) # (do not set both perf and hpm) # # hpm: # Hardware performance monitor: statistics for overall program # timing information (mips, mflops, memory references, etc). # The following 4 groups are available (0-3). As in perftrace # Any *one* of the groups may be selected by setting hpm_group: # 0 Execution summary (default) # 1 Hold issue conditions # 2 Memory activity # 3 Vector events and instruction summary # (do not set both perf and hpm) # # flowtrace: # Similiar to perftrace, but without hardware monitoring. Generates # timing info of subroutines and functions during execution. Dynamic # calling trees are available, as is selective tracing. (Can incur # significant cpu overhead) # # profile: # Statistically gathers relative execution times used by individual # parts of the program (by address range and timed sampling). Finer # grained than flowtrace. Selective profiling available. (Does not # incur significant cpu overhead but does require additional memory.) # # Usage: To invoke an analysis tool, set the appropriate flag(s) below # to values corresponding to options desired from the tool (see # individual man pages). E.g., set flow = -Luch means flowview will # be called with -Luch options for the report. If the tool is not # desired, comment it out with "#" in first column. Note some # option combinations will produce very large output (3+Mb!). # Some tools (notably perfview and flowview) may be run as # interactive X-window applications on shavano after program # execution, to view the results interactively rather than as # a hard-copy report. # # It is not advisable to invoke two or more of perf, flow, or prof in the # same run. However, flint and/or ftref may be invoked with perf, flow # or prof. If only flint and/or ftref are used, the script variable "run" # may be set to 0 (set run = 0) since the program need not be executed. # # (B.Foster 7/93) #----------------------------------------------------------------------- ja cd $TMPDIR # # Tool settings (analysis report options): # #set flint = "--fuw -O207,276,76,261,254" #set ftref = "-c part -t part" set perf = "-LBMuch" set perf_group = 3 # there are 4 analysis groups (0-3, default=0) #set hpm # no options for hpm #set hpm_group = 0 #set flow = "-LuchTp" #set prof = "-Lmh" # # If mssdir is set, raw data files generated by analysis tools will # be sent to the mass store directory $mssdir (these files may be used # for X-interface display (on shavano) of results (e.g., with flowview # or perfview) set mssdir = /FOSTER/timesgcm # # if run = 0, model will not be executed: set run = 1 # # If debug is set, compilation will include -z, and a dump will # be generated in event of execution failure set debug # # rdir is remote directory path (with machine name) to which reports # from analysis tools will be sent (probably a /d type directory): #set rdir = ouray.hao:/d/times set rdir = vishnu.hao:/d/foster/timesgcm # # If graphics output from the model are to be sent to the home machine, # set cgmdir to machine and dir to which graphics are to be sent # (should be a /d type dir e.g., ouray.hao:/d/times, and can be # same as rdir), otherwise comment out. # If graphics are to be sent to TAGS for fiche, use "set fiche" line, # otherwise comment out. A title for fiche may be optionally set # with the fiche_title variable. #set cgmdir = ouray.hao:/d/times #set cgmdir = vishnu.hao:/d/foster/timesgcm #set fiche #set fiche_title = "fiche title" # # Save input lexical reads: # cat << 'EOF' >! model.inp C*********************************************************************** C*** Input for TGCM10 (TIMEGCM) updated 11/12/91 *** C*********************************************************************** LABEL='TIMES DEVELOPMENT MODEL (TGCM15) 06/29/93 ' C C SOLSTICE STARTING CONDITIONS***************************** C DATE=1991,355 DATA='FOSTER','TIMEDATV','SOLM01Z' CSOURCE='ROBLE','RGR93','TSSOL5',62,0,0 OUTPUT='ROBLE','RGR93','TSSL12','ROBLE','RGR93','TSSL13', 'ROBLE','RGR93','TSSL14','ROBLE','RGR93','TSSL15' START=22,0,0 STOP=22,0,6 HIST=0,0,6 SAVE=0,0,6 C C NO SEMI-DIURNAL TIDES TIDE=0.,0.,0.,0.,0.,0.,0.,0.,0.,0. TIDE2=16.E+2,11.5 CTIDE2=0.0,0.0 C STEP MUST BE AN INTEGER CSTEP=300 STEP=360 MAG=-74.5,127.,79.,-70. DIFHOR=1 IUIVI=1 CIUIVI=0 AURORA=1 CAURORA=0 CDISPOSE=1 DISPOSE=0 COLFAC=1.5 ENDOFREAD F107 = 67. F107A =72. CAMIVOL='EMERY','PVIEN','S86BG2' OLDALF=0 C H POWER = 2 3 5 7 11 16 23 33 48 82 : 115 155 255 C CTPOTEN = 20 30 40 50 60 70 80 90 100 115 : 130 150 200 POWER=5. CTPOTEN=40. BYIMF = 0. ALFA30=15. E30=1.E-20 ED2=1.E-20 ALFAD2=10. ENDOFREAD 'EOF' # # Normally you should not have to change anything below this line: #----------------------------------------------------------------------- # # Set mod deck names (these were set and rcp'd to ~/mods by modjob # on front end. One mod deck .mods must exist, .mods1 is optional): # if ($?ENVIRONMENT) then if ($ENVIRONMENT == BATCH) then set mods = MODSA set mods1 = MODSB set jobnm = JOBNM batchname $jobnm.$$ else set mods = $0.mods set mods1 = $0.mods1 endif else set mods = $0.mods set mods1 = $0.mods1 set QSUB_REQNAME = $0.$$ endif if ($?prof || $?perf || $?hpm || $?flow || $?ftref || $?flint) then set tools endif # # Obtain update program lib from mss # (check on /usr/tmp/TIGCM before reading from mss): # set local = /usr/tmp/TIGCM/ECRPST.TGCM15F set remote = /ECRIDLEY/ECRPST/TGCM15F if (! -d /usr/tmp/TIGCM) mkdir -m 777 /usr/tmp/TIGCM if (! -f $local) then echo Doing msread of mss file $remote to disk file $local msread -f tr $local $remote chmod 666 $local endif ln $local pl # # Obtain model object code from mss (check on /usr/tmp/TIGCM first): # set local = /usr/tmp/TIGCM/ECRPST.TGCM15O set remote = /ECRIDLEY/ECRPST/TGCM15O if (! -d /usr/tmp/TIGCM) mkdir -m 777 /usr/tmp/TIGCM if (! -f $local) then echo Doing msread of mss file $remote to disk file $local msread -f tr $local $remote chmod 666 $local endif ln $local model.o # # Get mod deck from cwd or ~/mods dir (if batch, was copied there # from front end by modjob script): # if (! -e $mods) then cp ~/mods/$mods . if (! $status) then echo Copied mod deck ~/mods/$mods else echo WARNING: problem copying mod deck ~/mods/$mods endif else echo Using existing mod deck $mods endif # # Obtain second mod deck and cat it to first mod file: # (if second mod deck not in cwd or ~/mods, then assume it is not needed) # if (! -e $mods1) then cp ~/mods/$mods1 . if (! $status) then echo Copied second mod deck ~/mods/$mods1 endif else echo Using existing second mod deck $mods1 endif if (-e $mods1) cat $mods1 >> $mods # # Run update (in full mode (-f) if doing any of the tools) to # generate mods.f. If in full mode, mods.f will be the entire model # source (including any mods), otherwise it will be mods only. # (if not full mode and no mods, update creates an empty mods.f) # set erp = 0 if ($?tools) then nupdate -p pl -i $mods -c mods -f -o "id ns um" || set erp = 1 echo Ran nupdate \(full mode\) with $mods # # Make flint report and send to home machine: # if ($?flint) then flint $flint mods.f > $QSUB_REQNAME.flint rcp $QSUB_REQNAME.flint $rdir echo Copied flint output $QSUB_REQNAME.flint to $rdir if ($?tools) then echo Exiting after flint only \(no compilation or execution\) exit(0) endif endif else nupdate -p pl -i $mods -c mods -o "id ns um" || set erp = 1 echo Ran nupdate \(normal mode\) with $mods endif if ($erp == 1) then echo \>\>\< $QSUB_REQNAME: nupdate error \<\<\< ja -cslst exit(1) endif # # Remove mod deck(s) from ~/mods: # rm ~/mods/$mods if (! $status) then echo Removed mod deck ~/mods/$mods else echo WARNING: problem removing mod deck ~/mods/$mods endif rm ~/mods/$mods1 if (! $status) then echo Removed mod deck ~/mods/$mods1 endif # # If there were mods (or entire model needs compilation), compile them. # If no mods (and update was not in full mode), an empty mods.o is made. # Enable cft77 flags according to analysis tools requirements: # set erp = 0 if (-e "mods.f" && ! -z "mods.f") then set cftarg if ($?debug || $?prof) set cftarg = $cftarg"z" if ($?flow || $?perf) set cftarg = $cftarg"f" if ($?ftref) set cftarg = $cftarg"xs" echo Compiling with -e $cftarg ... cft77 -m 4 -e $cftarg -a static -i 64 mods.f || set erp = 1 if ($erp == 1) then echo \>\>\< $QSUB_REQNAME: cft77 error \(with -e $cftarg\) \<\<\< ja -cslst exit(1) else echo Successful compilation with -e $cftarg endif # # Make ftref report and send to home machine: # if ($?ftref) then ftref $ftref mods.l > $QSUB_REQNAME.ftref rcp $QSUB_REQNAME.ftref $rdir echo Sent ftref report $QSUB_REQNAME.ftref to $rdir endif else touch mods.o echo No mods or full model -- made empty mods.o endif # # Load the program, including prof and/or perf libs if necessary: # set erp = 0 set seglibs if ($?prof) set seglibs = $seglibs"-l prof" if ($?perf) set seglibs = $seglibs"-l perf" echo Calling segldr with $seglibs ... #segldr $seglibs -f indef -o "$QSUB_REQNAME".x -i /u0/ecridley/segdir segldr $seglibs -f indef -o "$QSUB_REQNAME".x -i /u0/foster/segdir.model \ -D dupentry=ignore mods.o model.o || set erp = 1 if ($erp == 1) then echo \>\>\> $QSUB_REQNAME: segldr failed -- exit \<\<\< ja -cslst exit(1) endif if ($?perf) then if ($?perf_group) then setenv PERF_GROUP $perf_group else setenv PERF_GROUP 0 endif endif # # Execute, with warning in event of failure: # set erp = 0 if ($run == 1) then if ($?hpm) then hpm "$QSUB_REQNAME".x < model.inp || set erp = 1 else echo executing ... "$QSUB_REQNAME".x < model.inp || set erp = 1 endif if (erp == 1) echo \>\>\> WARNING: execution failed \<\<\< endif # # Make perftrace report and send to home machine: # if ($?perf) then perfview $perf >! $QSUB_REQNAME.perf rcp $QSUB_REQNAME.perf $rdir echo Sent perfview report $QSUB_REQNAME.perf to $rdir if ($?mssdir) then if (-e perf.data) then mswrite -t 367 -c"perftrace data for use with perfview" \ perf.data $mssdir/$QSUB_REQNAME.perf echo Wrote perf.data to mss file $mssdir/QSUB_REQNAME.perf else echo File perf.data does not exist \(not sent to mss\) endif endif endif # # Make flowtrace report and send to home machine: # (call flodump if execution failed) # (send report to $rdir and/or send data file to mss) # if ($?flow) then if ($erp == 1) flodump flowview $flow >! $QSUB_REQNAME.flow rcp $QSUB_REQNAME.flow $rdir echo Sent flowview report $QSUB_REQNAME.flow to $rdir if ($?mssdir) then if (-e flow.data) then mswrite -t 367 -c"flowtrace data for use with flowview" \ flow.data $mssdir/$QSUB_REQNAME.flow echo Wrote flow.data to mss file $mssdir/QSUB_REQNAME.flow else echo File flow.data does not exist \(not sent to mss\) endif endif endif # # Make profile report and send to home machine: # if ($?prof) then prof -x $QSUB_REQNAME.x > $QSUB_REQNAME.profv profview $prof $QSUB_REQNAME.profv > $QSUB_REQNAME.prof rcp $QSUB_REQNAME.prof $rdir echo Sent prof report $QSUB_REQNAME.prof to $rdir endif # # Make debug dump if execution failed: # if ($erp == 1) then if ($?debug) debug -B -s "$QSUB_REQNAME".x endif # # Transfer plot file to home machine: # if (-e gmeta) then if ($?cgmdir) then rcp gmeta $cgmdir/$QSUB_REQNAME.cgm endif # # Send plot file to TAGS for fiche (title may be changed): # if ($?fiche) then if ($?fiche_title) then sendtg gmeta macr=fiche titl="$fiche_title" else sendtg gmeta macr=fiche titl=$QSUB_REQNAME.plt endif endif endif # ja -cslst