On Jun 22, 2010, at 6:46 PM, Mihaly Mezei wrote:

> I just tried adding the include statement, but this is what I got:
> 
>  lapis.mssm.edu % mpif90 -o mpi0 mpi0.f
> /share/apps/openmpi-1.4.1/include/mpif-common.h(402): error #6406: 
> Conflicting attributes or multiple declaration of name.   [MPI_COMM_WORLD]
>       parameter (MPI_COMM_WORLD=0)
> -----------------^
> compilation aborted for mpi0.f (code 1)

I'm guessing you didn't rename the parameter of the function (in your original 
source code, you had named a parameter MPI_COMM_WORLD).  That would cause a 
conflict.  In general, it's a Bad Item to name parameters -- or any symbols, 
really -- with an MPI_* prefix.  The MPI_* prefix is reserved for the MPI 
library.

So you actually had a few problems:

- naming a parameter MPI_COMM_WORLD (causing a conflict when including mpif.h)
- not including mpif.h in the subroutine (resulting in MPI_INTEGER having an 
undefined value)
- you passed a MPI_COMM_WORLD in both a common block (through an intermediate 
integer) and as a parameter; I'm guessing that was just iterating through your 
testing, but just to be clear -- you only need one or the other, not both (or 
just including "mpif.h" if you know you're going to use MPI_COMM_WORLD)

FWIW, I'd strongly recommend using "IMPLICIT NONE" in your code to prevent 
accidental use of variables without defined values, etc.

-- 
Jeff Squyres
jsquy...@cisco.com
For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/


Reply via email to