<DiagnosticTests>
  <DiagnosticTest
    Name="MPI Pi Calculation with C# PreStep"
    Description="Verify that the compute cluster can run an MPI job which approximates the value of Pi"
    Company="Microsoft"
    Suite="Samples"
    Alias="MPIPiCalcCS"
  >
    <!-- Give the parameters unique fixed-length SwitchNames so the PreStep parser can strip the data very easily. -->
    <!-- e.g. from -sn01:4 -sn02:1000000 you can slurp 4 and 1000000 at string index 6 of each parameter. -->
    <Parameters>
      <Parameter
        Name="NumMPIProcesses"
        SwitchName="sn01"
        Type="Integer"
        Description="The number of processes to launch with MPI"
        DefaultValue="6"
        MinimumValue="1"
        MaximumValue="1000000000"
        UseOnlyInStep="PreStep"/>
      <Parameter
        Name="NumIntervals"
        SwitchName="sn02"
        Type="String"
        Description="The number of intervals to use to approximate the value of Pi"
        DefaultValue="1E9"
        UseOnlyInStep="PreStep"/>
    </Parameters>
    <!-- Call the PreStep C# application "\\hpcHead\C$\Diag\MPIPiCalculation\prestep-cs.exe" to parse the parameters and add an MPI-based task to the diagnostic job. -->
    <!-- The C# app is passed 9 parameters: -->
      <!-- The first 7 parameters are defined in the prestep command string below: -->
        <!-- 0: %CCP_SCHEDULER% is the name of the head node, e.g. hpcHead. -->
        <!-- 1: %DIAG_RUNSTEP_JOBID% is the id of the job which the diagnostic has initialized for this test. -->
        <!-- 2: %DIAG_NODELIST% is the comma delimited list of compute nodes set up by the user for the job. -->
        <!-- 3: "\\%CCP_SCHEDULER%\C$\Diag\MPIPiCalculation" is the path to the working folder for the task, e.g. "\\hpcHead\Diag\MPIPiCalculation". -->
        <!-- 4: "{0} -n {2:d} {1} {3}" is the C# format string for the task command line. The C# app will strip the leading and trailing double quotes before formatting. -->
        <!-- 5: "mpiexec.exe" is the string input for format parameter {0} of the C# task command line string. -->
        <!-- 6: "picalc-cs-mpi.exe" is the string input for format parameter {1} of the C# task command line string. -->
      <!-- The last 2 parameters are defined in the xml above and are appended automatically to the prestep command string by the diagnostic run: -->
        <!-- 7: The NumMPIProcesses -name:value string, e.g. -sn01:4. The C# app will slurp the integer value, e.g. 4, into a local variable and use it for format parameter {2:d} of the C# task command line string. -->
        <!-- 8: The NumIntervals -name:value string, e.g. -sn02:1000000. The C# app will slurp the string value, e.g. 1000000, into a local variable and use it for format parameter {3} of the C# task command line string. -->
      <!-- e.g. "\\hpcHead\C$\Diag\MPIPiCalculation\prestep-cs.exe" hpcHead 97 hpcHead,hpcNode01,hpcNode02 "\\hpcHead\C$\Diag\MPIPiCalculation" "{0} -n {1:d} {2} {3}" "mpiexec.exe" "picalc-cs-mpi.exe". -->
    <PreStep Command="&quot;\\%CCP_SCHEDULER%\C$\Diag\MPIPiCalculation\prestep-cs.exe&quot; %CCP_SCHEDULER% %DIAG_RUNSTEP_JOBID% %DIAG_NODELIST% &quot;\\%CCP_SCHEDULER%\C$\Diag\MPIPiCalculation&quot; &quot;{0} -n {2:d} {1} {3}&quot; &quot;mpiexec.exe&quot; &quot;picalc-cs-mpi.exe&quot;">
    </PreStep>
    <!-- There is no need to define a RunStep in this case. The PreStep adds a task to the job. The diagnostic run will submit the job in the RunStep. -->
  </DiagnosticTest>
</DiagnosticTests>
