1 | #!/bin/bash |
---|
2 | ############################################################# |
---|
3 | # Author : Simona Flavoni for NEMO |
---|
4 | # Contact : sflod@locean-ipsl.upmc.fr |
---|
5 | # |
---|
6 | # sette_beginner.sh : example of script of SET TEsts for NEMO (SETTE) |
---|
7 | # ---------------------------------------------------------------------- |
---|
8 | # NEMO/SETTE , NEMO Consortium (2010) |
---|
9 | # Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
10 | # ---------------------------------------------------------------------- |
---|
11 | # |
---|
12 | ############################################################# |
---|
13 | #set -vx |
---|
14 | set -o posix |
---|
15 | #set -u |
---|
16 | #set -e |
---|
17 | #+ |
---|
18 | # |
---|
19 | # =================== |
---|
20 | # sette_beginner.sh |
---|
21 | # =================== |
---|
22 | # |
---|
23 | # COMPILER : name of compiler as defined in NEMOGCM/ARCH directory |
---|
24 | # BATCH_COMMAND_PAR : name of the command for submitting parallel batch jobs |
---|
25 | # BATCH_COMMAND_SEQ : name of the command for submitting sequential batch jobs |
---|
26 | # INTERACT_FLAG : flag to run in interactive mode "yes" |
---|
27 | # to run in batch mode "no" |
---|
28 | # MPIRUN_FLAG : flag to run in parallel (MPI) "yes" |
---|
29 | # to run in sequential mode (NB_PROC = 1) "no" |
---|
30 | # USING_XIOS : flag to control the activation of key_iomput |
---|
31 | # "yes" to compile using key_iomput and link to the external XIOS library |
---|
32 | # "no" to compile without key_iomput and link to the old IOIPSL library |
---|
33 | # USING_MPMD : flag to control the use of stand-alone IO servers |
---|
34 | # requires USING_XIOS="yes" |
---|
35 | # "yes" to run in MPMD (detached) mode with stand-alone IO servers |
---|
36 | # "no" to run in SPMD (attached) mode without separate IO servers |
---|
37 | # NUM_XIOSERVERS : number of stand-alone IO servers to employ |
---|
38 | # set to zero if USING_MPMD="no" |
---|
39 | # |
---|
40 | # Principal script is sette.sh, that calls |
---|
41 | # |
---|
42 | # makenemo : to create successive exectuables in ${CONFIG_NAME}/BLD/bin/nemo.exe |
---|
43 | # and links to opa in ${CONFIG_NAME}/EXP00) |
---|
44 | # |
---|
45 | # param.cfg : sets and loads following directories: |
---|
46 | # |
---|
47 | # FORCING_DIR : is the directory for forcing files (tarfile) |
---|
48 | # INPUT_DIR : is the directory for input files storing |
---|
49 | # TMPDIR : is the temporary directory (if needed) |
---|
50 | # NEMO_VALIDATION_DIR : is the validation directory |
---|
51 | # |
---|
52 | # (NOTE: this file is the same for all configrations to be tested with sette) |
---|
53 | # |
---|
54 | # all_functions.sh : loads functions used by sette (note: new functions can be added here) |
---|
55 | # set_namelist : function declared in all_functions that sets namelist parameters |
---|
56 | # post_test_tidyup : creates validation storage directory and copies required output files |
---|
57 | # (run.stat and ocean.output) in it after execution of test. |
---|
58 | # |
---|
59 | # VALIDATION tree is: |
---|
60 | # |
---|
61 | # NEMO_VALIDATION_DIR/WCONFIG_NAME/WCOMPILER_NAME/TEST_NAME/REVISION_NUMBER(or DATE) |
---|
62 | # |
---|
63 | # prepare_exe_dir.sh : defines and creates directory where the test is executed |
---|
64 | # execution directory takes name of TEST_NAME defined for every test |
---|
65 | # in sette.sh. (each test in executed in its own directory) |
---|
66 | # |
---|
67 | # prepare_job.sh : to generate the script run_job.sh |
---|
68 | # |
---|
69 | # fcm_job.sh : run in batch (INTERACT_FLAG="no") or interactive (INTERACT_FLAG="yes") |
---|
70 | # see sette.sh and BATCH_TEMPLATE directory |
---|
71 | # |
---|
72 | # NOTE: jobs requiring initial or forcing data need to have an input_CONFIG.cfg in which |
---|
73 | # can be found paths to the input tar file) |
---|
74 | # NOTE: if job is not launched for any reason you have the executable ready in ${EXE_DIR} |
---|
75 | # directory |
---|
76 | # NOTE: the changed namelists are left in ${EXE_DIR} directory whereas original namelists |
---|
77 | # remain in ${NEW_CONF}/EXP00 |
---|
78 | # |
---|
79 | # NOTE: a log file, output.sette, is created in ${SETTE_DIR} with the echoes of |
---|
80 | # executed commands |
---|
81 | # |
---|
82 | # NOTE: if sette.sh is stopped in output.sette there is written the last command |
---|
83 | # executed by sette.sh |
---|
84 | # |
---|
85 | # example use: ./sette_beginner.sh |
---|
86 | ######################################################################################### |
---|
87 | # |
---|
88 | # Compiler among those in NEMOGCM/ARCH |
---|
89 | COMPILER=x3750_ADA |
---|
90 | export BATCH_COMMAND_PAR="llsubmit" |
---|
91 | export BATCH_COMMAND_SEQ=$BATCH_COMMAND_PAR |
---|
92 | export INTERACT_FLAG="yes" |
---|
93 | export MPIRUN_FLAG="yes" |
---|
94 | |
---|
95 | export DEL_KEYS="key_iomput" |
---|
96 | if [ ${USING_XIOS} == "yes" ] |
---|
97 | then |
---|
98 | export DEL_KEYS="" |
---|
99 | fi |
---|
100 | |
---|
101 | # |
---|
102 | # Settings which control the use of stand alone servers (only relevant if using xios) |
---|
103 | # |
---|
104 | export USING_MPMD="no" |
---|
105 | export NUM_XIOSERVERS=4 |
---|
106 | export JOB_PREFIX=batch-mpmd |
---|
107 | # |
---|
108 | if [ ${USING_MPMD} == "no" ] |
---|
109 | then |
---|
110 | export NUM_XIOSERVERS=0 |
---|
111 | export JOB_PREFIX=batch |
---|
112 | fi |
---|
113 | # |
---|
114 | # |
---|
115 | if [ ${USING_MPMD} == "yes" ] && [ ${USING_XIOS} == "no"] |
---|
116 | then |
---|
117 | echo "Incompatible choices. MPMD mode requires the XIOS server" |
---|
118 | exit |
---|
119 | fi |
---|
120 | # |
---|
121 | |
---|
122 | # Directory to run the tests |
---|
123 | SETTE_DIR=$(cd $(dirname "$0"); pwd) |
---|
124 | MAIN_DIR=${SETTE_DIR%/SETTE} |
---|
125 | CONFIG_DIR=${MAIN_DIR}/CONFIG |
---|
126 | TOOLS_DIR=${MAIN_DIR}/TOOLS |
---|
127 | COMPIL_DIR=${TOOLS_DIR}/COMPILE |
---|
128 | |
---|
129 | CMP_NAM=${1:-$COMPILER} |
---|
130 | # Copy job_batch_COMPILER file for specific compiler into job_batch_template |
---|
131 | cd ${SETTE_DIR} |
---|
132 | cp BATCH_TEMPLATE/batch-${COMPILER} job_batch_template || exit |
---|
133 | |
---|
134 | # Run for GYRE CONFIG |
---|
135 | # small test to start |
---|
136 | # compile GYRE configuration with gfortran_osx compiler run with 4 proc : |
---|
137 | export TEST_NAME="SHORT_TEST" |
---|
138 | cd ${CONFIG_DIR} |
---|
139 | . ./makenemo -m ${CMP_NAM} -n GYRE_SHORT -r GYRE -j 10 add_key "key_nosignedzero" del_key ${DEL_KEYS} |
---|
140 | cd ${SETTE_DIR} |
---|
141 | . ./param.cfg |
---|
142 | . ./all_functions.sh |
---|
143 | . ./prepare_exe_dir.sh |
---|
144 | # creation of execution directory |
---|
145 | JOB_FILE=${EXE_DIR}/run_job.sh |
---|
146 | # setting number of procs used |
---|
147 | NPROC=4 |
---|
148 | if [ -f ${JOB_FILE} ] ; then \rm ${JOB_FILE} ; fi |
---|
149 | cd ${EXE_DIR} |
---|
150 | # setting namelist parameters |
---|
151 | # experience name |
---|
152 | set_namelist namelist_cfg cn_exp \"GYRE_SHORT\" |
---|
153 | # first time step |
---|
154 | set_namelist namelist_cfg nn_it000 1 |
---|
155 | # last time step |
---|
156 | set_namelist namelist_cfg nn_itend 120 |
---|
157 | # frequency of creation of a restart file |
---|
158 | set_namelist namelist_cfg nn_stock 60 |
---|
159 | if [ ${USING_MPMD} == "yes" ] ; then |
---|
160 | set_xio_using_server iodef.xml true |
---|
161 | else |
---|
162 | set_xio_using_server iodef.xml false |
---|
163 | fi |
---|
164 | cd ${SETTE_DIR} |
---|
165 | . ./prepare_job.sh input_GYRE.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE} ${NUM_XIOSERVERS} |
---|
166 | # run job, with 4 processors, test named SHORT (= 60 time steps) |
---|
167 | cd ${SETTE_DIR} |
---|
168 | . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG} |
---|