Last change
on this file since 4 was
4,
checked in by cholod, 12 years ago
|
Load NEMO_TMP into vendor/nemo/current.
|
-
Property svn:executable set to
*
|
File size:
1.4 KB
|
Line | |
---|
1 | #!/bin/ksh |
---|
2 | # |
---|
3 | # Script to run the NEMO rebuild tool to rebuild NEMO |
---|
4 | # diagnostic or restart files. |
---|
5 | # |
---|
6 | # The scripts creates the nam_rebuild namelist based upon |
---|
7 | # the command line options you give it (see usage below) |
---|
8 | # |
---|
9 | # Ed Blockley, September 2011 |
---|
10 | # |
---|
11 | # |
---|
12 | |
---|
13 | #set -ax |
---|
14 | usage () |
---|
15 | { |
---|
16 | echo |
---|
17 | echo " NEMO Rebuild" |
---|
18 | echo " ************" |
---|
19 | echo |
---|
20 | echo " usage: ${0##*/} [-t -c] filebase ndomain [rebuild dimensions]" |
---|
21 | echo |
---|
22 | echo " flags: -t num use num threads" |
---|
23 | echo " -c num split 4D vars into time chuncks of size num" |
---|
24 | echo |
---|
25 | exit 1 |
---|
26 | } |
---|
27 | |
---|
28 | while getopts c:t: opt |
---|
29 | do |
---|
30 | case ${opt} in |
---|
31 | t) |
---|
32 | OMP_NUM_THREADS=${OPTARG} |
---|
33 | ;; |
---|
34 | c) |
---|
35 | NCHUNKSIZE=${OPTARG} |
---|
36 | ;; |
---|
37 | esac |
---|
38 | done |
---|
39 | shift $(expr ${OPTIND} - 1) |
---|
40 | |
---|
41 | if [[ $# < 2 ]] ; then |
---|
42 | usage |
---|
43 | fi |
---|
44 | |
---|
45 | script_dir=$(dirname $0) |
---|
46 | |
---|
47 | file=$1 |
---|
48 | ndomain=$2 |
---|
49 | DIM1=$3 |
---|
50 | DIM2=$4 |
---|
51 | export OMP_NUM_THREADS=${OMP_NUM_THREADS:-16} |
---|
52 | |
---|
53 | if [[ -n ${DIM1} && -n ${DIM2} ]] ; then |
---|
54 | dim_str=" dims '${DIM1}','${DIM2}'" |
---|
55 | dims="dims='${DIM1}','${DIM2}'" |
---|
56 | echo ${dim_str} >> nam_rebuild |
---|
57 | fi |
---|
58 | |
---|
59 | echo "file ${file}, num_domains ${ndomain}, num_threads ${OMP_NUM_THREADS}${dim_str}" |
---|
60 | |
---|
61 | cat > nam_rebuild << EOC |
---|
62 | &nam_rebuild |
---|
63 | filebase='${file}' |
---|
64 | ndomain=${ndomain} |
---|
65 | EOC |
---|
66 | if [[ -n ${dims} ]] ; then |
---|
67 | echo ${dims} >> nam_rebuild |
---|
68 | fi |
---|
69 | if [[ -n ${NCHUNKSIZE} ]] ; then |
---|
70 | echo " nchunksize=${NCHUNKSIZE}" >> nam_rebuild |
---|
71 | fi |
---|
72 | echo "/" >> nam_rebuild |
---|
73 | |
---|
74 | # run the rebuild code |
---|
75 | ${script_dir}/rebuild_nemo.exe |
---|
Note: See
TracBrowser
for help on using the repository browser.