head	1.3;
access;
symbols
	charm5_9:1.1;
locks; strict;
comment	@# @;


1.3
date	2005.11.06.08.25.47;	author gzheng;	state dead;
branches;
next	1.2;

1.2
date	2005.11.06.08.04.58;	author gzheng;	state Exp;
branches;
next	1.1;

1.1
date	2004.02.02.23.56.34;	author olawlor;	state Exp;
branches;
next	;


desc
@@


1.3
log
@ampirun is replaced by ampirun.in, which generates ampirun after running charm configure.
@
text
@#!/bin/sh
#
# Tiny wrapper around charmc for the "-np" MPI-style argument.

mfile=""
nodefile=""
charmarch=
opts=

# machinefile => nodelist
ConvertMachinefile()
{
  if test ! -f $mfile
  then
    echo "Error: $mfile not found!"
    exit 1
  fi
  nodefile="/tmp/.node.$$"
  echo 'group main ++shell "/usr/bin/ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o CheckHostIP=no -o BatchMode=yes"' > $nodefile
  nodes=`grep -v '^#' $mfile | awk -F: '{ print $1; }'`
  for node in $nodes
  do
    echo "host $node" >> $nodefile
  done
}

CharmArch()
{
bindir=`dirname $0`
test -f $bindir/.vdir && arch=`cat $bindir/.vdir`
if test x$arch = x
then
  echo "Unknown Charm architecture!"
  exit 1
elif `echo $arch | grep 'mpi-' > /dev/null 2>&1`
then
  charmarch="mpi"
elif `echo $arch | grep 'net-' > /dev/null 2>&1`
then
  charmarch="net"
fi
}

while [ ! $# -eq 0 ]
do
  arg="$1"
  case "$arg" in
  -np)
     shift
     nPE=$1
     shift
     ;;
  -machinefile)
     shift
     mfile=$1
     shift
     ;;
  *)
     break
     ;;
  esac
done

if test x$mfile = x
then
mfile=$PBS_NODEFILE
fi

if test x$mfile != x
then
  CharmArch
  if test "$charmarch" = "net"
  then
    ConvertMachinefile
    opts="$opts ++nodelist $nodefile"
  elif test "$charmarch" = "mpi"
  then
    opts="$opts -machinefile $mfile"
  fi
fi

echo charmrun +p$nPE "$@@" $opts
charmrun +p$nPE "$@@" $opts

@


1.2
log
@improve ampirun to be compatible with mpirun in -np and -machinefile.
@
text
@@


1.1
log
@added tiny file to eat "-np" arguments.
@
text
@d5 79
a83 5
# delete our "-np" argument
shift
nPE=$1
shift
charmrun +p$nPE "$@@"
@

