LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Lei_at_[hidden]
Date: 2005-07-14 00:49:31


Thanks a lot for your prompt help, Jeff!

I will try to construct a quick prototype using your suggestion #1.

-Lei

Jeff Squyres wrote:

>On Jul 13, 2005, at 3:16 AM, Lei_at_ICS wrote:
>
>
>
>>I am given a Matlab+C program for me to parallelize. What I need to do
>>is to parallelize a C routine that is called by another C routine,
>>which in
>>turn is called from Matlab. There are large and complicated C data
>>structures that are passed in and out the C routine being parallelized.
>>
>>My question is: is there a way to spawn MPI processes from a non-MPI
>>process, and at the same time pass in and out C data structures between
>>the parent sequential and the child MPI processes.
>>
>>
>
>So that's 2 questions:
>
>1. can a non-MPI process spawn MPI processes: sort of. However, it's
>probably easiest if your non-MPI process simply calls MPI_INIT and
>becomes an MPI process (i.e., you don't have to launch it via mpirun --
>if it calls MPI_INIT, it will simply get an MPI_COMM_WORLD size of 1,
>and then call MPI_COMM_SPAWN from there to launch more MPI processes).
>
>Other people have done this with Matlab before (indeed, there is a
>package out there with MPI bindings for Matlab MEX), and there are
>definitely some issues that need to be thought out first. Search the
>LAM mailing list archives -- this stuff has been discussed extensively
>before.
>
>2. Can you pass C structures from the parent to the child: if you
>follow the suggestion in #1, there's nothing to pass -- Matlab itself
>becomes the parent MPI process; then you use standard MPI send/receive
>semantics to pass data from the Matlab script (or C routine) to the
>spawned processes. If you use a different mechanism, then you can use
>traditional Unix IPC mechanisms to pass the data (pipes, files, local
>sockets, shared memory, etc.).
>
>Hope that helps.
>
>
>