Hello, i’m trying to use Intel MPI in a CMakefile (>= 4.1)
with the 64-bit default integer size ( -ilp64 / -i8 / -integer-size:64 )
I wrote
set(MPI_Fortran_COMPILER_FLAGS "-i8")
find_package(MPI REQUIRED)
On Windows, Intel OneAPI MPI 2021.10 environment was set up by the setvars.bat.
find_package correctly detects the libraries
MPI_Fortran_LIBRARIES = C:/Program Files (x86)/Intel/oneAPI/mpi/2021.10.0/lib/libmpi_ilp64.lib;C:/Program Files (x86)/Intel/oneAPI/mpi/2021.10.0/lib/release/impi.lib
this is correct, it is important that libmpi_ilp64.lib comes before impi.lib
However, the module INCLUDE directory is not set up to the ILP64 folder, which means the Fortran compiler will load the mpi.mod belonging to 32-bit integer sizes, which results in a mismatch (and crash)
As a workaround i set something like
list(GET MPI_Fortran_INCLUDE_DIRS 0 inc)
include_directories(BEFORE ${inc}/ilp64)
additionally, the executable is linked as
add_executable(hello_mpi ${SOURCES_HELLO} )
target_link_libraries(hello_mpi MPI::MPI_Fortran)
set_property(TARGET hello_mpi PROPERTY LINKER_LANGUAGE Fortran)
I use the ifx fortran compiler.
Is this something that can be fixed inside FindMPI, or I’m using it wrongly?
Thank you!
Istvan