Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
#! /bin/sh
#
# Giuseppe Ciaccio 15 November 2000
# This script is derived from the mpirun.args original script of MPICH .
#
hasprinthelp=1
progname=
cmdLineArgs=
machineFile=
machineFileArg=
fake_progname=
np=1
mpirun_verbose=0
just_testing=0
machineFileArg=
machineFile=
Show=eval
#
PrintHelp() {
#
# If you change this, make the corresponding changes in README so that
# the man pages are updated.
#
cat <<EOF
mpirun [mpirun_options...] <progname> [options...]
mpirun_options:
-h This help
-machinefile <machine-file name>
The file is a list of machines to be involved in the job run.
Local machine is always involved (and hosts instance #0).
Default machine file is /etc/gamma.conf
-np <np>
specify the number of process instances to be generated.
-t Testing - do not actually run, just print what would be
executed
-v Verbose - throw in some comments
Multiple architectures as well as multiple pathnames for the executables
cannot be handled yet.
EOF
}
while [ 1 -le $# ] ; do
arg=$1
#echo $arg
#echo $#
shift
case $arg in
-arch)
shift
;;
-np)
np="$1"
nodigits=`echo $np | sed 's/^[0-9]*$//'`
if [ "$nodigits" != "" -o $np -lt 1 ] ; then
echo np: $np is an invalid number of processors. Exiting.
exit 1
fi
shift
;;
-machine)
shift
;;
-machinefile)
machineFileArg="-machinefile"
machineFile="$1"
shift
;;
-device)
shift
;;
-stdin)
shift
;;
-stdout)
shift
;;
-stderr)
shift
;;
-nolocal)
;;
-h)
if [ "$hasprinthelp" = 1 ] ; then
PrintHelp
fi
exit 1
;;
-e)
;;
-pg)
;;
-leave_pg|-keep_pg)
;;
-batch)
;;
-jid)
shift
;;
-globusrsl)
shift
;;
-globusdb)
shift
;;
-globusargs)
shift
;;
-p4pg)
shift
;;
-p4wd)
shift
;;
-tcppg)
shift
;;
-p4ssport)
shift
;;
-paragontype)
shift
;;
-paragonname)
shift
;;
-paragonpn)
shift
;;
-v)
mpirun_verbose=1
;;
-t)
just_testing=1
Show=echo
;;
-tv|-totalview)
;;
-ksq)
;;
-dbx)
;;
-gdb)
;;
-xxgdb)
;;
-ddd)
;;
-pedb)
;;
-nopoll)
;;
-maxtime|-cpu)
shift
;;
-mem)
shift
;;
-mvhome)
;;
-mvback)
shift
;;
-cac)
shift
;;
-echo)
;;
-usage|-help|-\?)
# Accept these for help until the program name is provided.
if [ "$progname" = "" ] ; then
if [ "$hasprinthelp" = "1" ] ; then
PrintHelp
fi
exit 1
fi
;;
*)
# The first unrecognized argument is assumed to be the name of
# the program, but only if it is executable
proginstance=`echo $arg | sed "s/%a/$arch/g"`
if [ "$progname" = "" -a "$fake_progname" = "" -a \
! -x "$proginstance" ] ; then
fake_progname="$arg"
elif [ "$progname" = "" -a -x "$proginstance" ] ; then
progname="$arg"
# any following unrecognized arguments are assumed to be arguments
# to be passed to the program, as well as all future args
while [ 1 -le $# ] ; do
cmdLineArgs="$cmdLineArgs $1"
shift
done
else
echo "Warning: Command line arguments for program should be given"
echo "after the program name. Assuming that $arg is a"
echo "command line argument for the program."
cmdLineArgsExecer="$cmdLineArgsExecer -arg=$arg"
cmdLineArgs="$cmdLineArgs $arg"
fi
;;
esac
done
# We need at least the program name
if [ "$progname" = "" ] ; then
echo "Missing: program name"
if [ "$fake_progname" != "" ] ; then
echo "Program $fake_progname either does not exist, is not "
echo "executable, or is an erroneous argument to mpirun."
fi
exit 1
fi
#
# Fill out relative program pathnames
#
# Get the current directory
# Note that PWD may NOT be `pwd` if an explicit "cd", outside of the csh
# shell, is used. A downside of this is that PWD may have a more reasonable
# version of the path. To try and fix this, we create a test file and see
# if it is accessible from PWD and pwd; if so, we take the PWD value
#
# Why can't automounters work!???!!
#
# For those unfamiliar with the problem, the automounter creates
# paths like /tmp_mnt/.... . But if you try to open a file with that path,
# and the ACTUAL path has not been accessed before, the automounter fails
# to mount the partition. In otherwords, the automounter is so mind-bogglingly
# stupid as to not recognize its OWN MOUNTS. Network computing indeed.
#
# Note that PWD may ALSO be damaged, so we need to sed PWD as well...
#
# We should move this to the point in the code where it needs to know a
# particular filename, since this will fail if the directory is not
# writable by the user.
#
if [ -n "sed -e s@/tmp_mnt/@/@g" ] ; then
PWDtest=`pwd | sed -e s@/tmp_mnt/@/@g`
if [ ! -d $PWDtest ] ; then
PWDtest=`pwd`
fi
if [ -n "$PWD" ] ; then
# Use a process-specific filename
PWDtest2=`echo $PWD | sed -e s@/tmp_mnt/@/@g`
/bin/rm -f $PWDtest/.mpirtmp$$ $PWDtest2/.mpirtmp$$
if `eval "echo test > $PWDtest2/.mpirtmp$$" 2>/dev/null` ; then
if [ ! -s $PWDtest/.mpirtmp$$ ] ; then
/bin/rm -f $PWDtest2/.mpirtmp$$
PWD=$PWDtest
else
PWD=$PWDtest2
fi
else
# Current directory is not writable. Hope for the best
PWD=$PWDtest
fi
/bin/rm -f $PWDtest/.mpirtmp$$ $PWDtest2/.mpirtmp$$
else
PWD=$PWDtest
fi
else
PWD=`pwd`
fi
#
if [ -n "$PWD" ] ; then
PWD_TRIAL=$PWD
else
PWD_TRIAL=$PWDtest
fi
# The test for PWD_TRIAL usable is within the p4/execer/tcp test (since that
# is where it matters)
#
tail=`echo $progname | sed 's/\/.*//'`
if [ "$tail" = "" ] ; then
#echo Absolute path, don't need to change anything
true
else
#echo Relative path
progname="$PWD_TRIAL/$progname"
fi
if [ $mpirun_verbose = 1 ] ; then
echo "running $progname on $np $arch $machine processors"
fi
$Show $progname $cmdLineArgs $machineFileArg $machineFile -GAMMANP $np