List Info

Thread: LAM: calling from matlab




LAM: calling from matlab
user name
2006-12-12 06:48:00
Hi all,

I need to start a parallel program from matlab. I have a

+ a manager program which is written in c and has
mexFunction
    interface (compiled with mex wrapper around mpicc)

+ a worker program which is written in c (compiled using
regular
    mpicc wrappers.)

The manager spawns the workers. After lamboot'ing from the
shell, I
call manager from matlab prompt. the first call runs to
completion.
Subsequent calls to manager return with the following error
message

------------------------------------------------------------
-----------------
It seems that at least one rank invoked MPI_INIT after
invoking
MPI_FINALIZE.  MPI can not be re-initialized after
MPI_FINALIZE has
been called.  The process was PID 28477 on host motek.

It was probably rank (unknown) on MPI_COMM_WORLD, but I
can't say that for
sure...
------------------------------------------------------------
-----------------

If I use  'clear functions' in matlab prompt between the
subsequent
calls, then everything seems to be fine.

I am using  LAM/MPI: 7.1.2 and Matlab Version 7.1.0.183
(R14) Service Pack 3.

I do not want to clear functions. 'clear manager' sometimes
works but
sometimes returns with a segmentation violation error.

What can I do? Any suggestions?

Best wishes
_______________________________________________
This list is archived at http://www.l
am-mpi.org/MailArchives/lam/
LAM: calling from matlab
user name
2006-12-13 04:25:58
On Dec 11, 2006, at 11:48 PM, Bora Ucar wrote:

>
------------------------------------------------------------
---------- 
> -------
> It seems that at least one rank invoked MPI_INIT after
invoking
> MPI_FINALIZE.  MPI can not be re-initialized after
MPI_FINALIZE has
> been called.  The process was PID 28477 on host motek.
>
> It was probably rank (unknown) on MPI_COMM_WORLD, but I
can't say  
> that for
> sure...
>
------------------------------------------------------------
---------- 
> -------
>
> If I use  'clear functions' in matlab prompt between
the subsequent
> calls, then everything seems to be fine.
>
> I am using  LAM/MPI: 7.1.2 and Matlab Version 7.1.0.183
(R14)  
> Service Pack 3.
>
> I do not want to clear functions. 'clear manager'
sometimes works but
> sometimes returns with a segmentation violation error.
>
> What can I do? Any suggestions?

I'm afraid I can't offer much more advice than "don't
do that".  The  
MPI standard specifically states that calling MPI_INIT then 

MPI_FINALIZE then MPI_INIT again is erroneous and should
result in an  
error.  Based on the fact that 'clear functions' allows this
 
behavior, it must completely unload the LAM code from the
process,  
but I can't tell you why 'clear manager' doesn't do the same
thing.

There are really only two solutions:

   1) Edit manager so that it stays loaded for the life of
it's use  
in that
      matlab instance, only calling MPI_Finalize when you
will never  
need
      it again (MPI_Initialized() can be useful to determine
if you  
need to
      call MPI_INIT).

   2) Find out from Matlab experts exactly how to make sure
that all  
of LAM's
      libraries are completely unloaded from the process
image space  
between
      uses.

Hope this helps,

Brian

-- 
   Brian Barrett
   LAM/MPI developer and all around nice guy
   Have a LAM/MPI day: http://www.lam-mpi.org/


_______________________________________________
This list is archived at http://www.l
am-mpi.org/MailArchives/lam/
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )