Back to home page

MITgcm

 
 

    


File indexing completed on 2024-07-17 05:11:48 UTC

view on githubraw file Latest commit acacc28f on 2024-07-17 03:59:01 UTC
5fb27a7146 Patr*0001 #! /usr/bin/env bash
                0002 
3a516654c6 Jean*0003 #- script to run the sequence of multiple Divided-Adjoint runs:
                0004 #  no argment -> using non-MPI built AD-executable
                0005 #  single-arg -> using MPI built executable and "mpirun -np ${single-arg}" command
                0006 
                0007 #- number of additional executions to perform is given by "add_DIVA_runs"
0c2658e191 Jean*0008 #  and corresponds to "nchklev_3" value in file "code_ad/tamc.h"
3a516654c6 Jean*0009 #- take it from file "run_ADM_DIVA" (as done in testreport):
                0010 adm_diva_nb=`sed -n '/^ *add_DIVA_runs *=/p' run_ADM_DIVA | sed 's/ //g'`
                0011 echo " Divided Adjoint Run: $adm_diva_nb"
                0012 eval "let $adm_diva_nb"
                0013 #- or set-it directly:
                0014 #add_DIVA_runs=4
5fb27a7146 Patr*0015 
3a516654c6 Jean*0016 extraRuns=`expr $add_DIVA_runs - 1`     
0c2658e191 Jean*0017 if test $# = 0 ; then
                0018     rm -f costfunction*0000 costfinal divided.ctrl snapshot*
                0019 #- not MPI run:
                0020     echo "Run $add_DIVA_runs times + final run:"
3a516654c6 Jean*0021     for ii in `seq 0 $extraRuns` ; do
acacc28f7f Jean*0022       echo " --> starts DIVA run # $ii :"
0c2658e191 Jean*0023       ./mitgcmuv_ad > output_adm.txt.diva_${ii}
acacc28f7f Jean*0024       echo -n " <-- DIVA run # $ii : done"
                0025       if test -f divided.ctrl ; then
                0026         echo -n ", divided.ctrl :" ; cat divided.ctrl
                0027       else  echo ", no 'divided.ctrl' file" ; fi
                0028 #     if test $ii = 2 ; then exit $ii ; fi
0c2658e191 Jean*0029     done
acacc28f7f Jean*0030     echo " --> Final DIVA run :"
0c2658e191 Jean*0031     ./mitgcmuv_ad > output_adm.txt
acacc28f7f Jean*0032     echo -n " <-- Final run : done"
                0033     if test -f divided.ctrl ; then echo -n ", divided.ctrl :" ; cat divided.ctrl
                0034     else  echo "" ; fi
0c2658e191 Jean*0035 else
                0036   if [ $1 -ge 1 ] ; then
                0037     rm -f costfunction*0000 costfinal divided.ctrl snapshot*
                0038 #- MPI run on $1 procs (note: may need to edit mpirun command):
                0039     echo "Run $add_DIVA_runs times + final run (use 'mpirun -np $1' ):"
3a516654c6 Jean*0040     for ii in `seq 0 $extraRuns` ; do
acacc28f7f Jean*0041       echo " --> starts DIVA run # $ii :"
0c2658e191 Jean*0042       mpirun -np $1 ./mitgcmuv_ad
acacc28f7f Jean*0043       echo -n " <-- DIVA run # $ii : done"
0c2658e191 Jean*0044       mv -f STDOUT.0000 STDOUT.0000.diva_${ii}
acacc28f7f Jean*0045       if test -f divided.ctrl ; then
                0046         echo ", divided.ctrl :"
                0047         cat divided.ctrl
                0048       else  echo ", no 'divided.ctrl' file" ; fi
0c2658e191 Jean*0049     done
acacc28f7f Jean*0050     echo " --> Final DIVA run :"
0c2658e191 Jean*0051     mpirun -np $1 ./mitgcmuv_ad
acacc28f7f Jean*0052     echo -n " <-- Final run : done"
                0053     if test -f divided.ctrl ; then echo ", divided.ctrl :" ; cat divided.ctrl
                0054     else  echo "" ; fi
0c2658e191 Jean*0055   fi
                0056 fi