coding, parallel

DELPHI and MPI, closer look 1

Since my small article Delphi and MPI in 4 steps has its own fan base (almost everyday a coder lost in the world wide web visits this page), I decided to give the subject a closer look.

In this first part I will take a closer look at the installation process.

1. Install an MPI library

MPI itself is not a library but an interface. So you have to find an implementation suiting your needs. MPICH2 is a long time favorite of mine, as it is free, well developed and documented.

All you have to do download and install the library on every computer of your cluster.

2.Get a Binding

Unfortunately, MPICH2 does not include bindings for Delphi. Fortunately Lazarus people created a pascal file  from the c include files that we can use.

You can find the slightly changed version of this file here Delphi mpi bindings (38).  All you need to do is download the file and insert it into your project. Since the dll files from MPICH2 will be in a path where Windows can find no other action is necessary.

3.Code!

Add uses MPI; to your code, that’s it. Here is a small example:

program MPIExample;
uses  MPI;

var myid: integer;
begin
  MPI_Init(nil,nil);
  MPI_Comm_rank(MPI_COMM_WORLD,@myid);
  writeln('id=',myid);
  MPI_Finalize;

end.

speak up

Add your comment below, or trackback from your own site.

Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

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

*Required Fields