source: palm/trunk/SCRIPTS/palm_simple_run @ 1046

Last change on this file since 1046 was 1046, checked in by maronga, 9 years ago

put scripts and utilities under GPL

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