-
Notifications
You must be signed in to change notification settings - Fork 10
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
fix: use system include syntax for all KokkosComm headers #127
base: develop
Are you sure you want to change the base?
Conversation
Removes all instances of relative paths in favor of system include-style syntax: `<KokkosComm/...>
Follow-up questions (may be left for another PR):
See the Beman Project — an effort to support open-source, community-driven implementations of standard C++ paper proposals — example library structure for more guidance: https://github.com/beman-project/exemplar I understand that I may be nitpicking here, feel free to dismiss the ideas if you think they're irrelevant to KokkosComm! 🙂 |
It is not clear that we will be a header-only library forever. It might be interesting to have some precompiled parts to hide some internals in our compiling units. As for |
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.
A simpler PR with changes focused on the tests and core files where the relative include is upward will be better suited to solve the issue.
#include <Kokkos_Core.hpp> | ||
#include <benchmark/benchmark.h> | ||
#include <mpi.h> |
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.
Are we sure that the custom include_mpi.hpp
is not needed anymore?
(Note that I am in favor of a more standard way to include mpi)
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.
I haven't touched it in the KokkosComm headers, but including MPI directly using the standard header works fine in tests.
#include "fwd.hpp" | ||
#include <KokkosComm/fwd.hpp> |
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.
This is not necessary, and it can have some advantages to look for a file with a path relative to this file.
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.
I feel like it would be better to stay consistent and use the same include syntax everywhere. When looking at large "standard C++-style" libraries, they always use the system includes.
See e.g. :
- boost/hana: https://github.com/boostorg/hana/blob/master/include/boost/hana/append.hpp
- beman/execution26: https://github.com/beman-project/execution26/blob/main/include/beman/execution26/detail/basic_operation.hpp
What would be the advantages of keeping relative includes?
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.
We do not rely on INCLUDE_DIRS.
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.
I agree with @dssgabriel. The moment a client code brings its own fwd.hpp
KokkosComm will fall apart. Use proper namespacing for include paths.
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.
To me, it is quite the opposite, including a relative path force to use the correct file. Protecting collision with a directory is good but imperfect; if a user can have a KokkosComm/fwd.h
in a path before ours, we will use it.
It is not required
by the standard that the compiler deals this way with quotes and brackets, but it was an observation. I was bracket-team in the past, and I think using quotes at the correct places can improve correctness and speed.
#include <KokkosComm/config.hpp> | ||
|
||
#include <vector> |
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.
Usually, we put std
headers close to the top, like second after the associated header file if it is cpp.
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.
Similarly, large "standard C++-style" libraries seem to always include std
headers after project headers (see examples shared previously).
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.
Some others do the opposite: https://google.github.io/styleguide/cppguide.html#Names_and_Order_of_Includes.
#include <KokkosComm/mpi/impl/pack_traits.hpp> | ||
#include <KokkosComm/mpi/impl/include_mpi.hpp> | ||
#include <KokkosComm/mpi/impl/types.hpp> |
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.
We can (should?) keep it relative.
Fixes #120.
Removes all instances of relative paths in favor of system include-style syntax:
<KokkosComm/...>
I think we can also get rid of the
KokkosComm/mpi/impl/include_mpi.hpp
header?