Changed the interOperate to a global variable so that it is initialized from
[charm.git] / src / arch / mpi-bluegeneq / charmrun
1 #!/bin/sh
2 #
3 # Conv-host for Blue Gene:
4 #  Translates +pN-style conv-host options into 
5 # mpirun -npN options.
6 #  Copies executable to $BL_HOME directory before running.
7 #
8 # You MUST have a copy of MMCS running in another terminal window.
9 #
10
11 if [ -z "$BL_HOME" ]
12 then
13         echo "You must set the BL_HOME environment variable"
14         exit 1
15 fi
16
17 firstArg=""
18 args=""
19 pes=1
20
21 while [ $# -gt 0 ]
22 do
23         case $1 in
24         +p)
25                 pes=$2
26                 shift
27                 ;;
28         +p*)
29                 pes=`echo $1 | awk '{print substr($1,3)}'`
30                 ;;
31         *) 
32                 [ -z "$firstArg" ] && firstArg="$1"
33                 args="$args $1"
34                 ;;
35         esac
36         shift
37 done
38
39 if [ $firstArg -nt $BL_HOME/$firstArg ]
40 then
41   echo "Copying $firstArg to $BL_HOME..."
42   cp $firstArg $BL_HOME 
43   [ $? -ne 0 ] && exit 1
44 fi
45
46 echo "Running on $pes processors: $args"
47 exec /BlueLight/bin/CIORUN -p $pes $args