0

What is an efficient way to send/receive bits from bitset class without conversion. Is it possible to use MPI_BYTE?

If so, what to define as container for the array that is going to hold the bits? If this is not possible, which conversion is more efficient, conversion to ulong or to strings?

Archmede
  • 1,592
  • 2
  • 20
  • 37
JimBamFeng
  • 709
  • 1
  • 4
  • 20
  • How large is the bitset? Any chance it fits into an unsigned long long? How efficient do you really need it to be? – Zulan Apr 06 '17 at 19:40
  • I have a template and do not want to make it problem dependent, – JimBamFeng Apr 06 '17 at 19:44
  • 1
    Since there is no well defined way to access the underlying data, you can basically chose: 1) Efficient but limited to a size of 64, 2) Efficient but really dangerous and totally not portable, 3) Inefficient but general, 4) Reimplement `std::bitset`. – Zulan Apr 06 '17 at 19:51
  • option 3 does not sound bad, I think sending MPI_BYTE should somehow work, do you agree? I agree with you on uint_64 – JimBamFeng Apr 06 '17 at 19:55
  • 1
    Convert to array of "bool" and sending it by MPI_BYTE works on cluster ... – JimBamFeng May 21 '17 at 20:14
  • Feel free to post that as an answer to your question. – Zulan May 21 '17 at 20:53

1 Answers1

0

Convert it to array of "bool" and send by MPI_BYTE, this method works on cluster.

JimBamFeng
  • 709
  • 1
  • 4
  • 20