Message Passing Interface, CCR, DSS, y Pure MPI.NET

En estos días, estuve investigando algo sobre grid computing y Microsoft Robotics Studio, usando DSS y CCR. Encontré un interesante documento:

High Performance Multi-Paradigm Messaging Runtime Integrating Grids and Multicore Systems

Los autores son Xiaohong Qiu, Geoffrey C. Fox, Huapeng Yuan, Seung-Hee Bae, de la Indiana University de Bloomington, y George Chrysanthakopoulos, Henrik Frystyk Nielsen, de Microsoft Research. Nielsen y Chrysanthakopoulos son los “creadores” del Concurrency and Coordination Runtime (CCR) y de Decentralized Software Services (DSS), tecnologías que son pilares de Microsoft Robotics Studio, y que pueden ser usandas más allá de robótica. Más información sobre estas tecnologías en:

http://www.microsoft.com/robotics

El “abstract” del documento dice:

eScience applications need to use distributed Grid environments where each component is an individual or cluster of multicore machines. These are expected to have 64-128 cores 5 years from now and need to support scalable parallelism. Users will want to compose heterogeneous components into single jobs and run seamlessly in both distributed fashion and on a future “Grid on a chip” with different subsets of cores supporting individual components. We support this with a simple programming model made up of two layers supporting traditional parallel and Grid programming paradigms (workflow) respectively. We examine for a parallel clustering application, the Concurrency and Coordination Runtime CCR from Microsoft as a multi-paradigm runtime that integrates the two layers. Our work uses managed code (C#) and for AMD and Intel processors shows around a factor of 5 better performance than Java. CCR has MPI pattern and dynamic threading latencies of a few microseconds that are competitive with the performance of standard MPI for C.

¿Que es MPI? Son las siglas de Message Passing Interface. Según la Wikipedia:

Message Passing Interface (MPI) is both a computer specification and is an implementation that allows many computers to communicate with one another. It is used in computer clusters.

Hay una There is a implementación de Microsoft:

Microsoft Message Passing Interface (MS MPI) is an implementation of the MPI2 specification by Microsoft for use in Windows Compute Cluster Server to interconnect and communicate (via messages) between High performance computing nodes. It is mostly compatible with the MPICH2 reference implementation, with some exceptions for job launch and management. MS MPI includes bindings for C and FORTRAN languages. It supports using the Microsoft Visual Studio for debugging purposes.

Gua! FORTRAN….. Esos buenos viejos días! ;-). Recuerdo haber trabajado con la implementación de Lisp en Fortran del bueno de Gregory Chaitin, en el siglo pasado. Pero no hay vuelta atrás, parafraseando a David Hilbert: Nadie nos expulsará del paraiso que Java y .NET han creado para nosotros…. ;-). Pueden leer la cita original en este interesante thread.

Pero estoy divagando. Volvamos al tema.

Los principales sitios sobre MPI son:

http://www.mpi-forum.org/
http://www.open-mpi.org/
http://www.lam-mpi.org/

Yo estaba pensando en implementar algo de las ideas de MPI en .NET o Java, cuando encuentro:

http://www.purempi.net/

PureMpi.NET is a completely managed implementation of the message passing interface. The object-oriented API is simple, and easy to use for parallel programming. It has been developed based on the latest .NET technologies, including Windows Communication Foundation (WCF). This allows you to declaratively specify the binding and endpoint configuration for your environment, and performance needs. When using the SDK, a programmer will definitely see the MPI’ness of the interfaces come through, and will enjoy taking full advantage of .NET features – including generics, delegates, asynchronous results, exception handling, and extensibility points.

PureMpi.NET allows you to create high performance production quality parallel systems, with all the benefits of in .NET

Es una implementación lista para bajar y usar, con VS 2005 o VS 2008. Usa generics para implementar canales tipados en MPI.

Me bajé la librería, y la instalé en una máquina con Visual Studio 2008. El programa de instalación agregó un nuevo template de proyecto, Mpi.NET:

Cree un proyecto, que aparece:

Modifiqué el Program.cs a:

 

using System; using System.Collections.Generic; using System.Linq; using System.Text; using Mpi; namespace Mpi.NET1 { class Program { static void Main(string[] args) { ProcessorGroup.Process("MPIEnvironment", delegate(IDictionary<string, Comm> comms) { Comm comm = comms["MPI_COMM_WORLD"]; Console.WriteLine(comm.Rank); IAsyncResult result = comm.BeginSend<string>(0, "", "Rank: " + comm.Rank, TimeSpan.FromSeconds(30), null, null); if (comm.Rank == 0) { for (int i = 0; i < comm.Size; i++) { string receivedMsg = comm.Receive<string>(i, Constants.AnyTag, TimeSpan.FromSeconds(30)); Console.WriteLine(receivedMsg); } } comm.EndSend<string>(result); }); } } }

La clase ProcessGroup se encarga de los procesos a ejecutar. Notar el uso de delegados para especificar el proceso. Un proceso MPI recibe un diccionario de objetos Comm, que son los canales para comunicarse con otros procesos MPI.

La clase ProcessGroup tiene esta estructura (según la información de metadata):

 

namespace Mpi { public class ProcessorGroup : IDisposable { public ProcessorGroup(Environment environment, Processor processor); public ProcessorGroup(string environment, Processor processor); public Environment Environment { get; } public ICollection<IAsyncResult> Results { get; } public void Dispose(); protected virtual void Dispose(bool disposing); public static void Process(string environmentConfigName, Processor processor); public void Start(); public void WaitForCompletion(); } }

El número y configuración de procesadores puede ser definida en el archivo App.config:

 

<?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="Mpi" type="Mpi.ConfigurationSection, Mpi"/> </configSections> <Mpi> <Environments> <Environment name="MPIEnvironment"> <Hosts> <Host comms="MPI_COMM_WORLD" client="MpiClient1" service="MpiService1" /> <Host comms="MPI_COMM_WORLD" client="MpiClient2" service="MpiService2"/> <Host comms="MPI_COMM_WORLD" client="MpiClient3" service="MpiService3"/> </Hosts> </Environment> </Environments> </Mpi> <system.serviceModel> <client> <endpoint address="net.tcp://localhost:8080/MpiService" binding="netTcpBinding" bindingConfiguration="" contract="Mpi.IMpiService" name="MpiClient1"> <identity> <userPrincipalName value="" /> </identity> </endpoint> <endpoint address="net.tcp://localhost:8081/MpiService" binding="netTcpBinding" bindingConfiguration="" contract="Mpi.IMpiService" name="MpiClient2"> <identity> <userPrincipalName value="" /> </identity> </endpoint> <endpoint address="net.tcp://localhost:8082/MpiService" binding="netTcpBinding" bindingConfiguration="" contract="Mpi.IMpiService" name="MpiClient3"> <identity> <userPrincipalName value="" /> </identity> </endpoint> </client> <behaviors> <serviceBehaviors> <behavior name="MpiServiceBehavior"> <serviceDebug httpHelpPageEnabled="false" httpsHelpPageEnabled="false" includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> </behaviors> <services> <service behaviorConfiguration="MpiServiceBehavior" name="MpiService1"> <endpoint address="net.tcp://localhost:8080/MpiService" binding="netTcpBinding" bindingConfiguration="" name="MpiServiceEndpoint" contract="Mpi.IMpiService" /> </service> <service behaviorConfiguration="MpiServiceBehavior" name="MpiService2"> <endpoint address="net.tcp://localhost:8081/MpiService" binding="netTcpBinding" bindingConfiguration="" name="MpiServiceEndpoint" contract="Mpi.IMpiService" /> </service> <service behaviorConfiguration="MpiServiceBehavior" name="MpiService3"> <endpoint address="net.tcp://localhost:8082/MpiService" binding="netTcpBinding" bindingConfiguration="" name="MpiServiceEndpoint" contract="Mpi.IMpiService" /> </service> </services> </system.serviceModel> <system.runtime.serialization> <dataContractSerializer> <declaredTypes> </declaredTypes> </dataContractSerializer> </system.runtime.serialization> </configuration>


Jeje, usan <host..>…  Me recuerda a AjMessages;-)


La ejecución de programa produce:



Bueno, no vamos a decir “Huy, que bruto que programa”, pero es mi primer programa MPI. Hay 3 “ranks”, porque así esta configurado en el archivo de arriba.


Encontran varios ejemplos ejecutables en la distribución de Pure MPI.NET. En mi opinión, es una interesante implementación de ideas de MPI, con algunas vueltas de tuerca adaptadas al mundo .NET: generics y delegates , bienvenidos.


¿Grid y MPI? Puede ser. Tengo que estudiar las referencias mencionadas en el “paper” que nombré al principio. Aunque ese trabajo está dedicado a cuestiones de alto rendimiento, tiene un buen resumen conceptual de los modelos de ejecución, y las relaciones posibles entre MPI, CCR, y DSS.


(Había publicado este artículo en “anglish”, Angel’s English, en:
Message Passing Interface, CCR, DSS, and Pure MPI.NET
)


Nos leemos!


Angel “Java” Lopez
http://www.ajlopez.com

This entry was posted in 1389, 6149. Bookmark the permalink.

One Response to Message Passing Interface, CCR, DSS, y Pure MPI.NET

  1. net grid says:

    The object-oriented API is simple, and easy to use for parallel programming. It has been developed based on the latest .NET technologies, including Windows Communication Foundation (WCF).

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>