source: dynamico_lmdz/aquaplanet/OLD_PHYSIC/RUN_AQUAPLANET_DYNAMICO_LMDZ5/example.sh @ 4040

Last change on this file since 4040 was 4040, checked in by dubos, 7 years ago

Aquaplanet : updated scripts

  • Property svn:executable set to *
File size: 2.0 KB
Line 
1#!/bin/bash
2# How to use this script :
3# 1    Create a directory EXP for your experiment ; ALL commands below must be run from EXP
4# 2    Create a directory STORE to store the outputs of your experiment ; run "ln -s STORE storedir"
5# 3    run "BASE/example.sh init" where BASE is the directory containing this script
6# 4    (optional) Edit EXP/config.sh, EXP/run_icosa.def, EXP/*.xml
7# 5    run "./example.sh create" (NB : ./example.sh, NOT ../example.sh)
8# 6    run "./example.sh submit"
9
10function fullpath() 
11{ 
12    echo "$(cd -P $1 ; pwd)"
13}
14
15function years()
16{
17    for ((i="$1";i<="$2";i++)) ; do
18        echo $(printf 'year%02d' $i)
19    done
20}
21
22function cmd_create()
23{
24    source ./config.sh
25    env | grep YEARS
26    STORE_ROOT=$( fullpath $PWD/storedir )
27    YEARS=$(years 1 $NB_YEARS)
28    for DIR in ce0l $YEARS ; do
29        rm -rf $DIR $STORE_ROOT/$DIR
30    done
31    STORE0L="$STORE_ROOT/ce0l"
32    $BASEDIR/prepare.sh ce0l ce0l "$STORE0L"
33    $BASEDIR/prepare.sh first $STORE0L year01 "$STORE_ROOT/year01"
34    PREV=year01
35    for YEAR in $(years 2 $NB_YEARS) ; do
36        $BASEDIR/prepare.sh next  $STORE0L "$STORE_ROOT/$PREV" $YEAR "$STORE_ROOT/$YEAR"
37        PREV=$YEAR
38    done
39}
40
41function submit_X64_CURIE()
42{
43    EXP=$1 ; shift
44    CMD="ccc_msub $* $EXP/job.sh"
45    MSG=$($CMD)
46    echo "$CMD : $MSG"
47    JOBID=$( echo "$MSG" | awk '{print $NF}' )
48    DEP="-a $JOBID"
49}
50
51function cmd_submit()
52{
53    source ./config.sh
54    DEP=""
55    submit_$ARCH ce0l
56    for YEAR in $(years 1 $NB_YEARS) ; do
57        submit_$ARCH $YEAR $DEP
58    done
59}
60
61function cmd_init()
62{
63    cp -fp $BASEDIR/*.sh $BASEDIR/*.xml $BASEDIR/*.def .
64    cat > config.sh <<EOF
65ARCH=X64_CURIE
66BASEDIR=$BASEDIR
67ESM_ROOT=$ESM_ROOT
68NB_YEARS=10
69NB_MPI_DYNAMICO=160
70NB_MPI_XIOS=16
71NB_MPI_CE0L=16
72JOB_WALLTIME=7200
73EOF
74    ls -lrh
75    cat config.sh
76}
77
78function cmd_()
79{
80echo
81}
82
83BASEDIR=$(dirname ${BASH_SOURCE[0]})
84BASEDIR=$( fullpath $BASEDIR )
85ESM_ROOT=$( fullpath $BASEDIR/../../ )
86echo "Your command : $0 $*"
87echo "Script base dir : $BASEDIR"
88echo "Run from : $(fullpath $PWD)"
89echo "Usage : $0 [init|create|submit]"
90cmd_$1
Note: See TracBrowser for help on using the repository browser.