Page Tools


    MPI

    This plugin targets to support several (all?) MPI implementations. Currently, it supports MPICH1, MPICH2, and OpenMPI. However it is easy to add more MPI implementations as explain here.

    MPI Application Description

    The MPI application has to be described in an XML format.

    Simple example

    The most simple description is the following:

    <?xml version="1.0"?>
    <!DOCTYPE MPI_application>
    <MPI_application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../src/plugin/mpi/MPI_application.xsd">
     
    <mpi id='s1' binary='/home/cperez/simple' arguments='a1 b1' cardinality='6'/>
     
    </MPI_application>

    where:

    • s1 is an alphanumeric id of the application,
    • /home/cperez/simple is the full path of the binary,
    • a1 b1 are the argument parameters of the application,
    • 6 is the number of processes to launch.

    More advanced examples

    File tag

    It is possible to attach one or several files to an MPI program. By default, the file is of type data. Possible types are cfg, lib, so, data.

    <mpi id='an_appl' binary='/path/simple' arguments='file1 file2' cardinality='10' >
      <file id="f1">/scratch/file1</file>
      <file id="f2" type="lib">/data/libfile2.so</file>
    </mpi>

    The files are transfered to the working directory of the (remote) MPI program.

    Synchronous attribute

    By default, an MPI application is launched asynchronously: the mpirun command is launched in background mode. Hence ADAGE does not wait for the end of the application. It is possible to launch an application synchronously thanks to the attribute synchronous:

    <mpi id='s1' binary='/home/cperez/simple' arguments='a1 b1' cardinality='6'  synchronous='true' />

    This may be important when there are several MPI programs as explained hereafter.

    Multiple MPI programs

    It is possible to launch several MPI programs:

    <mpi id='s1' binary='/home/cperez/simple1' arguments='a1 b1' cardinality='8' />
    <mpi id='s2' binary='/home/cperez/simple2' arguments='x1' cardinality='6'/>

    In that case, the two programs are launched simultaneously. However it is possible to control their order thanks to the depend tag. For example, the following description launches simple2 after the end of simple1:

    <mpi id='s1' binary='/home/cperez/simple1' arguments='a1 b1' cardinality='8' synchronous='true' />
    <mpi id='s2' binary='/home/cperez/simple2' arguments='x1' cardinality='6'/>
     
    <depend what='s2'>
     <onwhat>s1</onwhat>
    </depend>

    Synchronizing asynchronous programs

    It is sometimes required to launch several programs asynchronously but with some temporal dependencies. For example, when a program acts as a server for another programs: usually the server has to be up before the client is launched. To solve this issue, the MPI plugin makes uses of the ADAGE mechanism that determines when the process is up. By default asynchronous processes are up when their pid is known. However, there exist other mechanisms as for example waiting for a particular file to be created. That is what the wait_file tag means.

    In the following example, s1 is launched first as s2 depends on s1. However, s1 is marked launched only when the file a_file_name will be created in the current working directory of s1. Then, s2 will be launched.

    <mpi id='s1' binary='/home/cperez/simple1' arguments='a1 b1' cardinality='8' >
      <wait_file>a_file_name</wait_file>
    </mpi>
    <mpi id='s2' binary='/home/cperez/simple2' arguments='x1' cardinality='6'/>
     
    <depend what='s2'>
     <onwhat>s1</onwhat>
    </depend>

    Note that is it up to the implementation of simple1 to generate this file. The file name is provided to the binary through the command line argument –ackfile a_file_name.

    Synchronizing asynchronous programs with data dependency

    It is sometimes required to pass the output of a program as a command line parameter of another program. The dump_file tag acts as the wait_file tag but it always send the content of that file to Adage. Such a content can be reused in a depending command thanks to the $$id$$ variable, where id is the id of the command.

    In the following example, the string $$s1$$ of the second command will be replaced by the content of the file a_file_name of the first command.

    <mpi id='s1' binary='/home/cperez/simple1' arguments='a1 b1' cardinality='8' >
      <dump_file>a_file_name</dump_file>
    </mpi>
    <mpi id='s2' binary='/home/cperez/simple2' arguments='x1 $$s1$$' cardinality='6'/>
     
    <depend what='s2'>
     <onwhat>s1</onwhat>
    </depend>

    Mixing MPI and sequential applications

    The language is a bit more capable than just launching simple MPI applications. It also supports launching sequential applications:

    <?xml version="1.0"?>
    <!DOCTYPE MPI_application>
    <MPI_application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../src/plugin/mpi/MPI_application.xsd">
    <command id='s2' binary='xclock'  cardinality='1' />
    <mpi id='s1' binary='/home/cperez/simple' arguments='a1' cardinality='6' />
    <mpi id='s3' binary='/home/cperez/simple' arguments='a1 a2 a3' cardinality='8' />
    </MPI_application>

    Because of the current XML Schema, please note that the document describe the _list_ of applications to launch, not the _order_. Hence, it is possible to specify the dependencies with the tag depend:

    <?xml version="1.0"?>
    <!DOCTYPE MPI_application>
    <MPI_application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../src/plugin/mpi/MPI_application.xsd">
     
    <command id='s2' binary='xclock'  cardinality='1' />
     
    <mpi id='s1' binary='/home/cperez/simple' arguments='a1' cardinality='6' />
    <mpi id='s3' binary='/home/cperez/simple' arguments='a1 a2 a3' cardinality='8' />
     
    <depend what='s2'>
     <onwhat>s1</onwhat>
    </depend>
    <depend what='s3'>
     <onwhat>s2</onwhat>
    </depend>
     
    </MPI_application>

    MPI XML Schema

    The last version is in the svn. Here a copy/paste from the MPI_application.xsd:

    <?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
     
    <xsd:element name="MPI_application">
    	<xsd:complexType>
    		<xsd:sequence>
    			<xsd:element name="command" minOccurs="0" maxOccurs="unbounded" type="generic_cmd_t"/>
    			<xsd:element name="mpi" minOccurs="0" maxOccurs="unbounded" type="generic_cmd_t"/>
    			<xsd:element name="depend" minOccurs="0" maxOccurs="unbounded" type="depend_t"/>
    		</xsd:sequence>
    	</xsd:complexType>
    </xsd:element>
     
    <xsd:complexType name="generic_cmd_t">
            <xsd:sequence>
    		<xsd:element name="wait_file" minOccurs="0" maxOccurs="1" type="xsd:string"/>
    		<xsd:element name="dump_file" minOccurs="0" maxOccurs="1" type="xsd:string"/>
    		<xsd:element name="file" minOccurs="0" maxOccurs="unbounded" type="file_t"/>
            </xsd:sequence>
    	<xsd:attribute name="id" type="xsd:ID" use="required"/>
    	<xsd:attribute name="binary" type="xsd:string" use="required"/>
    	<xsd:attribute name="arguments" type="xsd:string"/>
    	<xsd:attribute name="cardinality" type="xsd:integer"/>
    	<xsd:attribute name="synchronous" type="xsd:boolean" use="optional"/>
    </xsd:complexType>
     
    <xsd:complexType name="file_t">
    	<xsd:simpleContent>
    		<xsd:extension base="xsd:string">
    			<xsd:attribute name="id" type="xsd:string" use="optional"/>
    			<xsd:attribute name="type" type="xsd:string" use="optional"/>
    		</xsd:extension>
    	</xsd:simpleContent>
    </xsd:complexType>
     
    <xsd:complexType name="depend_t">
    	<xsd:sequence>
    		<xsd:element name="onwhat" type="xsd:IDREF" minOccurs="1" maxOccurs="unbounded"/>
    	</xsd:sequence>
    	<xsd:attribute name="what" type="xsd:IDREF" use="required"/>
    </xsd:complexType>
     
    </xsd:schema>

    Adding a new MPI implementation (developer)

    Two files have to be considered:

    • src/plugin/mpi/MPI_ctrl_params.xsd: add the new MPI implementation name in the definition of the type_t type. For example, here is the current version of this tag:
      <xsd:simpleType name="type_t">
      	<xsd:restriction base="xsd:string">
      		<xsd:enumeration value="mpich"/>
      		<xsd:enumeration value="mpich2"/>
      		<xsd:enumeration value="openmpi"/>
      	</xsd:restriction>
      </xsd:simpleType>
    • src/plugin/mpi/mpi-launcher.sh: add the required support for the considered MPI implementation. The goal of this script is to generate the machinefile file in the adequate format and to prepare the mpirun command.

    Note: it is not currently possible to pass specific parameters.


    Powered by Heliovista - Création site internet