-
Notifications
You must be signed in to change notification settings - Fork 885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fortran .mod files installed in libdir instead of includedir #12600
Comments
I do not necessarily agree with your interpretation. |
Sorry, I should have clarified that LDFLAGS, FCFLAGS, etc. are all set to find the directories in the proper prefix, so |
A more succinct illustration, excluding the compiler wrappers and cross-compilation, just gfortran: program test_use_mpi
use mpi
implicit none
integer :: ierr, numprocs, proc_num
call mpi_init(ierr)
call mpi_comm_size(MPI_COMM_WORLD, numprocs, ierr)
call mpi_comm_rank(MPI_COMM_WORLD, proc_num, ierr)
print *, 'Hello from Process number', proc_num, &
' of ', numprocs, ' processes'
call mpi_finalize(ierr)
end program test_use_mpi compilations fails with standard args, which I think is reasonably expected to work: > gfortran -I$PREFIX/include -L$PREFIX/lib -lmpi_mpifh test.f90
3 | use mpi
| 1
Fatal Error: Cannot open module file ‘mpi.mod’ for reading at (1): No such file or directory but succeeds when mixing include arguments and lib directories: gfortran -I$PREFIX/include -I$PREFIX/lib -L$PREFIX/lib -lmpi_mpifh test.f90 |
There are two main MPI implementations: If you want to cross-compile Even if the |
Yes, it is easy enough to work around by adding In conda-forge, I think we'll fix installation of the modules to the include directory, as is done in debian's libopenmpi-dev, for example. |
I am a bit surprised If you can point me to some logs, I will have a look at it. |
I shared the output from
Not at all. It's detecting that the compiler cannot find mpi.mod, doesn't figure out where mpi.mod is because it's not in a standard include location, and stops. FindMPI searches include paths for mpi.mod (like gfortran itself), so setting As you've mentioned, we don't expect cross-compilation to work without help, so we fully expect to have to specify include and lib directories, which we do. |
@ggouaillardet Our root complaint is the following: Open MPI is installing Fortran .mod files in the Perhaps Open MPI could learn a new configure option to install Fortran modules in |
Thanks for the pointer. I do appreciate having the Open MPI Fortran modules in the |
I'd say that cmake correctly identifies the compiler as not working and halts without bending over backwards to fix it, but sure. This seems like entirely sensible behavior and I have no complaints.
it's unclear if you mean for you or for us, but if you mean for us, I agree and this was resolved some time ago (adding When cross compiling, I fully expect to need to find compiler and link arguments myself, and am fully okay with that requirement as a packager. It was in this process of finding what I needed |
Since you are switching wrappers from compiler to cross-compiler, it is up to you to fix the wrappers. You can do that by setting the right paths in |
Yup, and we've done that. All cross compilation's working fine. The only issue here is the peculiar installation path of include files in the lib directory. |
I am not sure I understand correctly. Are you saying the build still fail (e.g. cannot find |
No builds fail. As mentioned in the original report, adding |
Your initial report was I don't understand why only the cross-compilation case is affected. adding My point is Anyway, it seems we cannot understand each other, so I will let other folks comment on this. |
Sorry for the miscommunication. Yes, I should not have mentioned my lack of understanding of which cases were affected because it was not relevant to the issue at hand, and is why I updated the description to remove it since it could be read as a question, which it wasn't meant to be, and tried to clarify the relationship between the issue (paths) and how we happened to encounter it (cross compilation). I think I understand why now, but it remains not relevant to the actual issue, which affects all openmpi installs, not just cross compilation. |
FWIW, here is a simple In my environment,
|
Thanks. I'm trying really hard to be clear that I'm not asking for help building against mpi, nor am I trying to claim that anything doesn't work as intended. I really just wanted to report that the include files are in the wrong folder, not that mpifort can't find them. openmpi correctly tracks where it puts module files and records that in the compiler wrapper data. It just happens to be a weird folder, and it looks like a typo. |
Well, I don't believe it is a typo, but a deliberate choice of Open MPI. While I agree libdir is not the usual place to store for .mod files, I also have to acknowledge that .mod files may not be truly platform-independent as C .h header files can be. Therefore, I can understand the argument about libdir being an appropriate location for module files. |
I'll throw in a little history here... It looks like the code that installs the
I say this because I'm very sure that Past Jeff wouldn't have installed (essentially) header files into That being said, if things have changed since then, and if the norm is that we should install modulefiles into
Does that sound reasonable? |
Thanks for the context! It's definitely not a strong need, nothing is really hindered by the unusual install location, so no rush at all. Honestly, this is mostly an aesthetic issue, so if doing it in 6.0 makes you most comfortable I'm 100% behind that. |
@minrk Ok, great. I've re-labeled this PR as v6.0.x. Let's see if we can get this done soon-ish on |
In defense of Past Jeff, I want to point that in my opinion *.mod files are not really header files, they are compiler-dependent and to the best of my knowledge they are not guaranteed to be even platform independent. Therefore, putting *.mod files in
A backward-compatible way to do things would be to add a configure option to v5.x to let distributors decide the destination of *.mod files. |
One more datapoint: For the time being, I'd rather add yet an other |
Even though they are usually binary and compiler-dependent, they are used by Fortran compilers like header files. One needs to look at where compilers look for modules: do they look in the |
my point is this is irrelevant: either use the wrappers (they already know where to look at), or if one insists on having CMake use the compilers, let it get the correct include path(s) from the wrappers. |
Modules are use-included at compile-time, not link-time, and they belong in the include directory. Not everyone uses wrappers and not everyone uses cmake. |
I think the notion of a 'module' dir is not unusual, though includedir is still probably the most sensible default value for it. I think debian's openmpi-dev follows this pattern (it appears to place a copy of includedir headers in the fortran module directory alongside .mod files, in addition to the C includedir, and patches mpifort to set includedir to this module directory). |
from https://packages.debian.org/buster/amd64/libopenmpi-dev/filelist
|
Thanks, that's what I was referring to. |
that directory (you call moduledir, which is not an autotools thing) only contains mod files (at least according to the filelist i shared earlier). Anyway, instead of arguing whether |
Sorry for the confusion, I didn't realize you were looking at buster. I was looking at stable. Sorry for the wasted energy, I regret participating. |
?? I think that this is a perfectly fine conversation to have. I don't regret anything here. One point that I think is worth re-emphasizing: the wrapper compilers and the supported mechanisms to extract compiler / linker flags from Open MPI have always been consistent. Hence, anyone using any of those methods will be able to compile and link successfully. I don't think that's under debate here. What's under debate is 1) whether we should move the .mod files out of If the answer to 1) is yes, then the answer to 2) also has to be yes. My personal $0.02 is that the answers to both should be "yes". Per my above comment, I'm totally fine moving the .mod files out of
Opinions? |
I agree that the answer to both is yes, and I think includedir is the most logical default, since that's where ~all other packages seem to put these files. I don't think there is any other standard location, so it seems best to me to leave selecting that to the installer if it should deviate from the default of includedir for include files.
While it is in /usr/lib, it is not under $libdir, which is
It's an environment variable
It appears to be quite debian-specific and not a standard thing, so I wouldn't suggest trying to replicate the pattern. |
After much discussion, the choice was made to keep installing Open MPI's Fortran modules into This is included in v5.0.4rc1. |
Background information
What version of Open MPI are you using? (e.g., v4.1.6, v5.0.1, git branch name and hash, etc.)
v5.0.3 and 4.1.6
Describe how Open MPI was installed (e.g., from a source/distribution tarball, from a git clone, from an operating system distribution package, etc.)
conda install openmpi
via conda-forge, which in turn was built from a distribution tarball with no patches.Please describe the system on which you are running
Details of the problem
Fortran
mpi.mod
and friends are installed in$PREFIX/lib/mpi.mod
, etc. But since these files are searched via-I
, it seems like they should be installed in$PREFIX/include/mpi.mod
instead. FWIW, mpich puts them in $PREFIX/include, and fortran docs suggest include as well.(note: cross compilation discussion below is not relevant to the issue, just how we discovered it)
Came up here when cross-compiling from intel mac to arm, which means there are two installations of openmpi:
use mpi
fails to find mpi.mod because libdir is not on the default include path (I'm not sure why it doesn't come up in more cases), cmake's fortran discovery fails with:Adding
-I$PREFIX/lib
to OMPI_FCFLAGS results in successful compilation.The text was updated successfully, but these errors were encountered: