LSF Version 7.3 - Using Platform LSF HPC

# - capture the result of tping and test for success before proceeding
# - exits with the "requeue" exit value if pre-execution setup failed
# ----------------------------------------------------
#
LAM_MPI_SOCKET_SUFFIX="${LSB_JOBID}_${LSB_JOBINDEX}"
export LAM_MPI_SOCKET_SUFFIX
echo $LAMBOOT_CMD $LAMHOST_FILE >>$LOGFILE
$LAMBOOT_CMD $LAMHOST_FILE >>$LOGFILE 2>&1
echo $TPING_CMD h -c 1 >>$LOGFILE
$TPING_CMD N -c 1 >>$LOGFILE 2>&1
EXIT_VALUE="$?"
if [ "$EXIT_VALUE" = "0" ]; then
#
# -----------------------------------------------------
# Run the parallel job launcher:
# - log the action
# - trap the exit value
# ----------------------------------------------------
#
#call mpirun -np # a.out
echo "Your command line looks like:" >> $LOGFILE
echo $LAMMPIRUN_CMD $LAMMPI_OPTS -v C $CMD_LINE >> $LOGFILE
$LAMMPIRUN_CMD $LAMMPI_OPTS -v C $CMD_LINE
EXIT_VALUE=$?
#
# -----------------------------------------------------
# Post-execution steps required by LAMMPI:
# - run lamhalt
# - log the action
# ----------------------------------------------------
#
echo $LAMHALT_CMD >>$LOGFILE
$LAMHALT_CMD >>$LOGFILE 2>&1
fi
#
# -----------------------------------------------------
# Clean up after running this script:
# - delete the hosts file we created
# - log the end of the job
# - log the exit value of the job
# ----------------------------------------------------
#
# cleanup temp and conf file then exit
rm -f $LAMHOST_FILE
echo "Job<${DISPLAY_JOBID}> exits with exit value $EXIT_VALUE." >>$LOGFILE 2>&1
# To support multiple jobs inside one job script
# Sleep one sec to allow next lamd start up, otherwise tping will return error
sleep 1