source: palm/trunk/SCRIPTS/palm_simple_run @ 1172

Last change on this file since 1172 was 1172, checked in by raasch, 11 years ago

last commit documented

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 5.1 KB
RevLine 
[421]1#!/bin/ksh
[1046]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# -----------------
[1172]21#
[1046]22#
23# Former revisions:
24# -----------------
25# $Id: palm_simple_run 1172 2013-05-30 11:46:00Z raasch $
[1047]26#
[1172]27# 1171 2013-05-30 11:27:45Z raasch
28# new option -e which defines the execution command to be used to run PALM
29#
[1047]30# 1046 2012-11-09 14:38:45Z maronga
31# code put under GPL (PALM 3.9)
[1171]32#
33# 29/08/11 - BjornW - Adapted for lcflow (ForWind cluster in Oldenburg)
34# 18/03/10 - Siggi  - Some comments changed
35# 25/01/10 - Siggi  - Generating the first version
[1046]36
[1171]37
38#--------------------------------------------------------------------------------#
[421]39# palm_simple_run - a simple method for running the palm code without
40#                   using the mrun script
[1171]41#
42# This script runs the palm code in a unique subdirectory (OUTPUT...,
43# current time/date and number of processors are part of the subdirectory
44# name).
45# It requires that palm has been installed with command
46# palm_simple_install and that the executable palm has been created
47# with make in directory  ...../MAKE_DEPOSITORY_simple
48#--------------------------------------------------------------------------------#
[421]49
50
51    # Variable declarations + default values
52 case=example_cbl
53 cpumax=999999
[1171]54 execute_for=unknown
[421]55 localhost=unknown
56 localhost_realname=$(hostname)
57 mpi_procs=1
58 mpi_procs_per_node=1
59 openmp_threads=1
60
61 typeset -i  ii
62
63
64    # Read shellscript options
[1171]65 while  getopts  :c:e:l:n:p:t:  option
[421]66 do
67   case  $option  in
68       (c)   case=$OPTARG;;
[1171]69       (e)   execute_for=$OPTARG;;
[421]70       (l)   localhost=$OPTARG;;
71       (n)   mpi_procs_per_node=$OPTARG;;
72       (p)   mpi_procs=$OPTARG;;
73       (t)   openmp_threads=$OPTARG;;
74       (\?)  printf "\n  +++ unknown option $OPTARG \n"
[1171]75             printf "\n      allowed option are -c, -e, -l, -n, -p, -t \n"
[421]76             exit;;
77   esac
78 done
79
80
81    # Find out the global svn revision number
[426]82 global_revision=`svnversion ${palm_dir}trunk  2>/dev/null`
[421]83 global_revision="Rev: $global_revision"
84
85
86    # Generate unique directory/files for this run
87 timedate="`date +%d.%b_%H:%M:%S`"
[515]88 suffix=$case+$mpi_procs+$timedate
[421]89 RUNDIR=OUTPUT.$suffix/
90
91 if [[ ! -d $RUNDIR ]]
92 then
93    mkdir $RUNDIR
94    echo "*** running in directory $RUNDIR"
95 else
96    echo "+++ ERROR: $RUNDIR exists\!   Must be unique.  Exiting."
97    exit
98 fi
99
100
101    # Check if palm has been installed and copy executable into the run
102    # directory
[426]103 if [[ ! -f ${palm_dir}MAKE_DEPOSITORY_simple/palm ]]
[421]104 then
105    echo "+++ ERROR: palm executable does not exist."
106    echo "           Please run \"palm_simple_install\"."
107    exit
108 else
[426]109    cp  ${palm_dir}MAKE_DEPOSITORY_simple/palm  $RUNDIR/palm
[421]110 fi
111
112
113    # Check, if parameter file exists and copy into the run directory
[426]114 if [[ ! -f ${palm_dir}JOBS/${case}/INPUT/${case}_p3d ]]
[421]115 then
116    echo "+++ ERROR: parameter file"
[426]117    echo "           \"${palm_dir}JOBS/${case}/INPUT/${case}_p3d\""
[421]118    echo "           does not exist."
119    exit
120 else
[426]121    cp  ${palm_dir}JOBS/${case}/INPUT/${case}_p3d  $RUNDIR/PARIN
[421]122 fi
123
124
125    # Switch to run directory
126 cd  $RUNDIR
127
128
129
130    # Create NAMELIST file containing environment values needed by palm
131 cat  >  ENVPAR  <<  %%END%%
132 &envpar  run_identifier = '$case', host = '$localhost',
[1171]133          write_binary = 'false', tasks_per_node = $mpi_procs_per_node,
[421]134          maximum_cpu_time_allowed = ${cpumax}.,
135          revision = '$global_revision',
136          local_dvrserver_running = .FALSE. /
137
138%%END%%
139
140
141    # Coupled runs cannot be carried out with this simple run script
142 echo "no_coupling"  >  runfile_atmos
143
144
145    # Generate hostfile (if neccessary)
146 (( ii = 1 ))
147 while (( ii <= $mpi_procs ))
148 do
149    echo  $localhost_realname  >>  hostfile
150    (( ii = ii + 1 ))
151 done
152
153
154    # Set number of OpenMP threads
155 export OMP_NUM_THREADS=$openmp_threads
156
157
158
159    # Start palm run
160 echo "*** palm will be run:  MPI tasks: $mpi_procs   OpenMP thread: $OMP_NUM_THREADS"
161
[1171]162 case $execute_for in
[421]163
[1171]164    (imuk)         mpiexec  -machinefile hostfile  -n $mpi_procs  ./palm  < runfile_atmos;;
165    (sgi-mpt)      mpiexec_mpt  -np $mpi_procs  ./palm  < runfile_atmos;;
166    (hpc-flow)     mpiexec  -machinefile $TMPDIR/machines -n $mpi_procs  -env I_MPI_FABRICS shm:ofa ./palm  < runfile_atmos;;
167    (pgi-openacc)  ./palm;;
168    (*)      echo "+++ -e option to define execution command is missing";;
[421]169
[1171]170 esac
[515]171
[421]172 echo "*** palm finished"
173 echo "*** see"
174 echo "    \"$RUNDIR\""
175 echo "    for results"
Note: See TracBrowser for help on using the repository browser.