Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: [OMPI users] Alignment of Fortran variables with ifort
From: Martin Siegert (siegert_at_[hidden])
Date: 2010-07-28 18:40:55


Hi,

I am creating a new thread (was: MPI_Allreduce on local machine).

On Wed, Jul 28, 2010 at 05:07:29PM -0400, Gus Correa wrote:
> Still, the alignment under Intel may or may not be right.
> And this may or may not explain the errors that Hugo has got.
>
> FYI, the ompi_info from my OpenMPI 1.3.2 and 1.2.8
> report exactly the same as OpenMPI 1.4.2, namely
> Fort dbl prec size: 4 and
> Fort dbl prec align: 4,
> except that *if the Intel Fortran compiler (ifort) was used*
> I get 1 byte alignment:
> Fort dbl prec align: 1
>
> So, this issue has been around for a while,
> and involves both the size and the alignment (in Intel)
> of double precision.

There is something strange going on when configuring with ifort.
This is the output from configure:

# grep 'alignment of Fortran' configure-intel.log
checking alignment of Fortran LOGICAL... 1
checking alignment of Fortran LOGICAL*1... 1
checking alignment of Fortran LOGICAL*2... 1
checking alignment of Fortran LOGICAL*4... 1
checking alignment of Fortran LOGICAL*8... 1
checking alignment of Fortran INTEGER... 1
checking alignment of Fortran INTEGER*1... 1
checking alignment of Fortran INTEGER*2... 1
checking alignment of Fortran INTEGER*4... 1
checking alignment of Fortran INTEGER*8... 1
checking alignment of Fortran REAL... 1
checking alignment of Fortran REAL*4... 1
checking alignment of Fortran REAL*8... 1
checking alignment of Fortran REAL*16... 1
checking alignment of Fortran DOUBLE PRECISION... 1
checking alignment of Fortran COMPLEX... 1
checking alignment of Fortran COMPLEX*8... 1
checking alignment of Fortran COMPLEX*16... 1
checking alignment of Fortran COMPLEX*32... 1

All alignments are 1. And this gets entered into opal/include/opal_config.h:

# grep OMPI_ALIGNMENT_FORTRAN opal/include/opal_config.h
#define OMPI_ALIGNMENT_FORTRAN_COMPLEX 1
#define OMPI_ALIGNMENT_FORTRAN_COMPLEX16 1
#define OMPI_ALIGNMENT_FORTRAN_COMPLEX32 1
#define OMPI_ALIGNMENT_FORTRAN_COMPLEX8 1
#define OMPI_ALIGNMENT_FORTRAN_DOUBLE_PRECISION 1
#define OMPI_ALIGNMENT_FORTRAN_INTEGER 1
#define OMPI_ALIGNMENT_FORTRAN_INTEGER1 1
#define OMPI_ALIGNMENT_FORTRAN_INTEGER16 4
#define OMPI_ALIGNMENT_FORTRAN_INTEGER2 1
#define OMPI_ALIGNMENT_FORTRAN_INTEGER4 1
#define OMPI_ALIGNMENT_FORTRAN_INTEGER8 1
#define OMPI_ALIGNMENT_FORTRAN_LOGICAL 1
#define OMPI_ALIGNMENT_FORTRAN_LOGICAL1 1
#define OMPI_ALIGNMENT_FORTRAN_LOGICAL2 1
#define OMPI_ALIGNMENT_FORTRAN_LOGICAL4 1
#define OMPI_ALIGNMENT_FORTRAN_LOGICAL8 1
#define OMPI_ALIGNMENT_FORTRAN_REAL 1
#define OMPI_ALIGNMENT_FORTRAN_REAL16 1
#define OMPI_ALIGNMENT_FORTRAN_REAL2 4
#define OMPI_ALIGNMENT_FORTRAN_REAL4 1
#define OMPI_ALIGNMENT_FORTRAN_REAL8 1

Whereas with gfortran everything appears correctly:

# grep 'alignment of Fortran' configure-gfortran.log
checking alignment of Fortran LOGICAL... 4
checking alignment of Fortran LOGICAL*1... 1
checking alignment of Fortran LOGICAL*2... 2
checking alignment of Fortran LOGICAL*4... 4
checking alignment of Fortran LOGICAL*8... 8
checking alignment of Fortran INTEGER... 4
checking alignment of Fortran INTEGER*1... 1
checking alignment of Fortran INTEGER*2... 2
checking alignment of Fortran INTEGER*4... 4
checking alignment of Fortran INTEGER*8... 8
checking alignment of Fortran REAL... 4
checking alignment of Fortran REAL*4... 4
checking alignment of Fortran REAL*8... 8
checking alignment of Fortran DOUBLE PRECISION... 8
checking alignment of Fortran COMPLEX... 4
checking alignment of Fortran COMPLEX*8... 4
checking alignment of Fortran COMPLEX*16... 8

I may be totally lucky here: I never really use ifort to compile
openmpi - I only use it to compile the mpi.mod module, but use it
with the gfortran "compiled" openmpi
(see:
http://www.open-mpi.org/community/lists/users/2009/07/10017.php
)
As far as I can tell the Fortran compiler is only used by configure
and to compile the Fortran module. It is not used for anything else
when compiling openmpi.

Thus this procedure may have saved me - or not:
a grep through the openmpi code
# grep -r -l --exclude=*.log OMPI_ALIGNMENT_FORTRAN .
./ompi/datatype/dt_module.c
./ompi/tools/ompi_info/param.cc
./opal/include/opal_config.h
shows that there are only three files that reference such variables.
The only one that is worrisome is dt_module.c.
Maybe these macros do not play a role?

- Martin