Newsgroups: comp.parallel.mpi,comp.soft-sys.matlab
From: branch@mathworks.com (Mary Ann Branch)
Subject: Re: Matlab amd MPI
Organization: The MathWorks, Inc., Natick, MA 01760
Date: 3 Nov 1995 20:04:16 GMT
Message-ID: <47dsk0$rag@turing.mathworks.com>

Jens Olav Nygaard (jnygaard@math.uio.no) wrote:
: I want to combine Matlab and MPI, and as I see it, there are two
: possibilities: 1) Embed relevant MPI-calls in Matlab MEX-functions,
: thus in effect making a Matlab-version of MPI, or 2) write an
: ordinary C-program with MPI which then uses the Matlab engine. Has
: anybody explored these ideas? Is there any reason I should choose
: one of the approaches before the other? Is there any reason for
: this not to work?
: 
: In other words, I need pointers to more information...
: 
: 
: Jens Olav Nygaard
: The University of Oslo, Norway



Using C as the main program with MPI calls and calling Matlab as a
compute engine is the easier route to go.  I found it to be as easy as
just having C call Matlab.

The other direction may not be so straightforward.  But this is
dependent on the machine/compiler you are using.

For example, on the IBM SP2, having a Matlab process call Fortran
MEX-files embedded with MPI calls has a compilation problem.  The
compiler will look for an executable called _main (or something
similar) to call after it calls the routine that allocates and
initializes the SP2 nodes.  But there is no _main because Matlab is
the "main" subroutine.  

Since I did not discover a way to tell the SP2 (Fortran) compiler to
call the matlab executable instead of _main, I abandoned this route.

If you can get MPI, Matlab and C to compile together in whatever
configuration, then the rest is (reasonably) straightforward.

  HTH,
   Mary Ann

-- 
==== Mary Ann Branch ==================== branch@mathworks.com ====
     The MathWorks, Inc.                    info@mathworks.com
     24 Prime Park Way                http://www.mathworks.com
     Natick, MA 01760-1500                   ftp.mathworks.com
==== Tel: 508-653-1415 ===================== Fax: 508-653-2997 ====

