Compile Fortran 95/2003 code + MPI in Windows using Gfortran

  • Follow


Hello All,

It has been a while since I'm trying to compile a Fortran 95/2003 code
which has MPI in Windows using Gfortran with no success. I tried 3
main open source MPI libraries (MPICH, OpenMPI, Deino) and all of them
allow me compiling Fortran 77 only.

Do we really need some commercial compiler package coming with their
MPI library like Intel or there is an option?


Cheers
Hossein
0
Reply talebi.hossein (24) 2/20/2012 4:03:51 PM

On 20/02/12 16:03, Hossein wrote:
> Hello All,
>
> It has been a while since I'm trying to compile a Fortran 95/2003 code
> which has MPI in Windows using Gfortran with no success. I tried 3
> main open source MPI libraries (MPICH, OpenMPI, Deino) and all of them
> allow me compiling Fortran 77 only.
>
> Do we really need some commercial compiler package coming with their
> MPI library like Intel or there is an option?
>
>

No. It's a while since I've installed these myself so I can't remember 
the details but certainly MPICH and OpenMPI support f90 at least on 
Linux, e.g.

Wot now? mpif90 -showme
gfortran -I/usr/lib/openmpi/include -pthread -I/usr/lib/openmpi/lib 
-L/usr/lib/openmpi/lib -lmpi_f90 -lmpi_f77 -lmpi -lopen-rte -lopen-pal 
-ldl -Wl,--export-dynamic -lnsl -lutil -lm -ldl

Anyway what do you mean by compiling fortran77 only? If you're using 
gfortran that supports f95 so I can't see how you might be restricted to 
f77,

Ian
0
Reply please.dont1 (54) 2/21/2012 8:34:55 AM


On Feb 21, 9:34=A0am, Ian Bush <please.d...@email.me> wrote:
> On 20/02/12 16:03, Hossein wrote:
>
> > Hello All,
>
> > It has been a while since I'm trying to compile a Fortran 95/2003 code
> > which has MPI in Windows using Gfortran with no success. I tried 3
> > main open source MPI libraries (MPICH, OpenMPI, Deino) and all of them
> > allow me compiling Fortran 77 only.
>
> > Do we really need some commercial compiler package coming with their
> > MPI library like Intel or there is an option?
>
> No. It's a while since I've installed these myself so I can't remember
> the details but certainly MPICH and OpenMPI support f90 at least on
> Linux, e.g.
>
> Wot now? mpif90 -showme
> gfortran -I/usr/lib/openmpi/include -pthread -I/usr/lib/openmpi/lib
> -L/usr/lib/openmpi/lib -lmpi_f90 -lmpi_f77 -lmpi -lopen-rte -lopen-pal
> -ldl -Wl,--export-dynamic -lnsl -lutil -lm -ldl
>
> Anyway what do you mean by compiling fortran77 only? If you're using
> gfortran that supports f95 so I can't see how you might be restricted to
> f77,
>
> Ian


Yes, in Linux they support Fortran 90 and I can simply compile them
from source and use. But, in Windows Openmpi does not provide the .mod
files and MPICH provides that but it does not work with Gfortran 4.6
that I checked. The problem is that the .mod files are compiler
dependent and for Gfortran they are Version dependent too. So, it is
really a headache if one want to compiler something like MUMPS in
Windows.

Fortran 77 uses something like "include mpif.h" but in Fortran 90 we
say "use mpi". Also, some of the interfaces are different (I actually
not very sure why but I looked at the source and they have separate
interfaces for Fortran90).





0
Reply talebi.hossein (24) 2/21/2012 10:54:15 AM

On 21/02/12 10:54, Hossein wrote:
> On Feb 21, 9:34 am, Ian Bush<please.d...@email.me>  wrote:
>> On 20/02/12 16:03, Hossein wrote:
>>
>>> Hello All,
>>
>>> It has been a while since I'm trying to compile a Fortran 95/2003 code
>>> which has MPI in Windows using Gfortran with no success. I tried 3
>>> main open source MPI libraries (MPICH, OpenMPI, Deino) and all of them
>>> allow me compiling Fortran 77 only.
>>
>>> Do we really need some commercial compiler package coming with their
>>> MPI library like Intel or there is an option?
>>
>> No. It's a while since I've installed these myself so I can't remember
>> the details but certainly MPICH and OpenMPI support f90 at least on
>> Linux, e.g.
>>
>> Wot now? mpif90 -showme
>> gfortran -I/usr/lib/openmpi/include -pthread -I/usr/lib/openmpi/lib
>> -L/usr/lib/openmpi/lib -lmpi_f90 -lmpi_f77 -lmpi -lopen-rte -lopen-pal
>> -ldl -Wl,--export-dynamic -lnsl -lutil -lm -ldl
>>
>> Anyway what do you mean by compiling fortran77 only? If you're using
>> gfortran that supports f95 so I can't see how you might be restricted to
>> f77,
>>
>> Ian
>
>
> Yes, in Linux they support Fortran 90 and I can simply compile them
> from source and use. But, in Windows Openmpi does not provide the .mod
> files and MPICH provides that but it does not work with Gfortran 4.6
> that I checked. The problem is that the .mod files are compiler
> dependent and for Gfortran they are Version dependent too. So, it is
> really a headache if one want to compiler something like MUMPS in
> Windows.
>
> Fortran 77 uses something like "include mpif.h" but in Fortran 90 we
> say "use mpi". Also, some of the interfaces are different (I actually
> not very sure why but I looked at the source and they have separate
> interfaces for Fortran90).

OK to get around the mod file issue change it to the include method. 
Remember that F90 is a superset of F77 so (very, very nearly) every F77 
program is also a F90 program, so include is perfectly OK in F90.

As for different interfaces there are some routines which are f90 
specific in the sense that they are to deal with mapping f90 kinds onto 
MPI integer handles, but off the top of my head I can think of no 
routine that behaves differently between f90 and f77. Which are you 
particularly interested in?

Ian
0
Reply please.dont1 (54) 2/21/2012 11:21:09 AM

My question is "why" two highly used MPI libraries do not provide
proper F90 interfaces. Needless to say I tried to use that of F77
bindings and I couldn't compile with gfortran.

I have no particular function in mind. But when I look at the MPICH
source, I see every where different F77 and F90 interfaces. So there
should be differences, if not why the bother.

On Feb 21, 12:21=A0pm, Ian Bush <please.d...@email.me> wrote:
> On 21/02/12 10:54, Hossein wrote:
>
>
>
>
>
>
>
>
>
> > On Feb 21, 9:34 am, Ian Bush<please.d...@email.me> =A0wrote:
> >> On 20/02/12 16:03, Hossein wrote:
>
> >>> Hello All,
>
> >>> It has been a while since I'm trying to compile a Fortran 95/2003 cod=
e
> >>> which has MPI in Windows using Gfortran with no success. I tried 3
> >>> main open source MPI libraries (MPICH, OpenMPI, Deino) and all of the=
m
> >>> allow me compiling Fortran 77 only.
>
> >>> Do we really need some commercial compiler package coming with their
> >>> MPI library like Intel or there is an option?
>
> >> No. It's a while since I've installed these myself so I can't remember
> >> the details but certainly MPICH and OpenMPI support f90 at least on
> >> Linux, e.g.
>
> >> Wot now? mpif90 -showme
> >> gfortran -I/usr/lib/openmpi/include -pthread -I/usr/lib/openmpi/lib
> >> -L/usr/lib/openmpi/lib -lmpi_f90 -lmpi_f77 -lmpi -lopen-rte -lopen-pal
> >> -ldl -Wl,--export-dynamic -lnsl -lutil -lm -ldl
>
> >> Anyway what do you mean by compiling fortran77 only? If you're using
> >> gfortran that supports f95 so I can't see how you might be restricted =
to
> >> f77,
>
> >> Ian
>
> > Yes, in Linux they support Fortran 90 and I can simply compile them
> > from source and use. But, in Windows Openmpi does not provide the .mod
> > files and MPICH provides that but it does not work with Gfortran 4.6
> > that I checked. The problem is that the .mod files are compiler
> > dependent and for Gfortran they are Version dependent too. So, it is
> > really a headache if one want to compiler something like MUMPS in
> > Windows.
>
> > Fortran 77 uses something like "include mpif.h" but in Fortran 90 we
> > say "use mpi". Also, some of the interfaces are different (I actually
> > not very sure why but I looked at the source and they have separate
> > interfaces for Fortran90).
>
> OK to get around the mod file issue change it to the include method.
> Remember that F90 is a superset of F77 so (very, very nearly) every F77
> program is also a F90 program, so include is perfectly OK in F90.
>
> As for different interfaces there are some routines which are f90
> specific in the sense that they are to deal with mapping f90 kinds onto
> MPI integer handles, but off the top of my head I can think of no
> routine that behaves differently between f90 and f77. Which are you
> particularly interested in?
>
> Ian

0
Reply talebi.hossein (24) 2/21/2012 11:42:45 AM

Hossein <talebi.hossein@gmail.com> wrote:

> My question is "why" two highly used MPI libraries do not provide
> proper F90 interfaces. Needless to say I tried to use that of F77
> bindings and I couldn't compile with gfortran.
> 
> I have no particular function in mind. But when I look at the MPICH
> source, I see every where different F77 and F90 interfaces. So there
> should be differences, if not why the bother.

From your own description in a prior post in the thread, unless I
misunderstood what you said, the libraries do provide F90 interfaces.
They just have not been compiled for the particular compilers you are
using.

No, it is not "needless to say" that you could not compile the interface
of the F77 bindings with gfortran. Quite the opposite, the f77 bindings
should work just fine, so if you could not get them to do so, I would
guess that you need to say more about precisely what it was that you
tried. The description you give is inadequate for me to tell. If you
tried anything relating to a USE statement, than that would not be using
the f77 bindings. See Ian's prior post.

To answer one of your questions, there are good reasons for providing
f90 bindings, even in cases where they are nothing more than a kind of
wrapper around f77 ones. For one, an f90-style explicit interface
provides quite a lot of compile-time checking for some kinds of errors.

-- 
Richard Maine                    | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle           |  -- Mark Twain
0
Reply nospam47 (9742) 2/21/2012 5:23:55 PM

On 02/21/2012 06:23 PM, Richard Maine wrote:
> To answer one of your questions, there are good reasons for providing
> f90 bindings, even in cases where they are nothing more than a kind of
> wrapper around f77 ones. For one, an f90-style explicit interface
> provides quite a lot of compile-time checking for some kinds of errors.

Except that the number of interfaces can explode. If you have a "buffer" 
argument (C: void *) you might need to provide several interfaces: One 
for scalars, one for arrays - and both for all data types/kinds. In 
gfortran, I count (depending on the hardware), 2 character kinds 
(default + UCS-4), 5 integer, 4 real, 4 complex, 5 logical = 2*20 = 40 
interfaces - for a single procedure. If one now also wants to allow 
"type(c_ptr)" or ..., the number increases even more.

I think Open MPI allows one to specify how many explicit interfaces one 
wants to have - all or only a sparse subset. I think, with default 
setting, you get only some explicit interfaces. That's better than the 
F77 version and gives some checking, but it does not give a full checking.


A solution to the lacking "void *" will be provided by Technical 
Specification (TS) 29113. TS29113 adds assumed types ("TYPE(*)") and - 
less useful in this case - assumed rank ("dimension(..)"). The MPI 3 
standard will make use of TS29113 with "use mpi_f08". [For asynchronous 
(MPI) communication, TS29113 also extends the definition of ASYNCHRONOUS 
to non-Fortran I/O.]

The only problem of MPI 3 and TS29113: It will take a while until the 
compilers and the MPI implementors support it - and even longer until it 
is more widely available.


The latest draft of TS 29113 is available at 
http://j3-fortran.org/doc/meeting/197/12-119r1.pdf (That's past one a 
PDTR ballot. The DTS ballot is supposed to be started in May.)

An early draft of MPI 3, which probably does not contain the changes of 
other subcommittees is at 
https://svn.mpi-forum.org/trac/mpi-forum-web/raw-attachment/ticket/229/mpi-report-F2008-2011-12-15-changeonlyplustickets.pdf 
- there might be newer drafts, I do not follow the MPI 3 development.

Tobias
0
Reply burnus (564) 2/21/2012 6:09:32 PM

ok, let's discuss two libraries. OpenMPI does not provide f90
interfaces at all for Windows. In their forum on this same discussion
they say they will provide if there are strong demands.

For MPICH2, they have something. But, with Gfortran 4.6 when I try to
say "use mpi" I get the error that mpi.mod file is not compiled with
Gfortran or kind of this message.

In my code everywhere I;ve put "use mpi". So, my solution was to make
a module like:
module mpi
include "mpif.h"
end module mpi

so this will fix my problem at the moment.



On Feb 21, 6:23=A0pm, nos...@see.signature (Richard Maine) wrote:
> Hossein<talebi.hoss...@gmail.com> wrote:
> > My question is "why" two highly used MPI libraries do not provide
> > proper F90 interfaces. Needless to say I tried to use that of F77
> > bindings and I couldn't compile with gfortran.
>
> > I have no particular function in mind. But when I look at the MPICH
> > source, I see every where different F77 and F90 interfaces. So there
> > should be differences, if not why the bother.
>
> From your own description in a prior post in the thread, unless I
> misunderstood what you said, the libraries do provide F90 interfaces.
> They just have not been compiled for the particular compilers you are
> using.
>
> No, it is not "needless to say" that you could not compile the interface
> of the F77 bindings with gfortran. Quite the opposite, the f77 bindings
> should work just fine, so if you could not get them to do so, I would
> guess that you need to say more about precisely what it was that you
> tried. The description you give is inadequate for me to tell. If you
> tried anything relating to a USE statement, than that would not be using
> the f77 bindings. See Ian's prior post.
>
> To answer one of your questions, there are good reasons for providing
> f90 bindings, even in cases where they are nothing more than a kind of
> wrapper around f77 ones. For one, an f90-style explicit interface
> provides quite a lot of compile-time checking for some kinds of errors.
>
> --
> Richard Maine =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0| Good judgment come=
s from experience;
> email: last name at domain . net | experience comes from bad judgment.
> domain: summertriangle =A0 =A0 =A0 =A0 =A0 | =A0-- Mark Twain

1
Reply talebi.hossein (24) 2/23/2012 9:31:47 AM

7 Replies
820 Views

(page loaded in 2.711 seconds)

Similiar Articles:













7/22/2012 2:15:44 PM


Reply: