Bug 540578 - Updates to LSF support

Change-Id: I43622b58d493782be30ee8ce10ad19617398c397
Signed-off-by: Greg Watson <g.watson@computer.org>
diff --git a/rms/org.eclipse.ptp.rm.ibm.platform.lsf.ui/data/com.ibm.platform.lsf.xml b/rms/org.eclipse.ptp.rm.ibm.platform.lsf.ui/data/com.ibm.platform.lsf.xml
index a8e8382..f8d10c5 100644
--- a/rms/org.eclipse.ptp.rm.ibm.platform.lsf.ui/data/com.ibm.platform.lsf.xml
+++ b/rms/org.eclipse.ptp.rm.ibm.platform.lsf.ui/data/com.ibm.platform.lsf.xml
@@ -25,7 +25,7 @@
 		</attribute>

 		<attribute name="mpiCommand" type="choice">

 			<description>Optional MPI command to run job:</description>

-			<choice>,poe,mpiexec,mpirun</choice>

+			<choice>,poe,mpiexec,mpirun,jsrun</choice>

 		</attribute>

 

 		<!-- -ar option -->

@@ -465,6 +465,12 @@
                 </error-message>

 			</validator>

 		</attribute>

+				

+		<!-- MPI run command (mpirun/jsrun) options -->

+		<attribute name="MPI_OPTIONS" type="string">

+			<description>MPI Runtime Options:</description>

+			<tooltip>Specifies options to the MPI application invocation command.</tooltip>

+		</attribute>

 

 		<!-- Other options -->

 		<attribute name="LSF_OTHER_OPTIONS" type="string">

@@ -475,7 +481,7 @@
 		<attribute name="LSF_MPI_COMMAND" type="choice">

 			<description>MPI Command:</description>

 			<tooltip>Specifies an optional MPI command to run job.</tooltip>

-			<choice>,poe,mpiexec,mpirun</choice>

+			<choice>,poe,mpiexec,mpirun,jsrun</choice>

 		</attribute>

 

 		<script insertEnvironmentAfter="0" deleteAfterSubmit="true">

@@ -658,6 +664,7 @@
 			</line>

 			<line>

 				<arg>${ptp_rm:LSF_MPI_COMMAND#value}</arg>

+				<arg>${ptp_rm:MPI_OPTIONS#value}</arg>

 				<arg>${ptp_rm:executablePath#value}</arg>

 				<arg>${ptp_rm:progArgs#value}</arg>

 			</line>

@@ -1175,6 +1182,24 @@
 						<tooltip>${ptp_rm:LSF_MPI_COMMAND#tooltip}</tooltip>

 					</widget>

 

+					<!-- MPI_OPTIONS command line options for mpirun or jsrun -->

+					<widget type="label" style="SWT.LEFT">

+						<layout-data>

+							<grid-data horizontalAlign="SWT.BEGINNING"

+								grabExcessHorizontal="false" />

+						</layout-data>

+						<fixed-text>${ptp_rm:MPI_OPTIONS#description}

+						</fixed-text>

+					</widget>

+

+					<widget type="text" attribute="MPI_OPTIONS" style="SWT.BORDER">

+						<layout-data>

+							<grid-data horizontalAlign="SWT.BEGINNING"

+								grabExcessHorizontal="false" widthHint="300" horizontalSpan="2" />

+						</layout-data>

+						<tooltip>${ptp_rm:MPI_OPTIONS#tooltip}</tooltip>

+					</widget>

+					

 					<!-- LSF_OTHER_OPTIONS: Other LSF bsub options -->

 					<widget type="label" style="SWT.LEFT">

 						<layout-data>

diff --git a/rms/org.eclipse.ptp.rm.ibm.platform.lsf.ui/data/com.ibm.platform.lsf_interactive.xml b/rms/org.eclipse.ptp.rm.ibm.platform.lsf.ui/data/com.ibm.platform.lsf_interactive.xml
index ace80b6..47f12ab 100644
--- a/rms/org.eclipse.ptp.rm.ibm.platform.lsf.ui/data/com.ibm.platform.lsf_interactive.xml
+++ b/rms/org.eclipse.ptp.rm.ibm.platform.lsf.ui/data/com.ibm.platform.lsf_interactive.xml
@@ -25,7 +25,7 @@
 		</attribute>

 		<attribute name="mpiCommand" type="choice">

 			<description>Optional MPI command to run job:</description>

-			<choice>,poe,mpiexec,mpirun</choice>

+			<choice>,poe,mpiexec,mpirun,jsrun,mpirun,jsrun</choice>

 		</attribute>

         <attribute name="LSF_MPI_TASK_COUNT" type="integer">

             <link-value-to>mpiNumberOfProcesses</link-value-to>

@@ -449,7 +449,7 @@
 		<attribute name="LSF_MPI_COMMAND" type="choice">

 			<description>MPI Runtime:</description>

 			<tooltip>Specifies the parallel runtime environment to run the job.</tooltip>

-			<choice>,Parallel Environment,Platform MPI,Open MPI,MPICH2</choice>

+			<choice>,Parallel Environment,Platform MPI,Open MPI,MPICH2,IBM Spectrum MPI (mpirun),IBM Spectrum MPI (jsrun)</choice>

 		</attribute>

 		

 		<!-- Number of MPI tasks in the application. Needed so the debugger UI knows the task count -->

diff --git a/rms/org.eclipse.ptp.rm.lml.da/rms/LSF/run_lsf_interactive.pl b/rms/org.eclipse.ptp.rm.lml.da/rms/LSF/run_lsf_interactive.pl
index ba9d31b..5b7b8e6 100644
--- a/rms/org.eclipse.ptp.rm.lml.da/rms/LSF/run_lsf_interactive.pl
+++ b/rms/org.eclipse.ptp.rm.lml.da/rms/LSF/run_lsf_interactive.pl
@@ -70,6 +70,20 @@
              "mpirun", "-np", $ENV{'LSF_MPI_TASK_COUNT'}, @MPIArgs,
              $ENV{'PTP_APP_EXEC_PATH'}, @runArgs);
     }
+    elsif ($MPI_Command eq 'IBM Spectrum MPI (mpirun)') {
+        @runArgs = split(/ +/, $ENV{'PTP_APP_EXEC_ARGS'});
+        @MPIArgs = split(/ +/, $ENV{'LSF_MPI_OPTIONS'});
+        exec("/usr/bin/perl", "$PTP_Directory/rms/MPICH2/start_job.pl",
+             "mpirun", "-np", $ENV{'LSF_MPI_TASK_COUNT'}, @MPIArgs,
+             $ENV{'PTP_APP_EXEC_PATH'}, @runArgs);
+    }
+    elsif ($MPI_Command eq 'IBM Spectrum MPI (jsrun)') {
+        @runArgs = split(/ +/, $ENV{'PTP_APP_EXEC_ARGS'});
+        @MPIArgs = split(/ +/, $ENV{'LSF_MPI_OPTIONS'});
+        exec("/usr/bin/perl", "$PTP_Directory/rms/MPICH2/start_job.pl",
+             "jsrun", "-p", $ENV{'LSF_MPI_TASK_COUNT'}, @MPIArgs,
+             $ENV{'PTP_APP_EXEC_PATH'}, @runArgs);
+    }
     else {
         exec($ENV{'SHELL'}, '-l');
     }