-
Notifications
You must be signed in to change notification settings - Fork 68
config/cmake: find MPI if the MPI component is requested #1479
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
base: develop
Are you sure you want to change the base?
Conversation
|
We made a choice that folks can use a conduit built with MPI, downstream w/o using its MPI features w/o having to locate mpi. We actually have tests that support this use case, one is our basic example of how to build conduit with cmake: https://github.com/LLNL/conduit/blob/develop/src/examples/using-with-cmake/CMakeLists.txt This means that downstream use must find MPI when using Conduit's MPI features. The need to find mpi downstream is reflected in our using-with-cmake-mpi example:
There are some other caveats about this: Even when MPI is on we may not search for it when it is implicitly supported by the compiler (cray use cases...) This config var reveals if that is the case: conduit/src/config/ConduitConfig.cmake.in Line 49 in dffc5a6
|
|
Can it be requested that Conduit does it via a component?
|
|
@mathstuf yes, that sounds like a much nicer way to formalize this |
The package is intended to be found via `find_package(Conduit)`, so set the package name's `_FOUND` variable directly.
f9806f2 to
678113d
Compare
|
OK, I've added logic to handle components and then added support for the MPI component which takes the considerations you mentioned into account. I also updated the example to use the MPI component and bail if it isn't reported as being found. The example was also unconditionally using |
678113d to
42c6873
Compare
cyrush
left a comment
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.
Awesome, thanks for adding the component based logic and updating the examples.
I have one question about the cmake config changes.
3172368 to
3c49e34
Compare
Otherwise projects using `conduit::conduit_mpi` may get errors about `MPI::MPI_C` not being a target without finding it themselves. Instead of requesting users to find MPI themselves, let them request support via an MPI component.
Also drop the explicit `MPI::MPI_C` link as `conduit::conduit_mpi` already does this.
Two subsequent searches could have different component requests, so remove the `CONDUIT_FOUND` guard that skips over that logic.
3c49e34 to
1654911
Compare
Otherwise projects using
conduit::conduit_mpimay get errors aboutMPI::MPI_Cnot being a target without finding it themselves.