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

chan at mcs.anl.gov chan at mcs.anl.gov
Fri Apr 30 09:39:49 CDT 2010


Kate,

You should do what Rajeev said.  That seems like to be the cause of your
problem.

The other issue is that, your version of gfortran does not have sizeof()
intrinsic, too old maybe.  Do you have ifort on your machine ?  Since 
you said your code is written with ifort in mind, you should use ifort
if possible.  Using a different fortran compiler may cause some other issues
given your experience...  If your machine do have ifort but it is not on
your PATH, configure MPICH2 with 
F77=<full-pathname-to-ifort> F90=<full-pathname-to-ifort>.
BTW, ifort should have sizeof() intrinsic...

A.Chan

----- "Rajeev Thakur" <thakur at mcs.anl.gov> wrote:

> The code has declared the array as real, but is using MPI_REAL8 in
> the
> MPI_Scatter call. You need to use a compiler flag that automatically
> promotes reals to 8 bytes, or declare them as real*8, or use MPI_REAL
> instead of MPI_REAL8.
> 
> Rajeev
>  
> 
> > -----Original Message-----
> > From: mpich-discuss-bounces at mcs.anl.gov 
> > [mailto:mpich-discuss-bounces at mcs.anl.gov] On Behalf Of 
> > Steenhauer, Kate
> > Sent: Friday, April 30, 2010 5:19 AM
> > To: Anthony Chan; mpich-discuss at mcs.anl.gov
> > Subject: Re: [mpich-discuss] F90FLAGS "-i4" statement for 
> > mpich2 configuration
> > 
> > I have gfortran installed , i re-installed mpich2, i have 
> > re-configured mpich2 using ________________________________________
> > ./configure --prefix=.... CC=gcc CXX=g++ F77=gfortran 
> > F90=gfortran  mpich2version
> > MPICH2 Version:         1.2.1p1
> > MPICH2 Release date:    Unknown, built on Fri Apr 30 10:16:59 BST
> 2010
> > MPICH2 Device:          ch3:nemesis
> > MPICH2 configure:       --prefix=/opt/mpich-test F77=gfortran 
> > F90=gfortran
> > MPICH2 CC:      gcc  -O2
> > MPICH2 CXX:     c++  -O2
> > MPICH2 F77:     gfortran  -O2
> > MPICH2 F90:     gfortran  -O2
> > 
> > It still runs into the same error at MPI_Scatter.
> > 
> > I created the program below and I tried gfortran ts_sizeof.f 
> > && a.out as was suggested. The following error occurs
> > 
> > gfortran ts_sizeof.f90 && a.out
> > /tmp/cceMCvOn.o: In function `MAIN__':
> > ts_sizeof.f90:(.text+0x6f): undefined reference to `sizeof_'
> > ts_sizeof.f90:(.text+0xf5): undefined reference to `sizeof_'
> > ts_sizeof.f90:(.text+0x17b): undefined reference to `sizeof_'
> > ts_sizeof.f90:(.text+0x201): undefined reference to `sizeof_'
> > collect2: ld returned 1 exit status
> > 
> > What am I doing wrong and what will this tell? The code 
> > itself has been heavily tested with INTEL fortran, iam not 
> > sure if any compatibility problems occur because of the 
> > differences in data declaration between gfortran and INTEL.
> > 
> > In my code the following data is declared as e.g. in scatter 
> > routine  real A(nx,ny,nz), B(nx_1,ny_1,nz_1)
> >     real, allocatable :: sendbuf(:)
> >     integer i1(nproc), i2(nproc), &
> >             j1(nproc), j2(nproc), &
> >             k1(nproc), k2(nproc)
> > other parametrization  used is
> > real*8
> > 
> > What am I doing wrong?
> > kate
> > 
> > 
> > From: mpich-discuss-bounces at mcs.anl.gov 
> > [mpich-discuss-bounces at mcs.anl.gov] On Behalf Of 
> > chan at mcs.anl.gov [chan at mcs.anl.gov]
> > Sent: 29 April 2010 16:18
> > To: mpich-discuss at mcs.anl.gov
> > Subject: Re: [mpich-discuss] F90FLAGS "-i4" statement for 
> > mpich2 configuration
> > 
> > ----- "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
> > _______________________________________________
> > mpich-discuss mailing list
> > mpich-discuss at mcs.anl.gov
> > https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
> > 
> > 
> > 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
> > 
> 
> _______________________________________________
> 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