source: palm/trunk/SCRIPTS/palm_simple_run @ 2716

Last change on this file since 2716 was 2716, checked in by kanani, 4 years ago

Correction of "Former revisions" section

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