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 | |
---|
10 | function fullpath() |
---|
11 | { |
---|
12 | echo "$(cd -P $1 ; pwd)" |
---|
13 | } |
---|
14 | |
---|
15 | function years() |
---|
16 | { |
---|
17 | for ((i="$1";i<="$2";i++)) ; do |
---|
18 | echo $(printf 'year%02d' $i) |
---|
19 | done |
---|
20 | } |
---|
21 | |
---|
22 | function 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 | |
---|
41 | function 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 | |
---|
51 | function 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 | |
---|
61 | function cmd_init() |
---|
62 | { |
---|
63 | cp -fp $BASEDIR/*.sh $BASEDIR/*.xml $BASEDIR/*.def . |
---|
64 | cat > config.sh <<EOF |
---|
65 | ARCH=X64_CURIE |
---|
66 | BASEDIR=$BASEDIR |
---|
67 | ESM_ROOT=$ESM_ROOT |
---|
68 | NB_YEARS=10 |
---|
69 | NB_MPI_DYNAMICO=160 |
---|
70 | NB_MPI_XIOS=16 |
---|
71 | NB_MPI_CE0L=16 |
---|
72 | JOB_WALLTIME=7200 |
---|
73 | EOF |
---|
74 | ls -lrh |
---|
75 | cat config.sh |
---|
76 | } |
---|
77 | |
---|
78 | function cmd_() |
---|
79 | { |
---|
80 | echo |
---|
81 | } |
---|
82 | |
---|
83 | BASEDIR=$(dirname ${BASH_SOURCE[0]}) |
---|
84 | BASEDIR=$( fullpath $BASEDIR ) |
---|
85 | ESM_ROOT=$( fullpath $BASEDIR/../../ ) |
---|
86 | echo "Your command : $0 $*" |
---|
87 | echo "Script base dir : $BASEDIR" |
---|
88 | echo "Run from : $(fullpath $PWD)" |
---|
89 | echo "Usage : $0 [init|create|submit]" |
---|
90 | cmd_$1 |
---|