[Dart-dev] [6103] DART/branches/development/shell_scripts/shell_exit.sh: short script that can be used with mpi to actually

nancy at ucar.edu nancy at ucar.edu
Fri May 3 11:23:43 MDT 2013


Revision: 6103
Author:   nancy
Date:     2013-05-03 11:23:42 -0600 (Fri, 03 May 2013)
Log Message:
-----------
short script that can be used with mpi to actually
get an error exit code to stop the batch script and
indicate an error.  see in the comments for how to
use this in a batch script.

Added Paths:
-----------
    DART/branches/development/shell_scripts/shell_exit.sh

-------------- next part --------------
Added: DART/branches/development/shell_scripts/shell_exit.sh
===================================================================
--- DART/branches/development/shell_scripts/shell_exit.sh	                        (rev 0)
+++ DART/branches/development/shell_scripts/shell_exit.sh	2013-05-03 17:23:42 UTC (rev 6103)
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# some versions of LSF do not reliably return an exit code from
+# a serial section of a batch script, only the return from the 
+# last call to mpirun.lsf.  so to make a batch script really exit
+# in case of error, call this:
+# 
+#  setenv LSB_PJL_TASK_GEOMETRY "{(0)}"   # optional
+#  setenv EXITCODE -1
+#  mpirun.lsf shell_exit.sh
+#
+
+# if you call this inline with an arg:
+if [[ $# -gt 0 ]]; then
+   EXITCODE=$1
+fi
+
+# if you set an env var (the normal way to pass in
+# a value if using mpi):
+if [[ "$EXITCODE" == "" ]]; then
+   EXITCODE=0
+fi
+
+echo exiting with status code $EXITCODE
+exit $EXITCODE
+   


Property changes on: DART/branches/development/shell_scripts/shell_exit.sh
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author HeadURL Id
Added: svn:eol-style
   + native


More information about the Dart-dev mailing list