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

Header files layout #15

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

cedricchevalier19
Copy link
Member

  • Try to follow https://blogs.stonesteps.ca/1/p/64 for including header files.

  • Also headers now have only one way dependencies between / and /impl.

  • Some clean-up for CMake, like explicit list of files (*.h is notoriously bad for testing, for example, if we forget to add a new file, CMake configuration will still pass).

One question: since it is a new library, can we try to put header files in a KokkosComm directory?

User code will become:

#include <KokkosComm/KokkosComm.hpp>

I can add this to this PR or do a separate one.

Tests use the library like an external one, so they shoud use <> instead of "" to include header files.
Only use #include "" toward subdirectories.
This shows that tests rely on "impl" details.
@cedricchevalier19 cedricchevalier19 changed the title Header organization Header files layout Apr 3, 2024
@cwpearson
Copy link
Collaborator

cwpearson commented Apr 4, 2024

I'm okay with putting things into a KokkosComm directory - @masterleinad do you know if Trilinos has an opinion on the structure of the headers?

@masterleinad
Copy link
Collaborator

I'm okay with putting things into a KokkosComm directory - @masterleinad do you know if Trilinos has an opinion on the structure of the headers?

I don't know why Trilinos would care. It doesn't matter for TriBITS but I don't know if there are any other Trilinos policies regarding subdirectories for header files vs prefixing (or both).

@cedricchevalier19 cedricchevalier19 marked this pull request as draft April 4, 2024 17:18
@cedricchevalier19
Copy link
Member Author

I will update it after #14 is merged. It will be great to have the install tests!

@cwpearson
Copy link
Collaborator

cwpearson commented Apr 5, 2024

I think I would also prefer:

  • public headers can include things from impl/*
  • impl/* CANNOT include things from public header

The main offender right now are

  • KokkosComm::Req (used in the async MPI Impl::s and the packers)
  • The concepts in impl/KokkosComm_concepts.hpp (defines some things not in the Impl:: namespace, oops, needs to be fixed.)

Maybe the things needed by Impl:: should actually be moved into Impl::, and then we can export them up into the public namespace:

namespace KokkosComm {
  using Impl::Req;
  using Impl::Invokable;
  ...
}

It's a bit redundant but it means

  • the impl/* files that need the Req and concepts can use them without including a non-impl header, and then we can also have those APIs available outside of Impl::, which is what we're intending for the users.
  • We don't have to play games with how includes are ordered and carefully watch out for circular dependencies

@cedricchevalier19
Copy link
Member Author

Make sense, will do.

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

Successfully merging this pull request may close these issues.

None yet

3 participants