fortran-lang / fpm

Fortran Package Manager (fpm)
https://fpm.fortran-lang.org
MIT License
895 stars 100 forks source link

Request support for gfortran + IntelMPI #974

Open rileychall opened 1 year ago

rileychall commented 1 year ago

Description

I'm trying to build an MPI Fortran program using gfortran and Intel MPI. However it immediately fails with this message:

$ fpm build --flag '-ffree-line-length-none'
<ERROR> *cmd_build* Model error: local MPICH library wrapper does not support flag -compile-info
STOP 1

To my knowledge, there is no MPICH on this system. Also, the mpif90 that is in the path does correctly respond to -compile-info:

$ mpif90 -compile-info
gfortran -I"/home/hallrc/intel/oneapi/mpi/2021.11/include/mpi/gfortran/9.1.0" [...]

The --verbose option does not show any more information.* Adding --compiler 'mpif90' gives the same result, so it looks like it's finding the wrapper I intend. --compiler 'mpiifort' appears to work correctly. The code is incompatible and it fails, but it does successfully compile the first few files:

$ fpm build --compiler 'mpiifort'
 + which mpiexec
/home/hallrc/intel/oneapi/mpi/2021.11/bin/mpiexec
emuinit.F                              done.
md_io.F                                done.
[... until actual compile error]

compiler 'mpiifx' also immediately fails, but with a different message:

$ fpm build --compiler 'mpiifx'
<ERROR> *cmd_build* Model error: cannot find MPI wrappers or libraries for ifx compiler
STOP 1

This seems like a separate issue to me, but I'm including it just in case. I am using the recently released 2024 Intel compilers, so I could see this just being something needs to updated to accommodate.

Expected Behaviour

I was expecting this to work the same way as on the other systems I've tried. In the event that it didn't work, I was expecting a more relevant error message.

Version of fpm

0.9.0

Platform and Architecture

Ubuntu 22.04

Additional Information

Just for some context, this is using "Bad system 1" from #973. I ran into this while trying Intel MPI as an alternative to Open MPI.

Here is the full mpif90 -compile-info/mpif90 -show, in case it contains any clues:

$ mpif90 -compile-info
gfortran -I"/home/hallrc/intel/oneapi/mpi/2021.11/include/mpi/gfortran/9.1.0" -I"/home/hallrc/intel/oneapi/mpi/2021.11/include" -I"/home/hallrc/intel/oneapi/mpi/2021.11/include/mpi" -L"/home/hallrc/intel/oneapi/mpi/2021.11/lib" -L"/home/hallrc/intel/oneapi/mpi/2021.11/lib" -Xlinker --enable-new-dtags -Xlinker -rpath -Xlinker "/home/hallrc/intel/oneapi/mpi/2021.11/lib" -Xlinker -rpath -Xlinker "/home/hallrc/intel/oneapi/mpi/2021.11/lib" -lmpifort -lmpi -lrt -lpthread -Wl,-z,now -Wl,-z,relro -Wl,-z,noexecstack -Xlinker --enable-new-dtags -ldl

*With this line, it looks like --verbose should have printed something useful but didn't. Though I could definitely be misunderstanding it.

perazz commented 12 months ago

gfortran + IntelMPI is not among the supported use cases yet. It seems relatively straightforward to support it, I will leave here a reference to the relevant piece of code:

https://github.com/fortran-lang/fpm/blob/4c1a93f55b6a0f335c43082c89a4709827558016/src/fpm_meta.f90#L1331

rileychall commented 12 months ago

Ah, of course. I did miss that. Do you know why it would produce that error? And is there any significance to gfortran + Intel MPI working on a different system, as on the "Good system" in my other issue?