File: mpy-sh

package info (click to toggle)
yorick 2.2.03+dfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 9,620 kB
  • ctags: 9,317
  • sloc: ansic: 85,521; sh: 1,665; cpp: 1,282; lisp: 1,234; makefile: 1,034; fortran: 19
file content (47 lines) | stat: -rwxr-xr-x 1,284 bytes parent folder | download | duplicates (10)
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
#!/bin/sh

# ------------------------------------------------------------------------
# Only need to change these two lines to make this script work
# with any MPY-based program.
prog=mpy
maxprocesses=28

# Reverse comments to get LAM or MPICH mpirun
# These you may need to change as you move from one MPI environment to
# another, but not from one MPY-derived program to another in a single
# MPI environment.
np_option=-np     # MPICH
sep=              # MPICH
#np_option="-w -c" # LAM
#sep=--            # LAM

# ------------------------------------------------------------------------

# This script calls mpirun if the -np option appears on the command line,
# otherwise, it adds the -nompi argument and just starts mpy.
# To run with all maxprocesses processors, use the -npx option.
# If you need to pass other arguments to mpirun, list them all first,
# and follow them by -- followed by zero or more arguments to mpy.

args=
mpiargs=
np=

while [ $# -gt 0 ]
do
  case $1 in
    -np)    shift; np=$1;;
    -npx)   np=$maxprocesses;;
    -nompi) ;;
    --)     mpiargs="$args"; args=;;
    *)      args="$args $1";;
  esac
  shift
done

case "X$np" in
  X)    args="-nompi $args";;
  *)    args="$np_option $np $mpiargs $prog $sep $args"; prog=mpirun;;
esac

exec $prog $args