Python with MPI enable C-module

Mitko Haralanov mitko at qlogic.com
Fri Oct 20 19:13:17 EDT 2006


On 19 Oct 2006 06:51:00 -0700
"dfj225 at gmail.com" <dfj225 at gmail.com> wrote:

> 1) Would setting up an environment like this require modifying the
> Python interpreter or the C++ module that is being wrapped? What I'm
> hoping is that the C++ module can go on happily doing MPI operations
> despite the fact that it is actually being called by the Python
> interpreter.

If I am understanding you correctly, you have a Python module which
calls into the C++ library to do the actual MPI operations. If that is
the case, then there should be any problems just calling the Python
wrappers. The MPI library should be unaffected. It would be the same as
having your node programs call into the C++ library, now you just have
one more layer of abstraction.

> 2) Would it be possible to spawn these Python processes using mpiexec
> (or something similar), or would I need to use some of the MPI-2
> features to dynamically set up the MPI environment?

If you are writing a Python wrapper to the MPI library, then the
wrapper will be just like a module and not a self sustained program. If
that is the case, mpiexec/mpirun/mpd would not be able to do anything
since they expect to start a program that has main()/__main__.

> 3) Has anyone accomplished something like this already? I know there
> are extensions and modules that add MPI functionality to Python, but
> I'm hoping they could be avoided, since the Python code itself should
> never really have to be aware of MPI, only the C++ module that has
> already been written.

Haven't done it but from what I know about MPI and Python, it is
possible.

-- 
Mitko Haralanov					 mitko at qlogic.com
Senior Software Engineer			     650.934.8064
System Interconnect Group		    http://www.qlogic.com




More information about the Python-list mailing list