LAM/MPI logo

LAM/MPI General User's Mailing List Archives

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

From: Pak, Anne O (anne.o.pak_at_[hidden])
Date: 2003-05-22 17:07:43


hello:

i have a parallel program that gets called by MATLAB via a MEX function and
that uses the follows these steps:
****************************
- your matlab script launches
- it calls MPI_Init
- check for a published name
- if the published name does not exist
  - spawn a master (i.e., a new, independant process)
  - the master publishes a name
- if the published name does exist
  - MPI_Comm_connect to the master
- the master spawns a bunch of slaves to do the work
- the matlab script sends a bunch of work to the master
- the master farms it out to all the slaves
- the slaves do all the work and eventually send the result(s) to the
  master
- the master sends the result(s) to the matlab script
- the matlab script disconnects from the master
- the matlab script finishes
---> note that the master and all of the slaves are still running

The next time that the matlab script starts up, it sees that the
master is running and just connects to it (rather than spawning a new
one). Hence, all of your slaves are durable and keep their data (no
need to re-scatter the same data every time).

***********************
in the main MATLAB program, i have to do processing on each FRAME of data,
so for each FRAME, i need to call this MEX function. for the very first
frame, the master process is spawned (using MPI_Comm_spawn) inside the MEX
function and for subsequent frames, i call MPI_Comm_connect to connect to
this master process. likewise, for the first frame, the master process
spawns the slave processes, and for subsequent frame, since the slave
processes remain open all the time, there is no need to call
MPI_Comm_connect.

for the first frame, i use MPI_Scatter to scatter a bunch of really large
input arrays, and for subsequent frames, i only send smaller update arrays.

i ran the simulation for about 20 frames.

the very first frame takes a long time (around 20-30 seconds) to execute.
(maybe there is some initial start up overhead???)

for the subsequent frames, it either takes only 0.5 seconds to execute, or
sometime 18-25 seconds...and these subsequent frames are processing the same
sets of data (i.e. the updates being sent are the same so theoretically, it
should take the same time to process).

can someone think of any reason why this would be happening???

thanks and happy memorial day weekend,

anne

___________________________________________________
Anne Pak, L1-50
Building 153 2G8
1111 Lockheed Martin Way
Sunnyvale, CA 94089
(408) 742-4369 (W)
(408) 742-4697 (F)