#!/bin/sh
######################################################################
#
# $Id: smooth20-2d.sh 265 2006-12-18 22:50:58Z cary $
#
# Purpose:	See smooth20.pre
#
# INCITE7 collaboration
#
######################################################################

##########
#
# SP job submission information
#
##########
#@ job_name             = smooth20-2d
#@ account_no           = incite7
#@ output               = smooth20-2d.out
#@ error                = smooth20-2d.err
#@ class                = regular
#                       interactive, debug, premium, regular, regular_long
#       see     http://hpcf.nersc.gov/running_jobs/ibm/batch.html#class
#@ job_type             = parallel
#                       parallel or serial
#@ environment          = COPY_ALL
#                       use all environment variables from my shell
#@ notification         = complete
#                       start always error
#@ network.MPI          = csss,not_shared,us
#                       do not change
#@ node_usage           = not_shared
#
#@ tasks_per_node       = 16
#@ node                 = 128
# wall_clock_limit     = 04:30:00
# wall_clock_limit     = 06:00:00
#                       for 2000 steps
#@ wall_clock_limit     = 07:00:00
#
#@ queue
#               End of queuing commands.
# Submit via:
# llsubmit smooth20-2d.sh
#
# Examine via:
# llqs

##########
#
# PBS job submission information
#
##########
#PBS -N smooth20
# Standard out, error
#PBS -o smooth20-2d.out
#PBS -e smooth20-2d.err
# Export all environment variables to the job
#PBS -V
# Email results
#PBS -m abe
# STORAGE2
#PBS -l nodes=12:ppn=2,walltime=2:00:00
#PBS -q opt12
# CARUS
##PBS -l nodes=7:ppn=2,walltime=3:00:00
# JACQUARD
##PBS -l nodes=8:ppn=2,walltime=2:00:00
##PBS -A incite7
##PBS -q batch

##########
#
# Get options
#
##########
while test -n "$1"; do
  case "$1" in
    -s | -sh)
      OPTS="$OPTS $1"
      shift
      ;;
  esac
done

##########
#
# If on PBS, get to correct directory
#
##########
if test -n "$PBS_O_WORKDIR"; then
  cd $PBS_O_WORKDIR
fi

##########
#
# Get location of vputils.
#
##########
# One must have run vpsetup.sh in ../.. for this to work.
if test ! -f ../../path.sh; then
    echo "Can't find ../../path.sh. Exiting."
    exit 1
fi
. ../../path.sh

##########
#
# Create the input file
#
##########
./smooth20.pre --ndim=2
if test $? != 0; then
  echo Input file could not be made
  exit
fi

##########
#
# 35000 steps
#
###########
sh -c -x "$VPUTILSDIR/runvorpal.sh $OPTS -i smooth20.in -np 4 -dim 2 -n 500 -d 500 -sd -o smooth20-2d"

res=$?
echo runvorpal.sh finished with result $res
exit $res

