Skip to content
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

RFE: fftw.pc.in conditional MPI library inclusion #57

Open
mkrupcale opened this issue Mar 12, 2016 · 7 comments
Open

RFE: fftw.pc.in conditional MPI library inclusion #57

mkrupcale opened this issue Mar 12, 2016 · 7 comments

Comments

@mkrupcale
Copy link

I understand that the position of those working on FFTW is to minimize library dependencies (at least with regards to pthreads and fftw3*_threads), but when building FFTW with MPI enabled, it may be desirable to include -lfftw3*_mpi in the pkg-config libraries portion. I'm not sure if this may cause problems on other systems, but at least in Fedora, the fftw3*.pc files will be installed in their respective MPI PKG_CONFIG_PATH (i.e. /usr/lib64/mpich/lib/pkgconfig or similar) and will not conflict with those non-MPI pc files when the user loads the corresponding MPI module (i.e. module load mpi/mpich-x86_64) for configuring and building with MPI.

In any case, an easy way to conditionally include -lfftw3*_mpi is in the configure.ac file add under the if test "$enable_mpi" = "yes"; then test the lines

LIBFFTW3MPI=-lfftw3${PREC_SUFFIX}_mpi
AC_SUBST(LIBFFTW3MPI)

and change the Libs: in fftw.pc.in to
Libs: -L${libdir} @LIBFFTW3MPI@ -lfftw3@PREC_SUFFIX@ @LIBQUADMATH@.

@joelfrederico
Copy link

I'd like this, I'm compiling with FFTW MPI long precision and it would be nice to just have a pkg-config line in my configure.ac and be done. As it is, I have to check for fftw3l and then add the mpi myself, and there's no guarantee that fftw3 hasn't been compiled without mpi support, even if mpi is present.

@stevengj
Copy link
Contributor

I don't think code linking to the serial FFTW should pull in an MPI dependency. (Particularly as there can be multiple conflicting MPI libraries installed on the same system.)

Maybe there should just be a fftw_mpi.pc file installed?

@joelfrederico
Copy link

Definitely not a dependency! I'm just hoping for a pc file that reflects whether or not FFTW was compiled with MPI enabled.

@mkrupcale
Copy link
Author

@stevengj Like I said, I don't know how other systems/distributions handle MPI vs non-MPI pgk-config files, but in Fedora they will be installed into different directories and will not conflict with one another (even with multiple MPI libraries on the same system). When the user desires to link against the MPI versions, module load mpi/mpich-x86_64 or similar will set PKG_CONFIG_PATH appropriately to handle this; unloading (or not loading) the module will search the default search path to link against the serial versions alone. Thus, no unnecessary dependencies will be pulled into code linking against the serial version FFTW in this case.

For generalizing to systems without environment modules and separate pkg-config directories, your suggestion of an alternatively named MPI pkg-config file might be appropriate, though.

@stevengj
Copy link
Contributor

@mkrupcale, you don't switch between serial and MPI versions of the FFTW library. libfftw_mpi is a library that is installed in addition to the serial FFTW, and you need to link both the serial libfftw and the MPI libfftw_mpi in order to use the MPI FFTW.

Because we install both the serial and MPI libraries simultaneously, it would make sense to me to install both serial and MPI pkgconfig files simultaneously.

@mkrupcale
Copy link
Author

@stevengj Yes, I know that both the serial and MPI versions of the library must be linked in order to use MPI FFTW. This is why the MPI library is conditionally added to the pkg-config libs for the MPI version: Libs: -L${libdir} @LIBFFTW3MPI@ -lfftw3@PREC_SUFFIX@ @LIBQUADMATH@. Indeed, both the serial and MPI pkg-config files will be installed, albeit in different directories and with the same name.

@morrisonlevi
Copy link

morrisonlevi commented Jun 6, 2019

libfftw_mpi is a library that is installed in addition to the serial FFTW, and you need to link both the serial libfftw and the MPI libfftw_mpi in order to use the MPI FFTW.

Seems like a classic pkg-config Requires. Is there any opposition to an fftw3_mpi.pc.in template? I can try my hand at a PR for it, though it will probably be incomplete and incorrect since it's my first time working with such tools (I usually do CMake packages).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants