<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>InfolabClusterComputeHowtoMpi</title><revhistory><revision><revnumber>3</revnumber><date>2012-10-17 02:45:36</date><authorinitials>akrevl</authorinitials></revision><revision><revnumber>2</revnumber><date>2012-10-17 02:45:14</date><authorinitials>akrevl</authorinitials></revision><revision><revnumber>1</revnumber><date>2012-10-17 02:40:16</date><authorinitials>akrevl</authorinitials></revision></revhistory></articleinfo><para>This HOWTO describes how to run an MPI job on the cluster. Wikipedia would call this article a stub. As I have very little experience with running MPI jobs, I am more or less pasting the script from <ulink url="http://csc.cnsi.ucsb.edu/docs/running-jobs-torque"/>. </para><section><title>The submission script</title><programlisting format="linespecific" language="highlight" linenumbering="numbered" startinglinenumber="1"><lineannotation><![CDATA[#!/bin/bash]]></lineannotation>
<lineannotation></lineannotation><lineannotation><![CDATA[#PBS -l nodes=2:ppn=4]]></lineannotation>
<lineannotation></lineannotation>
<lineannotation><![CDATA[# Make sure that we are in the same subdirectory as where the qsub command ]]></lineannotation>
<lineannotation></lineannotation><lineannotation><![CDATA[# is issued. ]]></lineannotation>
<lineannotation></lineannotation><token><![CDATA[cd]]></token><![CDATA[ ]]><methodname><![CDATA[$PBS_O_WORKDIR]]></methodname><![CDATA[ ]]>

<lineannotation><![CDATA[#  make a list of allocated nodes(cores)]]></lineannotation>
<lineannotation></lineannotation><![CDATA[cat ]]><methodname><![CDATA[$PBS_NODEFILE]]></methodname><![CDATA[ > nodes]]>

<lineannotation><![CDATA[# How many cores total do we have?]]></lineannotation>
<lineannotation></lineannotation><methodname><![CDATA[NO_OF_CORES]]></methodname><![CDATA[=]]><phrase><![CDATA[`]]></phrase><![CDATA[cat ]]><methodname><![CDATA[$PBS_NODEFILE]]></methodname><![CDATA[ | egrep -v ]]><phrase><![CDATA['^#']]></phrase><![CDATA[\|]]><phrase><![CDATA['^$']]></phrase><![CDATA[ | wc -l | awk ]]><phrase><![CDATA['{print $1}']]></phrase><phrase><![CDATA[`]]></phrase>
<methodname><![CDATA[NODE_LIST]]></methodname><![CDATA[=]]><phrase><![CDATA[`]]></phrase><![CDATA[cat ]]><methodname><![CDATA[$PBS_NODEFILE]]></methodname><![CDATA[ ]]><phrase><![CDATA[`]]></phrase>

<lineannotation><![CDATA[# Just for kicks, see which nodes we got.]]></lineannotation>
<lineannotation></lineannotation><token><![CDATA[echo]]></token><![CDATA[ ]]><methodname><![CDATA[$NODE_LIST]]></methodname>

<lineannotation><![CDATA[# Run the executable. *DO NOT PUT* a '&' at the end!!]]></lineannotation>
<lineannotation></lineannotation><![CDATA[mpirun -np ]]><methodname><![CDATA[$NO_OF_CORES]]></methodname><![CDATA[ -machinefile nodes ./pi3 >& log ]]>
</programlisting></section></article>