3 # Giuseppe Ciaccio 15 November 2000
4 # This script is derived from the mpirun.args original script of MPICH .
21 # If you change this, make the corresponding changes in README so that
22 # the man pages are updated.
25 mpirun [mpirun_options...] <progname> [options...]
29 -machinefile <machine-file name>
30 The file is a list of machines to be involved in the job run.
31 Local machine is always involved (and hosts instance #0).
32 Default machine file is /etc/gamma.conf
34 specify the number of process instances to be generated.
35 -t Testing - do not actually run, just print what would be
37 -v Verbose - throw in some comments
39 Multiple architectures as well as multiple pathnames for the executables
40 cannot be handled yet.
45 while [ 1 -le $# ] ; do
56 nodigits
=`echo $np | sed 's/^[0-9]*$//'`
57 if [ "$nodigits" != "" -o $np -lt 1 ] ; then
58 echo np
: $np is an invalid number of processors. Exiting.
67 machineFileArg
="-machinefile"
86 if [ "$hasprinthelp" = 1 ] ; then
172 # Accept these for help until the program name is provided.
173 if [ "$progname" = "" ] ; then
174 if [ "$hasprinthelp" = "1" ] ; then
181 # The first unrecognized argument is assumed to be the name of
182 # the program, but only if it is executable
183 proginstance
=`echo $arg | sed "s/%a/$arch/g"`
184 if [ "$progname" = "" -a "$fake_progname" = "" -a \
185 ! -x "$proginstance" ] ; then
187 elif [ "$progname" = "" -a -x "$proginstance" ] ; then
189 # any following unrecognized arguments are assumed to be arguments
190 # to be passed to the program, as well as all future args
191 while [ 1 -le $# ] ; do
192 cmdLineArgs
="$cmdLineArgs $1"
196 echo "Warning: Command line arguments for program should be given"
197 echo "after the program name. Assuming that $arg is a"
198 echo "command line argument for the program."
199 cmdLineArgsExecer
="$cmdLineArgsExecer -arg=$arg"
200 cmdLineArgs
="$cmdLineArgs $arg"
206 # We need at least the program name
208 if [ "$progname" = "" ] ; then
209 echo "Missing: program name"
210 if [ "$fake_progname" != "" ] ; then
211 echo "Program $fake_progname either does not exist, is not "
212 echo "executable, or is an erroneous argument to mpirun."
217 # Fill out relative program pathnames
219 # Get the current directory
220 # Note that PWD may NOT be `pwd` if an explicit "cd", outside of the csh
221 # shell, is used. A downside of this is that PWD may have a more reasonable
222 # version of the path. To try and fix this, we create a test file and see
223 # if it is accessible from PWD and pwd; if so, we take the PWD value
225 # Why can't automounters work!???!!
227 # For those unfamiliar with the problem, the automounter creates
228 # paths like /tmp_mnt/.... . But if you try to open a file with that path,
229 # and the ACTUAL path has not been accessed before, the automounter fails
230 # to mount the partition. In otherwords, the automounter is so mind-bogglingly
231 # stupid as to not recognize its OWN MOUNTS. Network computing indeed.
233 # Note that PWD may ALSO be damaged, so we need to sed PWD as well...
235 # We should move this to the point in the code where it needs to know a
236 # particular filename, since this will fail if the directory is not
237 # writable by the user.
239 if [ -n "sed -e s@/tmp_mnt/@/@g" ] ; then
240 PWDtest
=`pwd | sed -e s@/tmp_mnt/@/@g`
241 if [ ! -d $PWDtest ] ; then
244 if [ -n "$PWD" ] ; then
245 # Use a process-specific filename
246 PWDtest2
=`echo $PWD | sed -e s@/tmp_mnt/@/@g`
247 /bin
/rm -f $PWDtest/.mpirtmp$$
$PWDtest2/.mpirtmp$$
248 if `eval "echo test > $PWDtest2/.mpirtmp$$" 2>/dev/null` ; then
249 if [ ! -s $PWDtest/.mpirtmp$$
] ; then
250 /bin
/rm -f $PWDtest2/.mpirtmp$$
256 # Current directory is not writable. Hope for the best
259 /bin
/rm -f $PWDtest/.mpirtmp$$
$PWDtest2/.mpirtmp$$
267 if [ -n "$PWD" ] ; then
272 # The test for PWD_TRIAL usable is within the p4/execer/tcp test (since that
273 # is where it matters)
275 tail=`echo $progname | sed 's/\/.*//'`
276 if [ "$tail" = "" ] ; then
277 #echo Absolute path, don't need to change anything
281 progname
="$PWD_TRIAL/$progname"
284 if [ $mpirun_verbose = 1 ] ; then
285 echo "running $progname on $np $arch $machine processors"
288 $Show $progname $cmdLineArgs $machineFileArg $machineFile -GAMMANP $np