Re: MPI beginner



On Sep 29, 2:20 am, Arjen Markus <arjen.mar...@xxxxxxxxxx> wrote:
On 29 sep, 10:57, Rick <fernan...@xxxxxxxxx> wrote:



This is probably a silly question, but: is there a standard way to
compile the same code with ifort using MPI or not using it? For
instance, I could provide line of codes that would apply in each of
the two cases.
My code is used by other people, most of the time without
parallelization. That would save them the burden of installing mpi
each time.

With ifort, compiling MPI code does not work:

fortcom: Error: hello_f90.f90, line 12: Error in opening the compiled
module file.  Check INCLUDE paths.   [MPI]
    use mpi
--------^
fortcom: Error: hello_f90.f90, line 17: This name does not have a
type, and must have an explicit type.   [MPI_COMM_WORLD]
    call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr)
-----------------------^

You can supply a dummy module with dummy routines and parameters.
The MPI manual may show what is needed in that case, otherwise you
will have to make one yourself.

Regards,

Arjen

Depending on how extensive your use of MPI is throughout your code,
you can also use C preprocessor directives to remove the MPI
references when not needed. In one code I work on, MPI is only used
when selecting one of several FFT libraries (the libraries are either
serial or use OpenMP). When we're selecting that library, we use the
preprocessor to remove all references to MPI. Presumably Fortran's
own conditional compilation facility could do the same thing, but
implementations of that facility seem rare.

Damian
.



Relevant Pages

  • Re: Thread support (using OpenMP) in OpenMPI
    ... thread support enabled. ... you should deinstall the MPI packages ... If that works then you are ready to compile a so called ... hybrid program that uses MPI and OpenMP. ...
    (comp.parallel.mpi)
  • Re: MPI and Pthread
    ... A standard C compiler won't compile MPI programs. ... find the include file and libraries. ... But the OP does indeed need an MPI implementation to compile the ...
    (comp.lang.c)
  • Re: MPI beginner
    ... compile the same code with ifort using MPI or not using it? ... There are two standard ways to deal with this. ... The second is to use Coco to conditionally compile in the MPI stuff. ...
    (comp.lang.fortran)
  • Re: MPI and Pthread
    ... A standard C compiler won't compile MPI programs. ... compiler, usually called "mpicc". ... But the OP does indeed need an MPI implementation to compile the ...
    (comp.lang.c)
  • [opensuse] mpi
    ... I am trying to compile an mpi program library in opensuse 11.2. ... So it seems that the mpi installation in opensuse is quite hosed, ...
    (SuSE)