Bug 1301533

Summary: mpif90 fails to locate mpi.mod
Product: [Fedora] Fedora Reporter: David Jansen <jansen>
Component: mpichAssignee: Zbigniew Jędrzejewski-Szmek <zbyszek>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 25CC: dakingun, Marcin.Dulak, samtygier, zbyszek, zingale
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: mpich-3.2.1-2.fc27 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-11-28 23:47:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David Jansen 2016-01-25 10:11:40 UTC
Description of problem:

Recently (some time during the lifetime of Fedora22?), the packaging of the MPI implementations was changed and the Fortran 90 mpi.mod is now placed in /usr/lib64/gfortran/modules/mpich . The environement module sets MPI_FORTRAN_MOD_DIR to point to this location.

However, mpif90 contains no reference to this variable, so apparently, users should be aware of this, and modify their makefiles or other build environments to do some Fedora-specific (and mpich-specific) option settings to make mpif90 find its file, e.g. add -J $MPI_FORTRAN_MOD_DIR 

To me, this makes very little sense. mpif90 will (almost) always require this file, so the best place to use an option to find it, would be in the mpif90 wrapper script.

PS: the openmpi version of mpif90 seems to be able to find its module. As does the mpich version present in RHEL7, so the problem seems to be restricted to mpich on Fedora


Version-Release number of selected component (if applicable):
mpich-3.1.4-7.fc23.x86_64
gcc-gfortran-5.3.1-2.fc23.x86_64

Comment 1 zingale 2016-04-24 19:55:08 UTC
I ran into the same problem.  My up-to-date Fedora 22 works just fine (and mpi.mod is in /usr/include/mpich-x86_64, but mpi up-to-date Fedora 23 fails to find mpi.mod (it is placed instead in /usr/lib64/gfortran/modules/mpich

Note that the environment variable MPI_FORTRAN_MOD_DIR points to the correct location for both F22 and F23.

Comment 2 zingale 2016-10-10 20:27:56 UTC
this is still a bug on F24.  I am able to fix this by editing mpif90 directly, and changing the line

modincdir=/usr/include/mpich-x86_64

to read

modincdir=/usr/lib64/gfortran/modules/mpich


as a simple test program, use:

test.f90:
```
program test

  use mpi

  print *, "hello"

end program test
```

and compile as:

mpif90 -o test test.f90

Comment 3 Fedora End Of Life 2016-11-24 15:09:57 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 4 zingale 2016-11-25 19:12:00 UTC
this still exists in F24 -- I don't seem to be able to change the version

Comment 5 David Jansen 2016-11-28 12:49:50 UTC
Bug confirmed in Fedora 25.

Does anyone know what is blocking the (rather trivial) fix for this bug?

Comment 6 marcindulak 2016-12-30 13:40:02 UTC
I confirm this on Fedora 25.

$ rpm -q mpich-devel
mpich-devel-3.2-6.fc25.x86_64
$ rpm -ql mpich-devel | grep 'mod$'
/usr/lib64/gfortran/modules/mpich/mpi.mod
/usr/lib64/gfortran/modules/mpich/mpi_base.mod
/usr/lib64/gfortran/modules/mpich/mpi_constants.mod
/usr/lib64/gfortran/modules/mpich/mpi_sizeofs.mod

$ module purge
$ module load mpi/mpich-x86_64
$  mpif90 -o test test.f90 
f951: Warning: Nonexistent include directory ‘/usr/include/mpich-x86_64’ [-Wmissing-include-dirs]
f951: Warning: Nonexistent include directory ‘/usr/include/mpich-x86_64’ [-Wmissing-include-dirs]
test.f90:3:6:

   use mpi
      1
Fatal Error: Can't open module file ‘mpi.mod’ for reading at (1): No such file or directory

On the contrary openmpi does not exhibit the problem, but packages mod files also under /usr/lib64/openmpi/lib:
$ ls -al /usr/lib64/openmpi/lib/mpi.mod /usr/lib64/gfortran/modules/openmpi/mpi.mod
lrwxrwxrwx. 1 root root    28 Oct 24 18:36 /usr/lib64/gfortran/modules/openmpi/mpi.mod -> ../../../openmpi/lib/mpi.mod
-rwxr-xr-x. 1 root root 81753 Oct 24 18:35 /usr/lib64/openmpi/lib/mpi.mod

As you say, no problem on el7 with mpich-3.0-devel-3.0.4-10.el7.x86_64, but that's because mpich on el7 still ships mpich mod files under /usr/include/mpich-x86_64:
$ rpm -ql mpich-3.0-devel | grep 'mod$'
/usr/include/mpich-x86_64/mpi.mod
/usr/include/mpich-x86_64/mpi_base.mod
/usr/include/mpich-x86_64/mpi_constants.mod
/usr/include/mpich-x86_64/mpi_sizeofs.mod
and openmpi does it also the "old way":
$ rpm -ql openmpi-devel | grep 'mod$'
/usr/lib64/openmpi/lib/mpi.mod

The troubles we see are due to the effort
(bug #1154982 bug #1154991) of trying to comply with https://fedoraproject.org/wiki/Packaging:MPI which states:

MPI_FORTRAN_MOD_DIR	%{_fmoddir}/%{name}	MPI stack specific Fortran module directory

A quick workaround would consist of providing links under /usr/include/mpich-x86_64 as openmpi on Fedora does, but that leaves mod files in two locations.

The choice of the location for the mod files affects also other applications see bug #1409229

Comment 7 Fedora Update System 2017-11-14 10:57:21 UTC
mpich-3.2.1-2.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-18c6e5ac40

Comment 8 Fedora End Of Life 2017-11-16 18:31:35 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 9 David Jansen 2017-11-23 10:30:34 UTC
mpich-3.2.1-2.fc27 works, so I confirm this is fixed now (in updates-testing)

Comment 10 Fedora Update System 2017-11-28 23:47:36 UTC
mpich-3.2.1-2.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.