#!/bin/sh
# 
# EXAMPLE OPEN MPI SCRIPT FOR SGE
# Modified by Basement Supercomputing 1/2/2006 DJE
# To use, change "OMPI_JOB", "NUMBER_OF_CPUS" 
# and "OMPI_PROGRAM_NAME" to real values. 
#
# Your job name 
#$ -N OMPI_JOB
#
# Use current working directory
#$ -cwd
#
# Join stdout and stderr
#$ -j y
#
# pe request for MPICH. Set your number of processors here. 
# Make sure you use the "mpich" parallel environemnt.
#$ -pe ompi NUMBER_OF_CPUS 
#
# Run job through bash shell
#$ -S /bin/bash
#
# The following is for reporting only. It is not really needed
# to run the job. It will show up in your output file.
echo "Got $NSLOTS processors."
echo "Machines:"
cat $TMPDIR/machines
#
# These exports needed for OpenMPI, when using the command line
# these are set with the modules command, but with SGE scripts
# we assume nothing!
export PATH=/opt/mpi/tcp/openmpi-gnu3/bin/:$PATH
export LD_LIBRARY_PATH=/opt/mpi/tcp/openmpi-gnu3/lib:$LD_LIBRARY_PATH
export OMPI_MCA_pls_rsh_agent=rsh

# Use full pathname to make sure we are using the right mpirun
# Need to use prefix for nodes
/opt/mpi/tcp/ompi-gnu3/bin/mpirun --prefix /opt/mpi/tcp/openmpi-gnu3/ -np $NSLOTS -machinefile $TMPDIR/machines OMPI_PROGRAM_NAME


