# # This script is appended onto the script being submitted before being # sent to the cray for execution (the append is done by ~foster/bin/modjob). # This part of the complete submitted script uses the following shell vars # defined by the script to which this is appended: # $job, $model, $mssdir, $tmpdir, $rmeta # (e.g., in tgcm12.newjob, the below script is appended to tgcm12.newjob # by modjob at the line "INCLUDE tgcm.run". The tgcm12.newjob script must # have defined the above shell vars before the INCLUDE line) # # Make temp directory if it does not already exist: # if (! -d $tmpdir) mkdir 777 $tmpdir # # Get program library: # set plib = $model.pl if (! -e $plib) then if (! -e $tmpdir/$plib) then echo Reading mss $mssdir/$plib to disk file $plib msread $plib $mssdir/$plib echo Linking disk file $plib to $tmpdir ln $plib $tmpdir else ln $tmpdir/$plib . echo Linked existing file $tmpdir/$plib to cwd endif else echo Using existing disk file $plib endif # # Get model object: # set obj = $model.o if (! -e $obj) then if (! -e $tmpdir/$obj) then echo Reading mss $mssdir/$obj to disk file $obj msread $obj $mssdir/$obj echo Linking disk file $obj to $tmpdir ln $obj $tmpdir else ln $tmpdir/$obj . echo Linked existing file $tmpdir/$obj to cwd endif else echo Using existing disk file $obj endif # # Run update using $job.mods: # echo Running nupdate ... nupdate -p $plib -i $job.mods -c $job -o "ns um" || goto fail_upd setenv FILENV assign # if (-e $job.f && ! -z $job.f) then echo Compiling mods ... cft77 -m 4 -e zi -a static -i 64 $job.f || goto fail_cft set modobj = $job.o else set modobj = " " endif echo Running segldr ... #set segdir = ${HOME}/segdir # segldr directives file #set segdir = ${HOME}/segdir.model # segldr directives file set segdir = segdir cat << 'EOF' >! $segdir lib=/lib/libmv1.a lib=/usr/local/lib/libncarg.a lib=/usr/local/lib/libncarg_gks.a lib=/usr/local/lib/libncarg_c.a lib=/usr/local/lib/libncarg_loc.a lib=/usr/lib/libX11.a lib=/usr/local/lib/libncarm.a lib=/usr/local/lib/libncaro.a lib=/usr/local/lib/libmss.a lib=/usr/local/lib/libalfpack.a lib=/usr/local/lib/libecmfft.a lib=/usr/local/lib/libfitpack.a lib=/usr/local/lib/libfishpak.a lib=/usr/local/lib/libfftpack.a lib=/usr/local/lib/libhpf.a 'EOF' segldr -f indef -o $job.x -i $segdir $modobj $obj || goto fail_ldr # # Clean out any temporary files from previous run and execute: # (these will exist only if previous run was interactive) # if (-e HISTCPY) rm HISTCPY if (-e HISTCPY) rm SECHIST if (-e SOURCE) rm SOURCE if (-e fort.8) rm fort.8 if (-e fort.9) rm fort.9 if (-e fort.15) rm fort.15 $job.x < $job.inp || goto fail_exec if ($?rmeta) then rcp gmeta $rmeta endif ja -cslst exit # # Error traps: # fail_upd: echo ' ' echo \>\>\> Nupdate of program lib from mods failed \<\<\< echo ' ' ja -cslst exit # fail_cft: echo ' ' echo \>\>\> Compile of modified code failed \<\<\< echo ' ' ja -cslst exit # fail_ldr: echo ' ' echo \>\>\> Segldr of modified object failed \<\<\< echo ' ' ja -cslst exit # fail_exec: echo ' ' echo \>\>\> Execution of modified model failed \<\<\< echo ' ' debug -B -s $job.x if ($?rmeta) then rcp gmeta $rmeta endif ja -cslst exit