Search code examples
iccmpich

Cross-compile mpich-3.2 with Intel compilers collection


I'm using Intel compilers collection from Parallel Studio 2019 and trying to build MPICH-3.2 against it for the recent CPU. My configure scenario:

MPICHLIB_CFLAGS="-xCORE-AVX512" \
MPICHLIB_CXXFLAGS="-xCORE-AVX512" \
MPICHLIB_FCFLAGS="-xCORE-AVX512" \
MPICHLIB_FFLAGS="-xCORE-AVX512" \
LDFLAGS="-Wl,--disable-new-dtags" \
./configure \
CC="/opt/intel/bin/icc" \
CXX="/opt/intel/bin/icpc" \
FC="/opt/intel/bin/ifort" \
F77="/opt/intel/bin/ifort" \
--with-pic \
--enable-shared \
AR="ar" \ 
RANLIB="ranlib" \ 
--enable-f77 \
--enable-fc \
--enable-cxx \
--enable-fast=all,nompit \
--prefix=/usr \
--host=x86_64-pc-linux-gnu \
--with-cross=/root/fort.types

/root/fort.types contains:

CROSS_F77_SIZEOF_INTEGER=4
CROSS_F77_SIZEOF_REAL=4
CROSS_F77_SIZEOF_DOUBLE_PRECISION=8
CROSS_F77_TRUE_VALUE=1
CROSS_F77_FALSE_VALUE=0
CROSS_F90_ADDRESS_KIND=8
CROSS_F90_INTEGER_KIND=4

configure completes successfully but build fails with the following error:

CC       src/glue/romio/lib_libmpi_la-all_romio_symbols.lo
src/binding/fortran/use_mpi/create_f90_real.c(75): error: expected an expression
    { MPIR_F90_REAL_MODEL, MPI_REAL},
                         ^

src/binding/fortran/use_mpi/create_f90_real.c(76): error: expected an expression
    { MPIR_F90_DOUBLE_MODEL, MPI_DOUBLE_PRECISION } };
                           ^

compilation aborted for src/binding/fortran/use_mpi/create_f90_real.c (code 2)
make[2]: *** [src/binding/fortran/use_mpi/lib_libmpi_la-create_f90_real.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
src/binding/fortran/use_mpi/create_f90_complex.c(76): error: expected an expression
    { MPIR_F90_REAL_MODEL, MPI_COMPLEX},
                         ^

src/binding/fortran/use_mpi/create_f90_complex.c(77): error: expected an expression
    { MPIR_F90_DOUBLE_MODEL, MPI_DOUBLE_COMPLEX } };
                           ^

compilation aborted for src/binding/fortran/use_mpi/create_f90_complex.c (code 2)
make[2]: *** [src/binding/fortran/use_mpi/lib_libmpi_la-create_f90_complex.lo] Error 1
make[2]: Leaving directory `/root/mpich-3.2'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/mpich-3.2'
make: *** [all] Error 2

I google about this and have founded that mpif90model.h isn't initialized and therefore macros MPIR_F90_* is undefined. There was mentioned in the above link:

More specifically, the binaries that are supposed to run and tell configure what it wants to know fail to link because configure tries to set rpath.

How can I done cross compile MPICH-3.2 against Intel compilers without disabling fortran libraries?

I compile MPICH-3.2 in Docker environment with SLES 11 SP4 as container OS.


Solution

  • The problem has been solved by appending to /root/fort.types the following variables:

    CROSS_F90_OFFSET_KIND=8
    CROSS_F90_REAL_MODEL=6,37
    CROSS_F90_DOUBLE_MODEL=15,307
    CROSS_F90_INTEGER_MODEL=9
    CROSS_F90_ALL_INTEGER_MODELS=2,1,4,2,9,4,18,8,
    CROSS_F90_INTEGER_MODEL_MAP={2,1,1},{4,2,2},{9,4,4},{18,8,8},
    

    It seems configure from MPICH-3.2 isn't ready jet to build cross compile version without little "magic". Official mailing list of MPICH project doesn't get any help to solve problem. I hope my discover helps to anybody.