Skip to content

MPI-code can not be built with Intel compiler when using standard flags #1034

Closed
@aradi

Description

@aradi

Description

The compiler flags used by fpm when building with the Intel oneAPI compiler prevent the successful build of MPI-parallelized code using IntelMPI.

To reproduce:
Create a standard fpm project with

fpm new test

modify fpm.toml to contain

[fortran]
implicit-typing = true
implicit-external = true
source-form = "free"

[dependencies]
mpi = "*"

and modify the library source file as follows

module test
 use mpi_f08, only : MPI_COMM_WORLD, mpi_barrier, mpi_init, mpi_finalize
 implicit none
 private

 public :: say_hello
contains
 subroutine say_hello
   call mpi_init()
   call MPI_Barrier(MPI_COMM_WORLD)
   print *, "Hello, test!"
   call mpi_finalize()
 end subroutine say_hello
end module test

and build it with

FPM_FC=ifx fpm build

Using ifx (IFX) 2024.1.0 20240308 I obtain the error message:

ld: build/ifx_434F714D4D7C6A1A/test/libtest.a(src_test.f90.o): in function `test_MP_say_hello_':
/media/aradi/ramdisk/test/././src/test.f90:10:(.text+0x2c): undefined reference to `mpi_f08_compile_constants_MP_mpi_comm_world_'
ld: build/ifx_434F714D4D7C6A1A/test/libtest.a(src_test.f90.o):(.debug_info+0x3e): undefined reference to `mpi_f08_compile_constants_MP_mpi_comm_world_'

Expected Behaviour

It would be desirable, especially for less experienced programmers, that MPI-parallel code compiles with the oneAPI compiler automatically,

Version of fpm

0.10.1, alpha

Platform and Architecture

Linux

Additional Information

The culprit is the -standard-semantics option. Using this option changes the name mangling, and the IntelMPI fortran modules apparently use the "original" name mangling. Issuing

FPM_FC=ifx FPM_FFLAGS="-standard-semantics" fpm build

generates the same error. Using

FPM_FC=ifx FPM_FFLAGS="-stand f18" fpm build

instead leads to a successful build

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions