#!/bin/sh
#
# run douar, on the p690
#
# Author: Douglas Guptill
# 2009-05-25: new

if test $# -lt 1 ; then
  echo "Usage: $0 <number-of-processors>"
  exit
fi

PROCS=$1
echo "Will use ${PROCS} processes."

make_dir() {
  if ! test -d $1;  then mkdir $1; fi
}

# For poe, set NLSPATH.
if test  "x${NLSPATH}" = x ; then
  export NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/%L/%N.cat
  echo "setting NLSPATH=${NLSPATH}"
fi
# The PGPLOT routines need this.
export PGPLOT_DIR=/home/beaumnt1/software/pgplot-5.2.2
# WSMP needs to know where its license file is.
export WSMPLICPATH=/home/beaumnt1/software/wsmp/wsmp.lic
# douar needs some directories..
make_dir DEBUG
make_dir DEBUG/mpilogs
make_dir OUT
# define the binary of douar
BIN=/home/beaumnt1/software/douar/douar
# How many processes to run?
# PROCS=4
# Here is the run command
COM="poe ${BIN} -procs ${PROCS} -hostfile ${HOME}/host.list -euilib ip"    
# start douar!
nohup ${COM} &
echo "douar has been started.  Look in nohup.out ."