[mpich-discuss] F90FLAGS "-i4" statement for mpich2 configuration

chan at mcs.anl.gov chan at mcs.anl.gov
Thu Apr 29 10:18:55 CDT 2010


----- "Kate Steenhauer" <k.steenhauer at abdn.ac.uk> wrote:

> [eng923 at cops-021026 job]$ mpich2version
> MPICH2 Version:         1.2.1p1
> MPICH2 Release date:    Unknown, built on Mon Mar 29 14:37:13 BST
> 2010
> MPICH2 Device:          ch3:nemesis
> MPICH2 configure:       --prefix=/opt/mpich2
> MPICH2 CC:      gcc  -O2
> MPICH2 CXX:     c++  -O2
> MPICH2 F77:     gfortran  -O2
> MPICH2 F90:     f95  -O2

If you didn't install any other fortran compiler on machine, I would think
f95 is gfortran, i.e. a symbolic link.  Do "readlink -f `which f95`"
to see what it says.

> When I read the following (see below) in migrating from mpich1 to
> mpich2, is this possibly causding the problem in mpi_scatter? As I am
> using an Intel fortran compiler on a 64 bit linux platform? Would I
> need to reinstall and configure MPIch2 and where and how do I include
> the F90FLAGS "-i4" statement on a bash Shell?

The paragraph you quoted refers to g95 which is variant distribution 
of GNU Fortran compiler.  I believe that most modern distribution of linux
do not ship with it by default, i.e. you need to specifically download
that version of fortran compiler.  Try do "which g95" to see if your
machine has it.

If you worry your fortran integer does not have the correct length,
you can check the sizeof of fortran integers and reals as follows
(you can use the kind parameter instead)

> cat ts_sizeof.f
        program test_sizeof
        integer  ii
        real     rr
        integer*8  ii8
        real*8     rr8
        write(6,*) "sizeof(integer) = ", sizeof(ii)
        write(6,*) "sizeof(rr) = ", sizeof(rr)
        write(6,*) "sizeof(integer*8) = ", sizeof(ii8)
        write(6,*) "sizeof(rr*8) = ", sizeof(rr8)
        end

> gfortran ts_sizeof.f && a.out
> f95 ts_sizeof.f && a.out

To avoid any potential problem, you may want to configure MPICH2 by
explicitly specifying which compilers you are using

./configure --prefix=.... CC=gcc CXX=g++ F77=gfortran F90=gfortran

(Be sure to do a make distclean before reconfiguring MPICH2 if you
are doing an inpath build).  You mentioned you were using intel fortran
compiler, did you configure MPICH2 with ifort, i.e. F77=ifort F90=ifort ?
Again to avoid any potential incompatibility, the rule is always to use
the same compilers to configure/build MPICH2 as the ones that are used to
compile/link your code (using mpicc/mpif90 from MPICH2 installation
will avoid the issue).

A.Chan

> 
> D.4 Q: When I use the g95 Fortran compiler on a 64-bit
> platform, some of the tests fail
> A: The g95 compiler incorrectly defines the default Fortran integer as
> a 64-
> bit integer while defining Fortran reals as 32-bit values (the Fortran
> standard
> requires that INTEGER and REAL be the same size). This was apparently
> done to allow a Fortran INTEGER to hold the value of a pointer,
> rather
> than requiring the programmer to select an INTEGER of a suitable
> KIND.
> To force the g95 compiler to correctly implement the Fortran standard,
> use
> the -i4 flag. For example, set the environment variable F90FLAGS
> before
> configuring MPICH2:
> setenv F90FLAGS "-i4"
> G95 users should note that there (at this writing) are two
> distributions of
> g95 for 64-bit Linux platforms. One uses 32-bit integers and reals
> (and
> conforms to the Fortran standard) and one uses 32-bit integers and
> 64-bit
> reals. We recommend using the one that conforms to the standard (note
> that the standard specifies the ratio of sizes, not the absolute
> sizes, so a
> Fortran 95 compiler that used 64 bits for both INTEGER and REAL would
> also conform to the Fortran standard. However, such a compiler would
> need
> to use 128 bits for DOUBLE PRECISION quantities).
> 
> Thanks kate
> 
> 
> 
> The University of Aberdeen is a charity registered in Scotland, No
> SC013683.
> 
> _______________________________________________
> mpich-discuss mailing list
> mpich-discuss at mcs.anl.gov
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss


More information about the mpich-discuss mailing list