On Mon 2008-11-10 12:35, Raymond Wan wrote:

> One thing I was wondering about was whether it is possible, though the
> use of #define's, to create code that is both multi-processor
> (MPI/mpic++) and single-processor (normal g++).  That is, if users do
> not have any MPI installed, it compiles it with g++.
>
> With #define's and compiler flags, I think that can be  easily done --  
> was wondering if this is something that developers using MPI do and  
> whether AC/AM  supports it.

The normal way to do this is by building against a serial implementation
of MPI.  Lots of parallel numerical libraries bundle such an
implementation so you could just grab one of those.  For example, see
PETSc's mpiuni ($PETSC_DIR/include/mpiuni/mpi.h and
$PETSC_DIR/src/sys/mpiuni/mpi.c) which implements many MPI calls as
macros.

Note that your serial implementation only needs to provide the subset of
MPI that your program actually uses.  For instance, if you never send
messages to yourself, you can implement MPI_Send as MPI_Abort since it
should never be called in serial.

Jed

Attachment: pgprlwscpafzZ.pgp
Description: PGP signature

Reply via email to