source: palm/trunk/SCRIPTS/palm_simple_run @ 1117

Last change on this file since 1117 was 1047, checked in by maronga, 12 years ago

last commit documented / added nc2vdf

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 4.7 KB
Line 
1#!/bin/ksh
2#--------------------------------------------------------------------------------#
3# This file is part of PALM.
4#
5# PALM is free software: you can redistribute it and/or modify it under the terms
6# of the GNU General Public License as published by the Free Software Foundation,
7# either version 3 of the License, or (at your option) any later version.
8#
9# PALM is distributed in the hope that it will be useful, but WITHOUT ANY
10# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License along with
14# PALM. If not, see <http://www.gnu.org/licenses/>.
15#
16# Copyright 1997-2012  Leibniz University Hannover
17#--------------------------------------------------------------------------------#
18#
19# Current revisions:
20# -----------------
21#
22# Former revisions:
23# -----------------
24# $Id: palm_simple_run 1047 2012-11-09 15:32:58Z suehring $
25#
26# 1046 2012-11-09 14:38:45Z maronga
27# code put under GPL (PALM 3.9)
28
29# palm_simple_run - a simple method for running the palm code without
30#                   using the mrun script
31     # This script runs the palm code in a unique subdirectory (OUTPUT...,
32     # current time/date and number of processors are part of the subdirectory
33     # name).
34     # It requires that palm has been installed with command
35     # palm_simple_install and that the executable palm has been created
36     # with make in directory  ...../MAKE_DEPOSITORY_simple
37
38     # Last changes:
39     # 25/01/10 - Siggi  - Generating the first version
40     # 18/03/10 - Siggi  - Some comments changed
41     # 29/08/11 - BjornW - Adapted for lcflow (ForWind cluster in Oldenburg)
42
43
44    # Variable declarations + default values
45 case=example_cbl
46 cpumax=999999
47 localhost=unknown
48 localhost_realname=$(hostname)
49 mpi_procs=1
50 mpi_procs_per_node=1
51 openmp_threads=1
52
53 typeset -i  ii
54
55
56    # Read shellscript options
57 while  getopts  :c:l:n:p:t:  option
58 do
59   case  $option  in
60       (c)   case=$OPTARG;;
61       (l)   localhost=$OPTARG;;
62       (n)   mpi_procs_per_node=$OPTARG;;
63       (p)   mpi_procs=$OPTARG;;
64       (t)   openmp_threads=$OPTARG;;
65       (\?)  printf "\n  +++ unknown option $OPTARG \n"
66             printf "\n      allowed option are -d, -f, -l, -s \n"
67             exit;;
68   esac
69 done
70
71
72    # Find out the global svn revision number
73 global_revision=`svnversion ${palm_dir}trunk  2>/dev/null`
74 global_revision="Rev: $global_revision"
75
76
77    # Generate unique directory/files for this run
78 timedate="`date +%d.%b_%H:%M:%S`"
79 suffix=$case+$mpi_procs+$timedate
80 RUNDIR=OUTPUT.$suffix/
81
82 if [[ ! -d $RUNDIR ]]
83 then
84    mkdir $RUNDIR
85    echo "*** running in directory $RUNDIR"
86 else
87    echo "+++ ERROR: $RUNDIR exists\!   Must be unique.  Exiting."
88    exit
89 fi
90
91
92    # Check if palm has been installed and copy executable into the run
93    # directory
94 if [[ ! -f ${palm_dir}MAKE_DEPOSITORY_simple/palm ]]
95 then
96    echo "+++ ERROR: palm executable does not exist."
97    echo "           Please run \"palm_simple_install\"."
98    exit
99 else
100    cp  ${palm_dir}MAKE_DEPOSITORY_simple/palm  $RUNDIR/palm
101 fi
102
103
104    # Check, if parameter file exists and copy into the run directory
105 if [[ ! -f ${palm_dir}JOBS/${case}/INPUT/${case}_p3d ]]
106 then
107    echo "+++ ERROR: parameter file"
108    echo "           \"${palm_dir}JOBS/${case}/INPUT/${case}_p3d\""
109    echo "           does not exist."
110    exit
111 else
112    cp  ${palm_dir}JOBS/${case}/INPUT/${case}_p3d  $RUNDIR/PARIN
113 fi
114
115
116    # Switch to run directory
117 cd  $RUNDIR
118
119
120
121    # Create NAMELIST file containing environment values needed by palm
122 cat  >  ENVPAR  <<  %%END%%
123 &envpar  run_identifier = '$case', host = '$localhost',
124          write_binary = false, tasks_per_node = $mpi_procs_per_node,
125          maximum_cpu_time_allowed = ${cpumax}.,
126          revision = '$global_revision',
127          local_dvrserver_running = .FALSE. /
128
129%%END%%
130
131
132    # Coupled runs cannot be carried out with this simple run script
133 echo "no_coupling"  >  runfile_atmos
134
135
136    # Generate hostfile (if neccessary)
137 (( ii = 1 ))
138 while (( ii <= $mpi_procs ))
139 do
140    echo  $localhost_realname  >>  hostfile
141    (( ii = ii + 1 ))
142 done
143
144
145    # Set number of OpenMP threads
146 export OMP_NUM_THREADS=$openmp_threads
147
148
149
150    # Start palm run
151 echo "*** palm will be run:  MPI tasks: $mpi_procs   OpenMP thread: $OMP_NUM_THREADS"
152
153# IMUK:
154 mpiexec  -machinefile hostfile  -n $mpi_procs  ./palm  < runfile_atmos
155
156# SGI-MPT HLRN:
157# mpiexec_mpt  -np $mpi_procs  ./palm  < runfile_atmos
158
159# HPC-FLOW (ForWind):
160# mpiexec  -machinefile $TMPDIR/machines -n $mpi_procs  -env I_MPI_FABRICS shm:ofa ./palm  < runfile_atmos
161
162
163 echo "*** palm finished"
164 echo "*** see"
165 echo "    \"$RUNDIR\""
166 echo "    for results"
Note: See TracBrowser for help on using the repository browser.