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

KaMPIng does not work with types which define a data() member but are no buffers. #508

Open
niklas-uhl opened this issue Jul 11, 2023 · 0 comments

Comments

@niklas-uhl
Copy link
Member

niklas-uhl commented Jul 11, 2023

Consider a user (me) wants to send the following type of element:

struct Packet {
  int         rank_;
  std::byte   data_[PACKET_SIZE];
  std::pair<int, int> address_;


  int rank() const {
    return rank_;
  }

  void rank(int rank) {
    rank_ = rank;
  }

  std::pair<int, int> address() const {
    return address_;
  }

  void address(std::pair<int, int> address) {
    address_ = address;
  }

  auto& data() {
    return data_;
  }
  auto const& data() const {
    return data_;
  }
};

With this, passed by const-ref to send_buf, we get a compile error, because KaMPIng assumes that it is a buffer.
We should therefore not only check for the data() member but also for the other properties of C++20's std::ranges::contiguous_range.

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

No branches or pull requests

1 participant