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

fix: use system include syntax for all KokkosComm headers #127

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

dssgabriel
Copy link
Collaborator

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?

Removes all instances of relative paths in favor of system include-style
syntax: `<KokkosComm/...>
@dssgabriel dssgabriel self-assigned this Nov 4, 2024
@dssgabriel
Copy link
Collaborator Author

Follow-up questions (may be left for another PR):

  • do we want to follow standard C++ library design guidelines and use include instead of src as the base directory (since we're a header-only library)?
  • similarly, do we want to use details subdirs/namespaces instead of impl for implementation details?

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! 🙂

@cedricchevalier19
Copy link
Member

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 impl, it is standard practice for kokkos projects, so I think we should keep it.

Copy link
Member

@cedricchevalier19 cedricchevalier19 left a 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>
Copy link
Member

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)

Copy link
Collaborator Author

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>
Copy link
Member

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.

Copy link
Collaborator Author

@dssgabriel dssgabriel Nov 5, 2024

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. :

What would be the advantages of keeping relative includes?

#include <KokkosComm/config.hpp>

#include <vector>
Copy link
Member

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.

Copy link
Collaborator Author

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).

Comment on lines +20 to +22
#include <KokkosComm/mpi/impl/pack_traits.hpp>
#include <KokkosComm/mpi/impl/include_mpi.hpp>
#include <KokkosComm/mpi/impl/types.hpp>
Copy link
Member

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.

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.

Fix relative include in mpi.hpp
2 participants