-
Notifications
You must be signed in to change notification settings - Fork 60
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
Update MPI linking, building tests #67
Conversation
Starting from this version find_package(MPI) will export the MPI::MPI_C, MPI::MPI_Fortran, MPI::MPI_CXX targets.
More of a cosmetic change: link to MPI targets instead of MPI_C_LIBRARIES and MPI_Fortran_LIBRARIES. This should also take care of the include directories, so that line is removed. Scalapack is now linked with MPI::MPI_C.
Both SCALAPACK_BUILD_TESTS and SCALAPACK_BUILD_TESTING were used. Only SCALAPACK_BUILD_TESTS is a cache variable (defined in the main CMakeLists), so I assume all instances have to be SCALAPACK_BUILD_TESTS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! The changes look great to me
I just noticed a mistake in the main CMakeLists at line 250-254:
which will result in configure errors under MSVC, should instead be:
Is there a way to edit my pull request, or should I just cancel this pull request and create a new one? |
MPI::MPI_C was part of the add_library(scalapack <sources>) line, instead of the target_link_libraries(scalapack <libraries>) line. This resulted in cmake errors with MSVC compilers.
I tried this in my pkgsrc attempt (#66), after adapting the patch to this state: The result seems to work in linking to MPI now in the installed library. But the file list changed. I wonder if that is intentional.
So this is only the shared lib and strangely a directory versioned with 2.1.0, not 2.2.0. The old list of files looked like that:
PKGNAME is scalapack-2.2.0 in this case. I am not sure if there's some interaction with the build system around it to cause this. Where does the version number come from? And also: Is it intentional that the static library is not built anymore? |
To be honest, I don't know how the changes I made to the CMakeLists could result in the differences you mentioned. Are you building in both cases from a clean git clone, empty CMake cache, and identical build flags (so e.g. BUILD_SHARED_LIBS=ON|OFF in both cases)? If you give me your exact configure and build commands I can give it a try and try to replicate the observed behavior. |
(I am not building from a git checkout, but trying to package a released version of ScaLAPACK, so it is 2.2.0 + patches.) Well, I am comparing with the previously working (somewhat) build of scalapack 2.1.0. There, the version number of the cmake files matches. Now, in release 2.2.0, I see this in CMakeLists.txt:
Is it intentional to have that not in sync with the package release version? Regarding the shared/static libs, it's probably a surprise that the static lib was built before, too, with 2.1.0. What is the intention of the upstream project here? I used to care a lot for keeping static and shared libs installed for LAPACK, as static was the old-school default, actually tried to submit changes to that build to enable both shared and static lib build in one go. I am now tending towards not giving a **** and just getting on with life, so only the shared lib is fine by me. My only question, then, is if the SCALAPACK_VERSION in the build should match the released version. |
Sure I am looking at outdated code — the current official release;-) I see that #46 fixed that. I wonder if your intended ABI policy is appropriate, though. If the SONAME is always libscalapack.so.MAJOR.MINOR … are you intending for version 2.3 not to be backwards compatible to version 2.2? I have a project where I took care to only add API and keep the old symbols working, over many dozen minor version increases now. The SONAME is still libfoo.so.0, with the full version being libfoo.so.0.47.0 (the 47th ABI update without patchlevel. A binary built with the first library release still works with the freshest one. I consider that being nice to users. Is the ABI of 2.2.x supposed to be a subset of the ABI of 2.3.x, hence symlinking the library would work for old binaries? Or is it considered a full ABI break? Would be nice to clarify that in the docs. Then, you please be careful in increasing the minor version of ScaLAPACK to avoid too frequent program breakage with updates;-) But back to the original issue: Yes, MPI linking seems fine now with the changes of this PR ported to 2.2.0 release for my purposes. |
I cannot reproduce the case of shared and static liblapack being built now. Maybe that was an artifact of the build debugging with some inconsistent state. I'll default to only the shared lib now. |
Not intentional. I think we could (github-)release ScaLAPACK with the current master + this PR. It would solve this and a couple of other issues.
We had no policy, so not good. Then we adopted one in #48. This policy says that libscalapack.so.2.3 may not be ABI-compatible to libscalapack.so.2.2. This is similar to what they are using for Debian. Please, feel free to open a new issue to address this. We may, for instance, modify the policy a bit and use libscalapack.so.MAJOR.MINOR.PATCH. I just think this thread is not ideal to start this discussion.
In #61, there was a change in the behavior of |
Various improvements (hopefully) to MPI linking. Summary:
INCLUDE_DIRECTORIES(${MPI_INCLUDE_PATH})
: include path should be tied to the MPI targets described abovetarget_link_libraries(some_target ${MPI_Fortran_LIBRARIES})
withtarget_link_libraries(some_target MPI::MPI_Fortran)
Aside from this I noticed two variables were used for building tests:
SCALAPACK_BUILD_TESTING
andSCALAPACK_BUILD_TESTS
. Only the latter had an associated cache variable, so I assumed all instances should be the latter.