naseefo
naseefo

Reputation: 720

Array specification at (1) has more than 7 dimensions in mpif-sizeof.h

I have the following makelist file:

BIN_SUFFIX = cpu
OMP_FLAGS = -p
OPT_FLAGS = -ofast
compiler = mpifort
compiler = mpif90


#used in gfortran
MISC_FLAGS = -ffree-line-length-300 #

CFLAGS += $(OPT_FLAGS)
CFLAGS += $(OMP_FLAGS)
CFLAGS += $(MISC_FLAGS)

LFLAGS = $(CFLAGS)

COMPILE = ${compiler} -c
LINK = ${compiler}

objects = Main_multiphase.o Main_singlephase.o Module.o Init_multiphase.o Init_singlephase.o Misc.o IO_multiphase.o IO_singlephase.o Kernel_multiphase.o Kernel_singlephase.o Mpi_misc.o Mpi_pdf.o Mpi_pdf_acc.o Boundary_singlephase.o Boundary_singlephase_special_case.o Boundary_multiphase_inlet.o Boundary_multiphase_outlet.o Boundary_multiphase_other.o Boundary_multiphase_special_case.o Monitor.o Phase_gradient.o Monitor_special_case.o
LBM : $(objects)    
    ${LINK} $(LFLAGS) -o MF_LBM.$(BIN_SUFFIX) $(objects) 

Module.o : Module.F90
    ${COMPILE} $(CFLAGS) Module.F90
Main_multiphase.o : Main_multiphase.F90 Module.o
    ${COMPILE} $(CFLAGS) Main_multiphase.F90
Main_singlephase.o : Main_singlephase.F90 Module.o
    ${COMPILE} $(CFLAGS) Main_singlephase.F90
Misc.o : Misc.F90 Module.o  
    ${COMPILE} $(CFLAGS) Misc.F90
Monitor.o : Monitor.F90 Module.o    
    ${COMPILE} $(CFLAGS) Monitor.F90
Monitor_special_case.o : Monitor_special_case.F90 Module.o  
    ${COMPILE} $(CFLAGS) Monitor_special_case.F90
Boundary_multiphase_inlet.o : Boundary_multiphase_inlet.F90 Module.o    
    ${COMPILE} $(CFLAGS) Boundary_multiphase_inlet.F90
Boundary_multiphase_outlet.o : Boundary_multiphase_outlet.F90 Module.o  
    ${COMPILE} $(CFLAGS) Boundary_multiphase_outlet.F90
Boundary_multiphase_other.o : Boundary_multiphase_other.F90 Module.o    
    ${COMPILE} $(CFLAGS) Boundary_multiphase_other.F90
Boundary_multiphase_special_case.o : Boundary_multiphase_special_case.F90 Module.o  
    ${COMPILE} $(CFLAGS) Boundary_multiphase_special_case.F90
Boundary_singlephase.o : Boundary_singlephase.F90 Module.o  
    ${COMPILE} $(CFLAGS) Boundary_singlephase.F90
Boundary_singlephase_special_case.o : Boundary_singlephase_special_case.F90 Module.o    
    ${COMPILE} $(CFLAGS) Boundary_singlephase_special_case.F90
Kernel_multiphase.o : Kernel_multiphase.F90 Module.o    
    ${COMPILE} $(CFLAGS) Kernel_multiphase.F90
Kernel_singlephase.o : Kernel_singlephase.F90 Module.o  
    ${COMPILE} $(CFLAGS) Kernel_singlephase.F90
Init_multiphase.o : Init_multiphase.F90 Module.o
    ${COMPILE} $(CFLAGS) Init_multiphase.F90
Init_singlephase.o : Init_singlephase.F90 Module.o
    ${COMPILE} $(CFLAGS) Init_singlephase.F90
IO_multiphase.o : IO_multiphase.F90 Module.o
    ${COMPILE} $(CFLAGS) IO_multiphase.F90
IO_singlephase.o : IO_singlephase.F90 Module.o
    ${COMPILE} $(CFLAGS) IO_singlephase.F90
Phase_gradient.o : Phase_gradient.F90 Module.o
    ${COMPILE} $(CFLAGS) Phase_gradient.F90
Mpi_misc.o : Mpi_misc.F90 Module.o
    ${COMPILE} $(CFLAGS) Mpi_misc.F90
Mpi_pdf.o : Mpi_pdf.F90 Module.o
    ${COMPILE} $(CFLAGS) Mpi_pdf.F90
Mpi_pdf_acc.o : Mpi_pdf_acc.F90 Module.o
    ${COMPILE} $(CFLAGS) Mpi_pdf_acc.F90

clean:
    rm -f *.o *.mod
    rm MF_LBM.$(BIN_SUFFIX)

When I run the following command: make, I get the following errors:

$ make
mpif90  -c   -ofast -p -ffree-line-length-300   Main_multiphase.F90
Main_multiphase.F90:485:0:

 #endif

Warning: null character(s) ignored
mpif-sizeof.h:66:41:

Error: Array specification at (1) has more than 7 dimensions
mpif-sizeof.h:72:41:

Error: Array specification at (1) has more than 7 dimensions
mpif-sizeof.h:78:41:

Error: Array specification at (1) has more than 7 dimensions
mpif-sizeof.h:84:41:

Error: Array specification at (1) has more than 7 dimensions
mpif-sizeof.h:90:41:

.
.
.

Error: Ambiguous interfaces in generic interface 'mpi_sizeof' for ‘mpi_sizeof_real64_r14’ at (1) and ‘mpi_sizeof_real64_r15’ at (2)
mpif-sizeof.h:2631:39:

mpif-sizeof.h:2638:39:

Error: Ambiguous interfaces in generic interface 'pmpi_sizeof' for ‘pmpi_sizeof_real64_r14’ at (1) and ‘pmpi_sizeof_real64_r15’ at (2)
mpif-sizeof.h:1315:38:

mpif-sizeof.h:1322:38:

Error: Ambiguous interfaces in generic interface 'mpi_sizeof' for ‘mpi_sizeof_real64_r14’ at (1) and ‘mpi_sizeof_real64_r15’ at (2)
mpif-sizeof.h:2631:39:

mpif-sizeof.h:2638:39:

Error: Ambiguous interfaces in generic interface 'pmpi_sizeof' for ‘pmpi_sizeof_real64_r14’ at (1) and ‘pmpi_sizeof_real64_r15’ at (2)
make: *** [makefile:43: Main_multiphase.o] Error 1

I have the following version of Fortran installed:

$ mpif90 --version
GNU Fortran (GCC) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Is this issue due to the incompatibility of the compiler? My system is running Windows 10 64-bit version and I am using Cygwin.

Openmpi installation in Cygwin

enter image description here

Upvotes: 1

Views: 1367

Answers (2)

As we resolved in the comments you need to use the compiler compatible with OpenMPI you are using or the other way use the compiler compatible with your OpenMPI. Not only the header mpif.h headers of your MPI contain declarations of arrays with too many ranks for gfortran 7, but once you would use more modern Fortran features you would also hit the incompatibility of the array descriptors and hence the incompatibility of module files.

That incompatibility will become even apparent when you try to use the more modern features like use mpi or use mpi_f08 instead of include "mpif.h". The module files from the MPI library will be immediately rejected by the compiler if they come from an incompatible version. The MPI library must be compiled for the exact main compiler version. That also means that modernizing your application will not fix your current problem.

There is also a module file .mod. in your project, that uses module version 14 and was made by gfortran 5. This file will be incompatible with any other gfortran version. You will need to have it recompiled. If you ave the source code, just delete all .mod files in your project. If you do not have the source files, you need to get it.

Upvotes: 2

Gilles Gouaillardet
Gilles Gouaillardet

Reputation: 8395

TL;DR you have to use the same Fortran compiler (vendor and version) that was used to build Open MPI.

Your app does include 'mpif.h', and this internally include 'mpif-sizeof.h'. What happens here is Open MPI was built with a Fortran compiler that supports arrays with more than 7 dimensions, but the Fortran compiler you are using to build your app does not, and hence the error.

That being said, the right fix is to modernize your application, and replace the "legacy" include 'mpif.h' with a modern use mpi, or even better, use mpi_f08.

Upvotes: 1

Related Questions