Newsgroups: comp.parallel.mpi
From: ags@seaman.cc.purdue.edu (Dave Seaman)
Subject: Re: How to write MPI program in Fortran90 ?
Organization: Purdue University
Date: 21 Jun 1996 11:11:31 -0500
Message-ID: <4qehjj$t6b@seaman.cc.purdue.edu>

In article <4qcrtb$bd0@hkusuc.hku.hk>,
Woo Chat Ming <cmwoo@hkusu8.hku.hk> wrote:
>Hello,
>
>  I have written a serial program in Fortran 90 in IBM SP2. Now, I want to
>parallelize it using MPI library. 
>  However, the header file "mpif.h" is written in Fortran 77. After I 
>"include" it into my program, my compiler(xlf90) generates a lot of errors.
>
>  Do anyone know how to write MPI programs in fortran 90 ? 

The problem is that mpif.h uses fixed-form Fortran, and therefore it
can't be included as-is into a file that uses Fortran 90 free-form
source.  Here are four solutions, of which one is rather unsatisfactory
and the others are all IBM-specific:

	(0) Give up on free form source and pretend you are writing
	    Fortran 90 on punched cards.  You can still compile with
	    xlf90 by using the -qfixed compiler option.  Portable, but
	    not recommended.

	(1) Surround your include statement with the appropriate source
	    directives:

		!ibm*sourceform(fixed)
		      include 'mpif.h'
		!ibm*sourceform(free=f90)

	    Notice that the include statement now needs to start in
	    column 7 or later.  The rest of your file can follow the
	    rules for free-form source.

	(2) Make a copy of /usr/lpp/ppe.poe/include/mpif.h in your
	    working directory and add the line

		!ibm*sourceform(fixed)

	    at the beginning of the file.  Then you can simply

		include 'mpif.h'

	    in your calling program as you have been doing and the
	    compiler automatically reverts to free form (if that is
	    what you were using) after it finishes processing the
	    include file.

	(3) Talk to IBM or the support people at your computing center
	    about getting this version of mpif.h installed on the
	    system in order to make it Fortran 90-friendly.

-- 
Dave Seaman
      ++++ stop the execution of Mumia Abu-Jamal ++++
    ++++ if you agree copy these lines to your sig ++++
++++ see http://www.xs4all.nl/~tank/spg-l/sigaction.htm ++++

