source: palm/trunk/SCRIPTS/palm_simple_run @ 2053

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

update of GPL copyright

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