[Date Index] [Thread Index] [Author Index]
MPI-style message passing in pure Mathematica
Dear group, Some time ago I thought I would try implementing MPI-style message passing between kernels using MathLink. In contrast to the Parallel` package, which currently offers only the master/slave or map/reduce paradigm with its quite limited expressivity, the message passing approach can be helpful when constructing more complex parallel algorithms. It turns out that, despite some suggestions in the Parallel` documentation that slave kernels are not capable of direct communication with one another, the implementation is actually fairly easy (though it does rely on undocumented behaviour of the MathLink functions). Having satisfied my curiosity about whether or not it is possible, I have not been motivated to develop this beyond a proof-of-concept, so it seemed like a good idea to comment on this here in case it is of interest to others. To be useful, a receive queue would probably need to be implemented and higher-level collective communication functions written to wrap LinkSend and LinkReceive, although this would not be very difficult to achieve. Also, now that Mathematica 7 and 8 integrate the Parallel` package, there would seem to be no remaining limitation on its using undocumented functions, so possibly WRI may like to take this as a suggestion for future improvements to Mathematica's parallel computing capabilities. A notebook containing the code (which, to be clear, I am releasing into the public domain for anyone to do with as they wish) is available from the following address: https://rapidshare.com/files/1923999609/Message_passing_in_Mathematica.nb Best, O. R.