/[escript]/trunk/run-escript.in
ViewVC logotype

Annotation of /trunk/run-escript.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4058 - (hide annotations)
Fri Nov 2 06:47:06 2012 UTC (6 years, 9 months ago) by caltinay
Original Path: trunk/bin/run-escript
File size: 15889 byte(s)
-Ripley now checks for input fs when calling gradient
-interactive mode works again when filename is supplied (typo)
-forward model PDE sets symmetry on now

1 jfenwick 2409 #!/bin/bash
2    
3     # Escript/Finley wrapper for python
4     # Sets LD_LIBRARY_PATH and PYTHONPATH and then runs either python or the MPI launcher
5    
6     #Extra paths can be configured about a page further down
7     #Search for EXTRA_PATH=""
8    
9 jfenwick 2568 #set to 1 if performing this is a standalone build and ../../pkg contains the relevant tools
10 jfenwick 2409 STANDALONE=0
11    
12     #set to 1 if this is part of a packaged build (.deb) and files will be installed in standard locations
13     #rather than everything in a single directory
14     #Do not use this together with $STANDALONE
15     STDLOCATION=0
16    
17     #Now we find the location of this script
18     #Note that this location should be absolute but does not need to be unique
19     scriptdir=""
20     CURDIR=`pwd`
21    
22     #Environment vars which control operations:
23     # ESCRIPT_NUM_NODES, ESCRIPT_NUM_PROCS, ESCRIPT_NUM_THREADS, ESCRIPT_HOSTFILE, ESCRIPT_CREATESTDFILES
24    
25 jfenwick 3047 HOSTFILE=/tmp/escript.$USER.$$
26     HOSTFILE2=/tmp/escript2.$USER.$$
27 jfenwick 2409
28     #Begin finding ESCRIPT_ROOT
29 caltinay 2806 if [ $STDLOCATION -ne 0 ]
30 jfenwick 2409 then
31     ESCRIPT_ROOT=/usr/lib/escript
32     else
33 caltinay 4031 # We don't know the escript root so we need to work it out from the invocation
34     # Need to match if the name contains /
35 jfenwick 2409 if [[ $0 =~ / ]]
36     then
37     # We are not using the PATH to find the script
38 caltinay 3388 cd "`dirname $0`"
39 jfenwick 2409 scriptdir=`pwd`
40 caltinay 3388 cd "$CURDIR"
41 jfenwick 2409 else
42     # name does not contain / therefore we are using
43     tscriptdir=`which $0`
44 caltinay 3096 if [ $? -ne 0 ]
45 jfenwick 2409 then
46 caltinay 2806 echo "Error! Unable to determine script directory. Exiting."
47     exit 1
48 jfenwick 2409 fi
49     scriptdir=`dirname $tscriptdir`
50     fi
51    
52 caltinay 3388 cd "$scriptdir/.."
53 jfenwick 2409 ESCRIPT_ROOT=`pwd`
54     cd ..
55     ESCRIPT_PARENT=`pwd`
56 caltinay 3388 cd "$CURDIR"
57 jfenwick 2409
58     fi
59 caltinay 4031 ##### End finding ESCRIPT_ROOT ########
60 jfenwick 2409
61 caltinay 2806
62 caltinay 3178
63 jfenwick 2409 PYTHON_MPI_NULL="$ESCRIPT_ROOT/lib/pythonMPI"
64     PYTHON_MPI_REDIRECT="$ESCRIPT_ROOT/lib/pythonMPIredirect"
65     PYTHON_CMD=python
66    
67     # if possible please express paths relative to $ESCRIPT_ROOT unless
68     # they are in an unrelated location
69    
70     EXTRA_DYLD_LIBRARY_PATH=""
71     EXTRA_PATH=$ESCRIPT_ROOT/bin
72     EXTRA_PYTHONPATH=$ESCRIPT_ROOT
73     EXTRA_LD_LIBRARY_PATH=$ESCRIPT_ROOT/lib
74    
75 caltinay 2806 if [ $STANDALONE -eq 1 ]
76 jfenwick 2409 then
77 jfenwick 3335 EXTRA_PATH=$ESCRIPT_PARENT/pkg/python/bin:$ESCRIPT_PARENT/pkg/scons/bin:$EXTRA_PATH
78 jfenwick 2530 EXTRA_LD_LIBRARY_PATH=$ESCRIPT_PARENT/pkg/boost/lib:$ESCRIPT_PARENT/pkg/netcdf/lib/:$EXTRA_LD_LIBRARY_PATH
79 jfenwick 2541 EXTRA_LD_LIBRARY_PATH=$EXTRA_LD_LIBRARY_PATH
80 jfenwick 2530 EXTRA_LD_LIBRARY_PATH=$ESCRIPT_PARENT/pkg/python/lib:$EXTRA_LD_LIBRARY_PATH
81 jfenwick 2541 EXTRA_PYTHONPATH=$ESCRIPT_PARENT/pkg/numpy/lib/python2.6/site-packages:$ESCRIPT_PARENT/pkg/matplotlib/lib/python2.6/site-packages:$EXTRA_PYTHONPATH
82 jfenwick 2409 fi
83    
84 jfenwick 3335
85     BUILDINFO_FILE=$ESCRIPT_ROOT/lib/buildvars
86     if [ ! -r $BUILDINFO_FILE ]; then
87 caltinay 4031 if [ "$1" = "-e" ]; then
88     echo "export LD_LIBRARY_PATH=$EXTRA_LD_LIBRARY_PATH:\$LD_LIBRARY_PATH"
89     echo "export PYTHONPATH=$EXTRA_PYTHONPATH:\$PYTHONPATH"
90     echo "export PATH=$EXTRA_PATH:\$PATH"
91     if [ "`uname`" = "Darwin" ]
92     then
93     echo "export DYLD_LIBRARY_PATH=$EXTRA_DYLD_LIBRARY_PATH:$EXTRA_LD_LIBRARY_PATH:\$DYLD_LIBRARY_PATH"
94     fi
95 jfenwick 3335 exit 0
96     fi
97     echo "Error! Unable to read escript build information. Exiting."
98     exit 1
99     fi
100    
101 caltinay 4031 get_buildvar () {
102 jfenwick 3335 echo `grep "^$1=" $BUILDINFO_FILE |cut -d= -f2`
103     }
104    
105 caltinay 3096 #
106     # Add VisIt paths if required
107     #
108 jfenwick 3259 WITH_VISIT=`get_buildvar visit`
109     if [ "$WITH_VISIT" = "1" ]; then
110 caltinay 4030 VISIT_BIN=`which visit 2>/dev/null`
111 caltinay 3096 if [ $? -eq 0 ]; then
112     VISIT_PY_PATH=`$VISIT_BIN -env | grep LIBPATH | cut -d= -f2`
113     EXTRA_PYTHONPATH=$EXTRA_PYTHONPATH:$VISIT_PY_PATH
114     EXTRA_LD_LIBRARY_PATH=$EXTRA_LD_LIBRARY_PATH:$VISIT_PY_PATH
115     elif [ ! -z $ESCRIPT_VERBOSE ]; then
116     echo "VisIt module enabled but VisIt not in path!"
117     fi
118     fi
119 jfenwick 2409
120     HELP_TEXT="
121 caltinay 4031 Usage: run-escript [options] script.py [arguments...]
122 jfenwick 2409 -n nn number of nodes to use
123 gross 3193 -p np number of MPI processes to spawn per node
124 jfenwick 2409 -t nt number of OpenMP threads to use
125     -f file name of MPI hostfile
126 caltinay 4031 -c print compile information for escript and exit
127 jfenwick 2409 -V print escript version and exit
128     -i interactive mode
129     -b do not invoke python (run non-python programs)
130     -e print export statements for environment and exit
131     -o redirect output from MPI to files
132     -v print diagnostics
133 caltinay 4031 -x run in new xterm instance
134 jfenwick 2409 script.py Your python script
135     arguments... The optional command-line arguments to your script
136     "
137    
138     if [ "$1" = "--help" ]; then
139     echo "$HELP_TEXT"
140     exit 0
141     fi
142 caltinay 4031 #==============================================================================
143 jfenwick 2409
144     # Parse the command-line options
145     # option e should not be followed by a :
146 caltinay 4031 while getopts 'bn:p:t:f:hecVviox' option
147 jfenwick 2409 do
148 caltinay 4031 case "$option" in
149     "b") DO_BINARY=y
150     ;;
151     "n") ESCRIPT_NUM_NODES=$OPTARG
152     ;;
153     "p") ESCRIPT_NUM_PROCS=$OPTARG
154     ;;
155     "t") ESCRIPT_NUM_THREADS=$OPTARG
156     ;;
157     "f") ESCRIPT_HOSTFILE=$OPTARG
158     ;;
159     "c") cat $ESCRIPT_ROOT/lib/buildvars
160     exit 0
161     ;;
162     "V") echo "escript-development(build "`get_buildvar svn_revision`")"
163     exit 0
164     ;;
165     "h") echo "$HELP_TEXT"
166     exit 0
167     ;;
168     "i") DO_INTERACTIVE=y
169     ;;
170     "e") echo "export LD_LIBRARY_PATH=$EXTRA_LD_LIBRARY_PATH:\$LD_LIBRARY_PATH"
171     echo "export PYTHONPATH=$EXTRA_PYTHONPATH:\$PYTHONPATH"
172     echo "export PATH=$EXTRA_PATH:\$PATH"
173     if [ "`uname`" = "Darwin" ]
174     then
175     echo "export DYLD_LIBRARY_PATH=$EXTRA_DYLD_LIBRARY_PATH:$EXTRA_LD_LIBRARY_PATH:\$DYLD_LIBRARY_PATH"
176     fi
177     exit 0
178     ;;
179     "o") ESCRIPT_CREATESTDFILES=y
180     ;;
181     "v") ESCRIPT_VERBOSE=y
182     ;;
183     "x") DO_XTERM=y
184     ;;
185     ?) echo "$HELP_TEXT"
186     exit 1
187     ;;
188     esac
189 jfenwick 2409 done
190     shift `expr $OPTIND - 1`
191     #==============================================
192     #
193 caltinay 3178 # Read MPI_FLAVOUR and WITH_OPENMP from the buildvars
194 jfenwick 2409 #
195 jfenwick 3259 MPI_FLAVOUR=`get_buildvar mpi`
196     WITH_OPENMP=`get_buildvar openmp`
197 jfenwick 2409
198 caltinay 2806 if [ ! -z $ESCRIPT_VERBOSE ]; then
199     echo "MPI flavour is $MPI_FLAVOUR."
200 jfenwick 3259 if [ "$WITH_OPENMP" = "1" ]; then echo "OpenMP enabled."; fi
201 caltinay 2806 fi
202    
203 jfenwick 2409 #
204     # extend path variables
205     #
206     export PATH=$EXTRA_PATH:$PATH
207     export LD_LIBRARY_PATH=$EXTRA_LD_LIBRARY_PATH:$LD_LIBRARY_PATH
208     export PYTHONPATH=$EXTRA_PYTHONPATH:$PYTHONPATH
209     EXPORT_ENV="PATH,LD_LIBRARY_PATH,PYTHONPATH"
210 caltinay 2806 if [ "`uname`" = "Darwin" ]
211 jfenwick 2409 then
212     export DYLD_LIBRARY_PATH=$EXTRA_DYLD_LIBRARY_PATH:$EXTRA_LD_LIBRARY_PATH:$DYLD_LIBRARY_PATH
213     EXPORT_ENV="$EXPORT_ENV,DYLD_LIBRARY_PATH"
214     fi
215 caltinay 2806 if [ ! -z $ESCRIPT_VERBOSE ]
216 jfenwick 2409 then
217     echo "PATH = $PATH "
218     echo "LD_LIBRARY_PATH = $LD_LIBRARY_PATH "
219     echo "PYTHONPATH = $PYTHONPATH "
220     if [ ! -z $DYLD_LIBRARY_PATH ]; then echo "DYLD_LIBRARY_PATH = $DYLD_LIBRARY_PATH "; fi
221     fi
222     #==============================================
223     #
224     # Ensure the variables have sensible values
225     #
226 caltinay 2806 if [ "$MPI_FLAVOUR" = "none" ]
227 jfenwick 2409 then
228     if [ ! -z $ESCRIPT_NUM_NODES ]
229     then
230     echo "Warning: MPI disabled but number of nodes set. Option ignored."
231     fi
232     if [ ! -z $ESCRIPT_NUM_PROCS ]
233     then
234     echo "Warning: MPI disabled but number of processors per node set. Option ignored."
235     fi
236     if [ ! -z $ESCRIPT_HOSTFILE ]
237     then
238     echo "Warning: MPI disabled but host file is given. Option ignored."
239     fi
240     ESCRIPT_NUM_NODES=1
241     ESCRIPT_NUM_PROCS=1
242     else
243 jfenwick 3056 # use the PBS_NODEFILE if not otherwise specified
244 caltinay 4031 if [ ! -z $PBS_NODEFILE ] && [ -z $ESCRIPT_HOSTFILE ]
245 jfenwick 3056 then
246 caltinay 3178 ESCRIPT_HOSTFILE=$PBS_NODEFILE
247 jfenwick 3056 fi
248    
249 jfenwick 2409 if [ ! -z $ESCRIPT_HOSTFILE ]
250     then
251     if [ -f $ESCRIPT_HOSTFILE ]
252     then
253     cat $ESCRIPT_HOSTFILE | sort -u > $HOSTFILE
254     NUM_HOSTS=`cat $HOSTFILE | wc -l`
255     if [ ! -z $ESCRIPT_NUM_NODES ]
256     then
257     if [ $NUM_HOSTS -ne $ESCRIPT_NUM_NODES ]
258     then
259     echo "number of hosts selected in the host file $ESCRIPT_HOSTFILE needs to match the requested number of nodes $ESCRIPT_NUM_NODES."
260     exit 1
261     fi
262     else
263     ESCRIPT_NUM_NODES=$NUM_HOSTS
264     fi
265     else
266     echo "cannot find hostfile $ESCRIPT_HOSTFILE."
267     exit 1
268     fi
269     else
270     HOSTFILE=''
271     fi
272    
273     if [ -z $ESCRIPT_NUM_NODES ]
274     then
275 caltinay 3178 ESCRIPT_NUM_NODES=1
276 jfenwick 2409 fi
277    
278     if [ -z $ESCRIPT_NUM_PROCS ]
279     then
280 caltinay 3178 ESCRIPT_NUM_PROCS=1
281 jfenwick 2409 fi
282    
283 caltinay 2806 if [ ! -z $ESCRIPT_VERBOSE ]
284 jfenwick 2409 then
285 caltinay 3178 echo "ESCRIPT_NUM_NODES = $ESCRIPT_NUM_NODES "
286     echo "ESCRIPT_NUM_PROCS = $ESCRIPT_NUM_PROCS "
287 jfenwick 2409 fi
288     fi
289    
290 jfenwick 3259 if [ "$WITH_OPENMP" = "1" ]
291 jfenwick 2409 then
292     if [ -z $ESCRIPT_NUM_THREADS ]
293     then
294     ESCRIPT_NUM_THREADS=$OMP_NUM_THREADS
295     if [ -z $ESCRIPT_NUM_THREADS ]
296     then
297     ESCRIPT_NUM_THREADS=1
298     fi
299     fi
300     if [ ! -z $ESCRIPT_VERBOSE ]
301     then
302     echo "ESCRIPT_NUM_THREADS is $ESCRIPT_NUM_THREADS."
303     fi
304     else
305 caltinay 4031 if [ ! -z $ESCRIPT_NUM_THREADS ] && [ $ESCRIPT_NUM_THREADS != 1 ]
306 jfenwick 2409 then
307     echo "Warning: OpenMP is disabled but number of threads requested is $ESCRIPT_NUM_THREADS!=1. Running without threads."
308     fi
309     ESCRIPT_NUM_THREADS=1
310     fi
311     #
312     # Now we compute total number of Processes
313     #
314 caltinay 4031 TOTPROC=$((ESCRIPT_NUM_NODES * ESCRIPT_NUM_PROCS))
315     if [ $? -ne 0 ] #Some compute error
316     then #This could happen if the args were not a number
317 caltinay 3178 echo "expression of total number of processors = $ESCRIPT_NUM_NODES * $ESCRIPT_NUM_PROCS is not numerical."
318     exit 1
319 jfenwick 2409 fi
320    
321     #
322     # Test to ensure people aren't trying to combine interactive and multi-process
323     #
324 caltinay 4058 if ([ ! -z $DO_INTERACTIVE ] || [ $# -eq 0 ]) && ([ $TOTPROC -gt 1 ])
325 jfenwick 2409 then
326 caltinay 3178 echo "Interactive mode cannot be used with more than one process"
327     exit 1
328 jfenwick 2409 fi
329    
330     if [ $TOTPROC -gt 1 ]
331     then
332 caltinay 3178 if [ "$ESCRIPT_CREATESTDFILES" = "yes" ]
333     then
334     PYTHON_MPI=$PYTHON_MPI_REDIRECT
335     else
336     PYTHON_MPI=$PYTHON_MPI_NULL
337     fi
338 jfenwick 2409 else
339     PYTHON_MPI=$PYTHON_MPI_NULL
340     fi
341 caltinay 4031 #==============================================================================
342 jfenwick 2409 # Must have at least one command-line arg: the python script
343     if [ $# -eq 0 ]
344     then
345 caltinay 4031 if [ ! -z $DO_BINARY ]
346 caltinay 3178 then
347     echo "No program to run was specified. Exiting."
348     exit 1
349     else
350 caltinay 4031 DO_INTERACTIVE=y
351 caltinay 3178 fi
352 jfenwick 2409 fi
353    
354 caltinay 4031 #==============================================================================
355     if [ ! -z $DO_XTERM ]
356 jfenwick 2409 then
357 caltinay 4031 EXEC_CMD="xterm -e"
358 jfenwick 2409 else
359 caltinay 4031 EXEC_CMD=""
360     fi
361    
362     if [ ! -z $DO_BINARY ]
363     then
364     EXEC_CMD="$EXEC_CMD $@"
365     else
366 caltinay 3178 # Check to see if the python version we were compiled with matches the
367     # one of PYTHON_CMD.
368 jfenwick 3892 compfull=`get_buildvar python_version`
369     compversion=`echo $compfull | cut -d. -f1,2`
370     compmajor=`echo $compfull | cut -d. -f1`
371 caltinay 4031 if [ "$PYTHON_CMD" = "python" ] # if people have customised the command they
372 jfenwick 3892 then # might not want us changing it
373     if [ "$compmajor" = "3" ]
374     then
375     PYTHON_CMD=python3
376     fi
377     fi
378     intversion=`$PYTHON_CMD -c 'from __future__ import print_function;import sys;print("%d.%d"%(sys.version_info[0], sys.version_info[1]))'`
379 caltinay 3178 if [ "$compversion" != "$intversion" ]
380     then
381     echo "Python versions do not match. Escript was compiled for "$compversion"."
382     echo "Current version of Python appears to be "$intversion"."
383     exit 1
384     fi
385 caltinay 2806 if [ "$MPI_FLAVOUR" = "none" ]
386 jfenwick 2409 then
387 caltinay 4031 if [ ! -z $DO_INTERACTIVE ]
388 jfenwick 2409 then
389 caltinay 4031 EXEC_CMD="$EXEC_CMD $PYTHON_CMD -i $@"
390 jfenwick 2409 else
391 caltinay 4031 EXEC_CMD="$EXEC_CMD $PYTHON_CMD $@"
392 jfenwick 2409 fi
393     else
394 caltinay 4031 if [ ! -z $DO_INTERACTIVE ]
395 gross 2865 then
396 caltinay 4031 EXEC_CMD="$EXEC_CMD $PYTHON_MPI -i $@"
397 gross 2865 else
398 caltinay 4031 EXEC_CMD="$EXEC_CMD $PYTHON_MPI $@"
399 gross 2865 fi
400 jfenwick 2409 fi
401     fi
402     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "Command to be executed is \"$EXEC_CMD\"."; fi
403 caltinay 4031 #==============================================================================
404 jfenwick 2409 #
405 caltinay 4031 # now we start to spawn things:
406 jfenwick 2409 #
407 jfenwick 3259 if [ "$WITH_OPENMP" = "1" ]
408 jfenwick 2409 then
409     export OMP_NUM_THREADS=$ESCRIPT_NUM_THREADS
410     EXPORT_ENV="$EXPORT_ENV,OMP_NUM_THREADS"
411     fi
412     EXIT_CODE=1
413     #=============== no MPI ===================================
414 caltinay 2806 if [ "$MPI_FLAVOUR" = "none" ]
415 jfenwick 2409 then
416     $EXEC_CMD
417     EXIT_CODE=$?
418     #=============== OpenMPI ===================================
419 caltinay 2806 elif [ "$MPI_FLAVOUR" = "OPENMPI" ]
420 jfenwick 2409 then
421     if [ ! -z $HOSTFILE ]
422     then
423     HOST_LIST=`awk 'BEGIN{S=""}{if (S == "") { S = $0 } else {S = S "," $0}}END{print S}' $HOSTFILE`
424 caltinay 4029 CMD="mpirun --gmca mpi_warn_on_fork 0 -x ${EXPORT_ENV//,/ -x } --bynode -np $TOTPROC --bind-to-socket --cpus-per-rank $ESCRIPT_NUM_THREADS --host $HOST_LIST $EXEC_CMD"
425 jfenwick 2409 else
426 caltinay 4029 CMD="mpirun --gmca mpi_warn_on_fork 0 -x ${EXPORT_ENV//,/ -x } --cpus-per-rank $ESCRIPT_NUM_THREADS -np $TOTPROC $EXEC_CMD"
427 jfenwick 2409 fi
428     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi
429     $CMD
430     EXIT_CODE=$?
431    
432     #=============== Intel MPI ===================================
433 caltinay 2806 elif [ "$MPI_FLAVOUR" = "INTELMPI" ]
434 jfenwick 2409 then
435 gross 2510
436 jfenwick 3259 if [ "$WITH_OPENMP" = "1" ]
437 gross 2510 then
438     export I_MPI_PIN_DOMAIN=omp
439     EXPORT_ENV="$EXPORT_ENV, I_MPI_PIN_DOMAIN"
440     fi
441    
442 jfenwick 2409 if [ ! -z $HOSTFILE ]
443     then
444     mpdboot -n $ESCRIPT_NUM_NODES -r ssh -f $HOSTFILE
445     if [ $? -ne 0 ]
446     then
447     echo "mpdboot with host file $ESCRIPT_HOSTFILE for $ESCRIPT_NUM_NODES nodes failed."
448     exit 1
449     else
450     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdboot was started with host file $ESCRIPT_HOSTFILE for $ESCRIPT_NUM_NODES nodes."; fi
451     fi
452 gross 2866 else
453     mpdboot -n 1 -r ssh
454     if [ $? -ne 0 ]
455     then
456     echo "mpdboot failed."
457     exit 1
458     else
459     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdboot was started."; fi
460     fi
461 jfenwick 2409 fi
462     CMD="mpiexec -perhost $ESCRIPT_NUM_PROCS -envall -n $TOTPROC $EXEC_CMD"
463     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi
464     $CMD
465     EXIT_CODE=$?
466 gross 2866 mpdallexit
467     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi
468 jfenwick 2409 #=============== SGI's MPIMPT ===================================
469 caltinay 2806 elif [ "$MPI_FLAVOUR" = "MPT" ]
470 jfenwick 2409 then
471     export MPI_NUM_MEMORY_REGIONS=0
472     EXPORT_ENV="$EXPORT_ENV,MPI_NUM_MEMORY_REGIONS"
473     if [ ! -z $HOSTFILE ]
474     then
475     HOST_LIST=`awk 'BEGIN{S=""}{if (S == "") { S = $0 } else {S = S "," $0}}END{print S}' $HOSTFILE`
476 gross 2866 CMD="mpirun $HOST_LIST -np $ESCRIPT_NUM_PROCS $EXEC_CMD"
477 jfenwick 2409 else
478     CMD="mpirun -np $TOTPROC $EXEC_CMD"
479     fi
480     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi
481     $CMD
482     EXIT_CODE=$?
483     #=============== MPICH ===================================
484 caltinay 2806 elif [ "$MPI_FLAVOUR" = "MPICH" ]
485 jfenwick 2409 then
486     if [ ! -z $HOSTFILE ]
487     then
488     touch $HOSTFILE2
489     for (( i=1;i<=$ESCRIPT_NUM_PROCS;i+=1 )) ; do cat $HOSTFILE >> $HOSTFILE2 ; done
490     CMD="mpirun -machinefile $HOSTFILE2 -np $TOTPROC $EXEC_CMD"
491     else
492     CMD="mpirun -np $TOTPROC $EXEC_CMD"
493     fi
494     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi
495     $CMD
496     EXIT_CODE=$?
497     #=============== MPICH2 ===================================
498 caltinay 2806 elif [ "$MPI_FLAVOUR" = "MPICH2" ]
499 jfenwick 2409 then
500     if [ ! -z $HOSTFILE ]
501     then
502     mpdboot -n $ESCRIPT_NUM_NODES -r ssh -f $HOSTFILE
503     if [ $? -ne 0 ]
504     then
505     echo "mpdboot with host file $ESCRIPT_HOSTFILE for $ESCRIPT_NUM_NODES nodes failed."
506     exit 1
507     else
508     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdboot was started with host file $ESCRIPT_HOSTFILE for $ESCRIPT_NUM_NODES nodes."; fi
509     fi
510 gross 2866 else
511     mpdboot -n 1 -r ssh
512     if [ $? -ne 0 ]
513     then
514     echo "mpdboot failed."
515     exit 1
516     else
517     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdboot was started."; fi
518     fi
519 jfenwick 2409 fi
520     CMD="mpiexec -genvlist $EXPORT_ENV -np $TOTPROC $EXEC_CMD"
521     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "MPI command is \"$CMD\"."; fi
522     $CMD
523     EXIT_CODE=$?
524 gross 2866 mpdallexit
525     if [ ! -z $ESCRIPT_VERBOSE ]; then echo "mpdallexit executed."; fi
526 jfenwick 2409 else
527 caltinay 2806 echo "unknown MPI flavour '$MPI_FLAVOUR'."
528 jfenwick 2409 fi
529     exit $EXIT_CODE
530 caltinay 4031

Properties

Name Value
svn:executable *
svn:mergeinfo /branches/lapack2681/bin/escript:2682-2741 /branches/pasowrap/bin/run-escript:3661-3674 /branches/py3_attempt2/bin/run-escript:3871-3891 /branches/restext/bin/escript:2610-2624 /branches/ripleygmg_from_3668/bin/run-escript:3669-3791 /branches/stage3.0/bin/escript:2569-2590 /branches/symbolic_from_3470/bin/run-escript:3471-3974 /branches/symbolic_from_3470/ripley/test/python/bin/run-escript:3517-3974 /release/3.0/bin/escript:2591-2601 /trunk/ripley/test/python/bin/run-escript:3480-3515

  ViewVC Help
Powered by ViewVC 1.1.26