zoltan: rely on MPI wrappers instead of guessing MPI libraries#8986
zoltan: rely on MPI wrappers instead of guessing MPI libraries#8986adamjstewart merged 2 commits intospack:developfrom
Conversation
- if MPI-wrappers are used for compilation, we can assume that linking works without manually specifying MPI libs (guessing may result in wrong libs, cf. spack#8979) - thus, only guess the NPI libs and add them explicitly if no MPI-wrappers are used - use llnl.util.filesystem.find_libraries instead of a locally defined routine to guess the MPI libs if needed (cf. spack#8979)
| else: | ||
| # we do not use MPI-wrappers, thus, it is likely that we need to | ||
| # manually add libs for linking; try to find all possible ones | ||
| mpi_static_libs = find_libraries('lib*mpi*', spec['mpi'].prefix.lib, |
There was a problem hiding this comment.
Don’t we have spec[mpi].libs() ? It’s a job of MPI package to know its libs, not the packages that use it.
There was a problem hiding this comment.
I have only seen mpicxx_shared_libs. And I know that @adamjstewart suggested in #8979 (comment) to extend the MPI packages. But that's not trivial at all. For example the current intel-mpi package even seems to not correctly take into account in its mpi_libs() or mpicxx_shared_libs whether the multi-threaded versions of the library (*_mt.so) are to be used or not.
MPIs typically provide MPI-compiler-wrappers which take all these specialties into account. Thus, in the suggested patch, the 'else' branch will not be used at all for Open MPI, Intel MPI, mpich, mvapich, Spectrum MPI, ... It will only be reached on nowadays exotic systems / configurations (I'm not aware of any as e.g. even Blue Gene uses wrapper these days; maybe Cray with PrgEnv-cray?) which do not have compiler wrappers and require manual linking with -lmpi or whatever.
Moreover, Zoltan seems to need the Fortran (MPI) libraries to be linked with a C compiler which is not a typical use case.
There was a problem hiding this comment.
I just saw that even on Cray 'ftn', 'cc', and 'CC' seem to be MPI-wrappers ...; there is no need to specify anything for MPI linking.
If there are no machines / configurations without MPI wrappers, one probably could go completely without the handcrafted wrapper check ("starts with mpi") and omit the else part; just always doing config_args.append('--with-mpi-libs= ') only.
linking works without manually specifying MPI libs
(guessing may result in wrong libs as reported in building zoltan fails if openmpi has been compiled with pmi/slurm-support (i.e. without --enable-static) #8979 (comment))
MPI-wrappers are used
defined routine to guess the MPI libs if needed
(as suggested in building zoltan fails if openmpi has been compiled with pmi/slurm-support (i.e. without --enable-static) #8979 (comment))
fixes #8979