Saturday, April 18, 2009

MPI, MS Windows and Cygwin

I have seen a lot of articles discussing which MPI implementation -- LAM, MPICH, or something else -- is better or worse. But none of them mentioned using MPI under Windows and Cygwin.

You may ask: why to use MPI under Cygwin? Well, it's difficult for me to imagine that MPI could be efficiently utilized under Windows at all. Most modern clusters do not use Windows -- they are built on Linux. Supercomputers also do not run Microsoft products.

And, of course, development of parallel program should be performed under Linux or some another UNIX-like system. But it is not always possible. For example, I can install Linux on my home computer (in fact, I have), but I am stuck to Windows in my office. Windows is not such bad, I have a lot of Windows projects. In fact, all of my projects except recent one are Windows-oriented, and I still make some changes there from time to time. So I cannot get rid of Windows, but I want to develop MPI application that will be run on a supercomputer.

There are at least two ways to have Windows as OS and to work in Linux-like environment: to use virtual machine or to install Cygwin. I have selected the second option (I don't feel myself comfortable when working with a virtual machine, it's still slow and... well, you may try). So I downloaded and installed cygwin with development tools (I needed gcc), I have installed Eclipse to use it as IDE, and then I have encountered a question: how will I debug MPI code? I needed MPI implementation that could run under Cygwin.

At that point I have read a number of articles and found that LAM is a bit faster than MPICH - in some cases. Well, operating speed was not important for debug purposes, but I nevertheless decided to try LAM.
There is no LAM binaries for a cygwin at LAM's website. But I am familiar quite well with './configure' and 'make', so I downloaded the source codes and started build. After a several hours (yes, cygwin + Windows configure and compile rather slowly) I have got an error -- something was wrong with include files. Searching the web gave me an answer: I had to disable ROMIO. Ok, I haven't planned to use it in any case, so I have run:

./configure --without-romio --prefix=/opt/lam
make
make install

And this time LAM was compiled all right (though it took many hours). At least I had been thinking so -- until I tried to build my MPI application with mpicxx. Then I have discovered that my installation didn't work. It encountered segmentation fault error every time I started its compiler wrappers. Also, mpirun didn't run the simplest programs too. Searching the web gave nothing this time, and I have removed LAM from my computer. LAM is a good product, but I think it's just incompatible with Cygwin.

Next, I have tried MPICH. And it just worked. Although I had to start mpd daemon and write single-line script so that 'make' could run mpicxx compiler.

No comments:

Post a Comment