Using MPI with C\# and the common language infrastructure
Authors: Jeremiah Willcock, Andrew Lumsdaine, Arch Robison
Venue: Proceedings of the 2002 joint ACM-ISCOPE conference on Java Grande (2002)

The Common Language Infrastructure (CLI) is a new virtual machine and runtime environment recently introduced by Microsoft® as part of the .NET initiative [1]. It provides a standard bytecode format, and a set of libraries for programs to use. It is specifically designed to be used with multiple programming languages, and allows cross-language interoperability. It also includes a provision for stack-allocated data structures (for higher performance), and the use of raw pointers for interfacing to native code. C# is a new programming language designed to take advantage of the features of the CLI [2]. The Message Passing Interface (MPI) is a standard application programming interface (API) for distributed-memory parallel computing [3]. It provides primitive operations for sending and receiving messages, collective operations, data type= declarations, and other common message-passing operations.This poster presents two binding specifications for MPI for the CLI, allowing access to high-performance message passing from any language in the CLI, including C#. The first, called the CLI bindings, provides an interface based on that of the C++ bindings in the MPI standard. This specification provides an object-oriented interface to MPI functionality that directly maps object method calls to the underlying MPI functions. Method and property names follow exactly the conventions of the \Cpp{} bindings whenever possible, and arguments are passed to MPI functions using a start address and an element count, just as in the C++ bindings. This eases migration from C++ for both programmers and programs.MPI.NET is a higher-level binding specification, which is designed to match the naming conventions of the standard CLI libraries. For instance, this layer of bindings uses properties for convenient access to information about objects. These bindings evolved from the OOMPI object-oriented C++ interface to MPI, and operate at a higher level of abstraction than the CLI bindings [4]. For instance, a communicator and source or destination process rank are combined into a port (an abstraction inherited from OOMPI). One important feature of MPI.NET is that buffers are represented generically. As in OOMPI, a message is generalized as an interface, not a specific class. The CLI bindings, as well as MPI.NET, are implemented using an internal, low-level set of bindings designed to match the MPI C API.In order to determine whether using these bindings for parallel communication would cause a severe performance loss, the overheads of each binding layer were measured on two 1.5 GHz P4® systems connected by full-duplex 100 Mbps Ethernet. Both systems were running Red Hat® Linu ® 7.3, with the 2.4.18-10smp kernel. The C compiler used was GCC 2.96, and the "Rotor" environment was used for C++ and the CLI [5]. LAM/MPI 6.5.6 using c2c mode and homogeneous-network optimization was used for communication. As shown in Figure 1, overhead from using the CLI is fairly small and generally does not increase much with larger message sizes.