#!/bin/ksh # $Id: mpirun.cqsub,v 1.11 2010/12/07 00:02:01 svasquez Exp $ ################################################################################ # This script abides to the ESMF script rules for executing the bundled test # and example applications. # # 1) -np N prog # runs N copies of executable "prog" in parallel. The script must hide all # of the system specific details, such as going through a queueing system # and/or calling a system specific mpirun script with modified arguments. # # 2) The output of the script must be written to a file named "prog".stdout and # it must contain the combination of stdout and stderr output of the # execution. # # 3) The script must block, i.e. _not_ return, until the output described in #2 # has become accessible. # # To access this script set environment variable ESMF_MPIRUN= in # your shell before executing any of the ESMF run targets or targets that # call run targets indirectly, such as the all_tests. ################################################################################ if [ "$1" != "-np" ] then echo "Usage: mpirun -np # prog" exit 1 fi num_procs=$2 prog=$3 working_dir=`pwd` shift 2 options=$* echo "exec cqsub -qdebug $ESMF_MPIBATCHOPTIONS -C $working_dir -n$num_procs -O $prog $prog" proc_id=`cqsub -qdebug $ESMF_MPIBATCHOPTIONS -C $working_dir -n$num_procs -O $prog $options` # Since this is not an interactive shell, wait for the job to complete. sleep 5 echo $proc_id > proc_id cqwait $proc_id sleep 30 mv $prog.output $prog.stdout